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 : #include <vcl/idle.hxx>
27 :
28 : class SfxItemSet;
29 : class ImpItemListRow;
30 : class BrowserMouseEvent;
31 :
32 : class _SdrItemBrowserControl: public BrowseBox
33 : {
34 : friend class ImpItemEdit;
35 : std::vector<ImpItemListRow*> aList;
36 : long nAktPaintRow;
37 : VclPtr<Edit> pEditControl;
38 : OUString aWNamMerk;
39 : Link<> aEntryChangedHdl;
40 : Link<> aSetDirtyHdl;
41 : ImpItemListRow* pAktChangeEntry;
42 : long nLastWhichOfs;
43 : sal_uInt16 nLastWhich;
44 : sal_uInt16 nLastWhichOben;
45 : sal_uInt16 nLastWhichUnten;
46 : bool bWhichesButNames;
47 : bool bDontHideIneffectiveItems;
48 : bool bDontSortItems;
49 : bool bShowWhichIds;
50 : bool bShowRealValues;
51 :
52 : private:
53 : void ImpCtor();
54 : void ImpSetEntry(const ImpItemListRow& rEntry, sal_uIntPtr nEntryNum);
55 0 : ImpItemListRow* ImpGetEntry(sal_uIntPtr nPos) const { return aList[nPos]; }
56 : void ImpSaveWhich();
57 : void ImpRestoreWhich();
58 :
59 : protected:
60 : virtual long GetRowCount() const SAL_OVERRIDE;
61 : virtual bool SeekRow(long nRow) SAL_OVERRIDE;
62 : virtual void PaintField(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const SAL_OVERRIDE;
63 : virtual void DoubleClick(const BrowserMouseEvent&) SAL_OVERRIDE;
64 : virtual void KeyInput(const KeyEvent& rEvt) SAL_OVERRIDE;
65 : virtual void Select() SAL_OVERRIDE;
66 : void SetDirty(); // is called for example in mode switches
67 : virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) SAL_OVERRIDE;
68 : virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) SAL_OVERRIDE;
69 : public:
70 : _SdrItemBrowserControl(vcl::Window* pParent, WinBits nBits=WB_3DLOOK|WB_BORDER|WB_TABSTOP);
71 : virtual ~_SdrItemBrowserControl();
72 : virtual void dispose() SAL_OVERRIDE;
73 : void Clear();
74 : void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL);
75 : sal_uIntPtr GetCurrentPos() const;
76 : sal_uInt16 GetCurrentWhich() const;
77 : bool BegChangeEntry(sal_uIntPtr nPos);
78 : bool EndChangeEntry();
79 : void BrkChangeEntry();
80 :
81 : /** GetCellText returns the text at the given position
82 : @param _nRow
83 : the number of the row
84 : @param _nColId
85 : the ID of the column
86 : @return
87 : the text out of the cell
88 : */
89 : virtual OUString GetCellText(long _nRow, sal_uInt16 _nColId) const SAL_OVERRIDE;
90 :
91 0 : const ImpItemListRow* GetAktChangeEntry() const { return pAktChangeEntry; }
92 0 : OUString GetNewEntryValue() const { return pEditControl->GetText(); }
93 0 : void SetEntryChangedHdl(const Link<>& rLink) { aEntryChangedHdl=rLink; }
94 : const Link<>& GetEntryChangedHdl() const { return aEntryChangedHdl; }
95 0 : void SetSetDirtyHdl(const Link<>& rLink) { aSetDirtyHdl=rLink; }
96 : const Link<>& GetSetDirtyHdl() const { return aSetDirtyHdl; }
97 : };
98 :
99 : #define WB_STDSIZEABLEDOCKWIN (WB_STDDOCKWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
100 : #define WB_STDSIZEABLEFLOATWIN (WB_STDFLOATWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
101 :
102 : class _SdrItemBrowserWindow: public FloatingWindow {
103 : VclPtr<_SdrItemBrowserControl> aBrowse;
104 : public:
105 : _SdrItemBrowserWindow(vcl::Window* pParent, WinBits nBits=WB_STDSIZEABLEDOCKWIN);
106 : virtual ~_SdrItemBrowserWindow();
107 : virtual void dispose() SAL_OVERRIDE;
108 : virtual void Resize() SAL_OVERRIDE;
109 : virtual void GetFocus() SAL_OVERRIDE;
110 : void Clear() { aBrowse->Clear(); }
111 0 : void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL) { aBrowse->SetAttributes(pAttr,p2ndSet); }
112 0 : _SdrItemBrowserControl *GetBrowserControl() { return aBrowse.get(); }
113 : };
114 :
115 : class SdrView;
116 :
117 0 : class SdrItemBrowser: public _SdrItemBrowserWindow {
118 : Idle aIdle;
119 : SdrView* pView;
120 : bool bDirty;
121 : private:
122 : static vcl::Window* ImpGetViewWin(SdrView& rView);
123 : DECL_LINK_TYPED(IdleHdl, Idle *, void);
124 : DECL_LINK(ChangedHdl,_SdrItemBrowserControl*);
125 : DECL_LINK(SetDirtyHdl, void *);
126 : public:
127 : SdrItemBrowser(SdrView& rView);
128 : void ForceParent();
129 : void SetView(SdrView& rView) { pView=&rView; ForceParent(); SetDirty(); }
130 : void SetDirty();
131 : void Undirty();
132 : void ForceUndirty() { if (bDirty) Undirty(); }
133 : };
134 :
135 : #endif // INCLUDED_SVX_INC_SVDIBROW_HXX
136 :
137 :
138 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|