Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SVX_INC_SVDIBROW_HXX
21 : #define INCLUDED_SVX_INC_SVDIBROW_HXX
22 :
23 : #include <svtools/brwbox.hxx>
24 : #include <vcl/edit.hxx>
25 : #include <vcl/floatwin.hxx>
26 :
27 : class SfxItemSet;
28 : class ImpItemListRow;
29 : class BrowserMouseEvent;
30 :
31 : class _SdrItemBrowserControl: public BrowseBox
32 : {
33 : friend class ImpItemEdit;
34 : std::vector<ImpItemListRow*> aList;
35 : long nAktPaintRow;
36 : Edit* pEditControl;
37 : OUString aWNamMerk;
38 : Link aEntryChangedHdl;
39 : Link aSetDirtyHdl;
40 : ImpItemListRow* pAktChangeEntry;
41 : long nLastWhichOfs;
42 : sal_uInt16 nLastWhich;
43 : sal_uInt16 nLastWhichOben;
44 : sal_uInt16 nLastWhichUnten;
45 : bool bWhichesButNames;
46 : bool bDontHideIneffectiveItems;
47 : bool bDontSortItems;
48 : bool bShowWhichIds;
49 : bool bShowRealValues;
50 :
51 : private:
52 : void ImpCtor();
53 : void ImpSetEntry(const ImpItemListRow& rEntry, sal_uIntPtr nEntryNum);
54 0 : ImpItemListRow* ImpGetEntry(sal_uIntPtr nPos) const { return aList[nPos]; }
55 : void ImpSaveWhich();
56 : void ImpRestoreWhich();
57 :
58 : protected:
59 : virtual long GetRowCount() const SAL_OVERRIDE;
60 : virtual bool SeekRow(long nRow) SAL_OVERRIDE;
61 : virtual void PaintField(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const SAL_OVERRIDE;
62 : virtual void DoubleClick(const BrowserMouseEvent&) SAL_OVERRIDE;
63 : virtual void KeyInput(const KeyEvent& rEvt) SAL_OVERRIDE;
64 : virtual void Select() SAL_OVERRIDE;
65 : virtual void SetDirty(); // is called for example in mode switches
66 : virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) SAL_OVERRIDE;
67 : virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) SAL_OVERRIDE;
68 : public:
69 : _SdrItemBrowserControl(vcl::Window* pParent, WinBits nBits=WB_3DLOOK|WB_BORDER|WB_TABSTOP);
70 : virtual ~_SdrItemBrowserControl();
71 : void Clear();
72 : void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL);
73 : sal_uIntPtr GetCurrentPos() const;
74 : sal_uInt16 GetCurrentWhich() const;
75 : virtual bool BegChangeEntry(sal_uIntPtr nPos);
76 : virtual bool EndChangeEntry();
77 : virtual void BrkChangeEntry();
78 :
79 : /** GetCellText returns the text at the given position
80 : @param _nRow
81 : the number of the row
82 : @param _nColId
83 : the ID of the column
84 : @return
85 : the text out of the cell
86 : */
87 : virtual OUString GetCellText(long _nRow, sal_uInt16 _nColId) const SAL_OVERRIDE;
88 :
89 0 : const ImpItemListRow* GetAktChangeEntry() const { return pAktChangeEntry; }
90 0 : OUString GetNewEntryValue() const { return pEditControl->GetText(); }
91 0 : void SetEntryChangedHdl(const Link& rLink) { aEntryChangedHdl=rLink; }
92 : const Link& GetEntryChangedHdl() const { return aEntryChangedHdl; }
93 0 : void SetSetDirtyHdl(const Link& rLink) { aSetDirtyHdl=rLink; }
94 : const Link& GetSetDirtyHdl() const { return aSetDirtyHdl; }
95 : };
96 :
97 : #define WB_STDSIZEABLEDOCKWIN (WB_STDDOCKWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
98 : #define WB_STDSIZEABLEFLOATWIN (WB_STDFLOATWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
99 :
100 : class _SdrItemBrowserWindow: public FloatingWindow {
101 : _SdrItemBrowserControl aBrowse;
102 : public:
103 : _SdrItemBrowserWindow(vcl::Window* pParent, WinBits nBits=WB_STDSIZEABLEDOCKWIN);
104 : virtual ~_SdrItemBrowserWindow();
105 : virtual void Resize() SAL_OVERRIDE;
106 : virtual void GetFocus() SAL_OVERRIDE;
107 : void Clear() { aBrowse.Clear(); }
108 0 : void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL) { aBrowse.SetAttributes(pAttr,p2ndSet); }
109 : void SetFloatingMode(bool /*bOn*/) {}
110 : const _SdrItemBrowserControl& GetBrowserControl() const { return aBrowse; }
111 0 : _SdrItemBrowserControl& GetBrowserControl() { return aBrowse; }
112 : };
113 :
114 : class SdrView;
115 :
116 0 : class SdrItemBrowser: public _SdrItemBrowserWindow {
117 : Timer aIdleTimer;
118 : SdrView* pView;
119 : bool bDirty;
120 : private:
121 : static vcl::Window* ImpGetViewWin(SdrView& rView);
122 : DECL_LINK(IdleHdl, void *);
123 : DECL_LINK(ChangedHdl,_SdrItemBrowserControl*);
124 : DECL_LINK(SetDirtyHdl, void *);
125 : public:
126 : SdrItemBrowser(SdrView& rView);
127 : void ForceParent();
128 : void SetView(SdrView& rView) { pView=&rView; ForceParent(); SetDirty(); }
129 : void SetDirty();
130 : void Undirty();
131 : void ForceUndirty() { if (bDirty) Undirty(); }
132 : };
133 :
134 : #endif // INCLUDED_SVX_INC_SVDIBROW_HXX
135 :
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|