LibreOffice Module svx (master)  1
fmgridcl.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_SVX_FMGRIDCL_HXX
20 #define INCLUDED_SVX_FMGRIDCL_HXX
21 
22 #include <svx/gridctrl.hxx>
23 #include <vcl/transfer.hxx>
24 #include <svx/svxdllapi.h>
25 #include <memory>
26 
27 namespace com::sun::star::beans { class XPropertySet; }
28 namespace com::sun::star::container { class XIndexContainer; }
29 namespace com::sun::star::container { class XNameAccess; }
30 
31 // FmGridHeader
32 
33 struct FmGridHeaderData;
36  ,public DropTargetHelper
37 {
38 protected:
39  std::unique_ptr<FmGridHeaderData> m_pImpl;
40 
41 public:
42  FmGridHeader( BrowseBox* pParent, WinBits nWinBits = WB_STDHEADERBAR | WB_DRAG );
43  virtual ~FmGridHeader() override;
44  virtual void dispose() override;
45 
46 public:
47  // trigger context menu execution
48  void triggerColumnContextMenu( const ::Point& _rPreferredPos );
49 
50 protected:
51  virtual void Command( const CommandEvent& rCEvt ) override;
52  virtual void RequestHelp( const HelpEvent& rHEvt ) override;
53  virtual void Select() override;
54 
58  sal_uInt16 GetModelColumnPos(sal_uInt16 nId) const;
59 
67  virtual void PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMenu);
70  virtual void PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMenu& rMenu, sal_uInt16 nExecutionResult);
71 
72  // DropTargetHelper
73  virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
74  virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
75 
80  void notifyColumnSelect(sal_uInt16 nColumnId);
81 private:
82  DECL_LINK( OnAsyncExecuteDrop, void*, void );
83 };
84 
85 
86 // FmGridControl
87 
88 class FmXGridPeer;
90 
91 {
92  friend class FmGridHeader;
93  friend class FmXGridPeer;
94 
96  sal_Int32 m_nCurrentSelectedColumn; // this is the column model (not the view) position...
97  sal_uInt16 m_nMarkedColumnId;
99  bool m_bInColumnMove : 1;
100 
101 public:
103  const css::uno::Reference< css::uno::XComponentContext >&,
104  vcl::Window* pParent,
105  FmXGridPeer* _pPeer,
106  WinBits nBits);
107 
108  // Window
109  virtual void KeyInput( const KeyEvent& rKEvt ) override;
110 
111  // css::beans::XPropertyChangeListener
112  void propertyChange(const css::beans::PropertyChangeEvent& evt);
113 
114  // css::form::XPositioningListener
115  void positioned();
116 
117  // XBound
118  bool commit();
119 
120  // css::form::XInsertListener
121  void inserted();
122 
123  void markColumn(sal_uInt16 nId);
124  bool isColumnMarked(sal_uInt16 nId) const;
125 
126  sal_Int32 GetSelectedColumn() const { return m_nCurrentSelectedColumn;}
127 
136  virtual OUString GetAccessibleObjectName( ::vcl::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
137 
146  virtual OUString GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
147 
148 protected:
149  virtual void Command(const CommandEvent& rEvt) override;
150 
151  virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) override;
152  virtual long QueryMinimumRowHeight() override;
153  virtual void RowHeightChanged() override;
154  virtual void ColumnResized(sal_uInt16 nId) override;
155  virtual void ColumnMoved(sal_uInt16 nId) override;
156  virtual void DeleteSelectedRows() override;
157  virtual void SetDesignMode(bool bMode) override;
158  virtual void CellModified() override;
159  virtual void HideColumn(sal_uInt16 nId) override;
160  virtual void ShowColumn(sal_uInt16 nId) override;
161 
162  bool IsInColumnMove() const {return m_bInColumnMove;}
163 
164  virtual void BeginCursorAction() override;
165  virtual void EndCursorAction() override;
166  virtual void Select() override;
167 
168  // Initialize columns
169  // a.) only by column description
170  void InitColumnsByModels(const css::uno::Reference< css::container::XIndexContainer >& xColumns);
171  // b.) during alivemode by database fields
172  virtual void InitColumnsByFields(const css::uno::Reference< css::container::XIndexAccess >& xFields) override;
173 
174  // some kind of impl version (for one single column) of our version of InitColumnsByFields
175  static void InitColumnByField(
176  DbGridColumn* _pColumn,
177  const css::uno::Reference< css::beans::XPropertySet >& _rxColumnModel,
178  const css::uno::Reference< css::container::XNameAccess >& _rxFieldsByNames,
179  const css::uno::Reference< css::container::XIndexAccess >& _rxFieldsByIndex
180  );
181 
182  FmXGridPeer* GetPeer() const {return m_pPeer;}
183 
184  css::uno::Sequence< css::uno::Any>
185  getSelectionBookmarks();
186  bool selectBookmarks(const css::uno::Sequence< css::uno::Any>& _rBookmarks);
187 
194  bool isColumnSelected(DbGridColumn const * _pColumn);
195 };
196 
197 #endif // INCLUDED_SVX_FMGRIDCL_HXX
198 
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void dispose() override
sal_Int32 GetSelectedColumn() const
Definition: fmgridcl.hxx:126
bool m_bSelecting
Definition: fmgridcl.hxx:98
signed char sal_Int8
sal_Int32 m_nCurrentSelectedColumn
Definition: fmgridcl.hxx:96
std::unique_ptr< FmGridHeaderData > m_pImpl
Definition: fmgridcl.hxx:39
FmXGridPeer * GetPeer() const
Definition: fmgridcl.hxx:182
virtual long QueryMinimumRowHeight()
virtual VclPtr< BrowserHeader > imp_CreateHeaderBar(BrowseBox *pParent)
bool IsInColumnMove() const
Definition: fmgridcl.hxx:162
virtual void Command(const CommandEvent &rEvt) override
Definition: gridctrl.cxx:2597
sal_Int64 WinBits
virtual void BeginCursorAction()
Definition: gridctrl.cxx:3260
virtual void DeleteSelectedRows()
Definition: gridctrl.cxx:2656
virtual void ColumnMoved(sal_uInt16 nId) override
Definition: gridctrl.cxx:1499
virtual void SetDesignMode(bool bMode)
Definition: gridctrl.cxx:2374
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
virtual OUString GetAccessibleObjectName(::vcl::AccessibleBrowseBoxObjType eObjType, sal_Int32 _nPosition=-1) const override
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &evt) override
Definition: fmgridif.cxx:1321
virtual void Select() override
Definition: gridctrl.cxx:889
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt)
class SAL_NO_VTABLE XPropertySet
Definition: xmlexchg.hxx:28
FmXGridPeer * m_pPeer
Definition: fmgridcl.hxx:95
DECL_LISTENERMULTIPLEXER_END void SAL_CALL inserted(::sal_Int32 ID) override
virtual void ShowColumn(sal_uInt16 nId)
show a column
Definition: gridctrl.cxx:3116
virtual void CellModified() override
Definition: gridctrl.cxx:2696
virtual void EndCursorAction()
Definition: gridctrl.cxx:3277
sal_uInt16 m_nMarkedColumnId
Definition: fmgridcl.hxx:97
#define SAL_WARN_UNUSED
virtual void ColumnResized(sal_uInt16 nColId) override
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
AccessibleBrowseBoxObjType
virtual OUString GetAccessibleObjectDescription(::vcl::AccessibleBrowseBoxObjType eObjType, sal_Int32 _nPosition=-1) const override
virtual sal_Bool SAL_CALL commit() override
Definition: fmgridif.cxx:1445
virtual void HideColumn(sal_uInt16 nId)
hide a column
Definition: gridctrl.cxx:3087
virtual void KeyInput(const KeyEvent &rEvt) override
Definition: gridctrl.cxx:3070
virtual void Command(const CommandEvent &rCEvt) override
virtual void InitColumnsByFields(const css::uno::Reference< css::container::XIndexAccess > &xFields)=0
virtual void RowHeightChanged() override