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 namespace weld { class Menu; }
31 
32 // FmGridHeader
33 
34 struct FmGridHeaderData;
37  ,public DropTargetHelper
38 {
39 protected:
40  std::unique_ptr<FmGridHeaderData> m_pImpl;
41 
42 public:
43  FmGridHeader( BrowseBox* pParent, WinBits nWinBits = WB_STDHEADERBAR | WB_DRAG );
44  virtual ~FmGridHeader() override;
45  virtual void dispose() override;
46 
47 public:
48  // trigger context menu execution
49  void triggerColumnContextMenu( const ::Point& _rPreferredPos );
50 
51 protected:
52  virtual void Command( const CommandEvent& rCEvt ) override;
53  virtual void RequestHelp( const HelpEvent& rHEvt ) override;
54  virtual void Select() override;
55 
59  sal_uInt16 GetModelColumnPos(sal_uInt16 nId) const;
60 
68  virtual void PreExecuteColumnContextMenu(sal_uInt16 nColId, weld::Menu& rMenu,
69  weld::Menu& rInsertMenu, weld::Menu& rChangeMenu,
70  weld::Menu& rShowMenu);
73  virtual void PostExecuteColumnContextMenu(sal_uInt16 nColId, const weld::Menu& rMenu, const OString& rExecutionResult);
74 
75  // DropTargetHelper
76  virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
77  virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
78 
83  void notifyColumnSelect(sal_uInt16 nColumnId);
84 private:
85  DECL_LINK( OnAsyncExecuteDrop, void*, void );
86 };
87 
88 
89 // FmGridControl
90 
91 class FmXGridPeer;
93 
94 {
95  friend class FmGridHeader;
96  friend class FmXGridPeer;
97 
99  sal_Int32 m_nCurrentSelectedColumn; // this is the column model (not the view) position...
100  sal_uInt16 m_nMarkedColumnId;
102  bool m_bInColumnMove : 1;
103 
104 public:
106  const css::uno::Reference< css::uno::XComponentContext >&,
107  vcl::Window* pParent,
108  FmXGridPeer* _pPeer,
109  WinBits nBits);
110 
111  // Window
112  virtual void KeyInput( const KeyEvent& rKEvt ) override;
113 
114  // css::beans::XPropertyChangeListener
115  void propertyChange(const css::beans::PropertyChangeEvent& evt);
116 
117  // css::form::XPositioningListener
118  void positioned();
119 
120  // XBound
121  bool commit();
122 
123  // css::form::XInsertListener
124  void inserted();
125 
126  void markColumn(sal_uInt16 nId);
127  bool isColumnMarked(sal_uInt16 nId) const;
128 
129  sal_Int32 GetSelectedColumn() const { return m_nCurrentSelectedColumn;}
130 
139  virtual OUString GetAccessibleObjectName( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
140 
149  virtual OUString GetAccessibleObjectDescription( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
150 
151 protected:
152  virtual void Command(const CommandEvent& rEvt) override;
153 
154  virtual VclPtr<BrowserHeader> imp_CreateHeaderBar(BrowseBox* pParent) override;
155  virtual tools::Long QueryMinimumRowHeight() override;
156  virtual void RowHeightChanged() override;
157  virtual void ColumnResized(sal_uInt16 nId) override;
158  virtual void ColumnMoved(sal_uInt16 nId) override;
159  virtual void DeleteSelectedRows() override;
160  virtual void SetDesignMode(bool bMode) override;
161  virtual void CellModified() override;
162  virtual void HideColumn(sal_uInt16 nId) override;
163  virtual void ShowColumn(sal_uInt16 nId) override;
164 
165  bool IsInColumnMove() const {return m_bInColumnMove;}
166 
167  virtual void BeginCursorAction() override;
168  virtual void EndCursorAction() override;
169  virtual void Select() override;
170 
171  // Initialize columns
172  // a.) only by column description
173  void InitColumnsByModels(const css::uno::Reference< css::container::XIndexContainer >& xColumns);
174  // b.) during alivemode by database fields
175  virtual void InitColumnsByFields(const css::uno::Reference< css::container::XIndexAccess >& xFields) override;
176 
177  // some kind of impl version (for one single column) of our version of InitColumnsByFields
178  static void InitColumnByField(
179  DbGridColumn* _pColumn,
180  const css::uno::Reference< css::beans::XPropertySet >& _rxColumnModel,
181  const css::uno::Reference< css::container::XNameAccess >& _rxFieldsByNames,
182  const css::uno::Reference< css::container::XIndexAccess >& _rxFieldsByIndex
183  );
184 
185  FmXGridPeer* GetPeer() const {return m_pPeer;}
186 
187  css::uno::Sequence< css::uno::Any>
188  getSelectionBookmarks();
189  bool selectBookmarks(const css::uno::Sequence< css::uno::Any>& _rBookmarks);
190 
197  bool isColumnSelected(DbGridColumn const * _pColumn);
198 };
199 
200 #endif // INCLUDED_SVX_FMGRIDCL_HXX
201 
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void dispose() override
sal_Int32 GetSelectedColumn() const
Definition: fmgridcl.hxx:129
bool m_bSelecting
Definition: fmgridcl.hxx:101
signed char sal_Int8
long Long
sal_Int32 m_nCurrentSelectedColumn
Definition: fmgridcl.hxx:99
std::unique_ptr< FmGridHeaderData > m_pImpl
Definition: fmgridcl.hxx:40
FmXGridPeer * GetPeer() const
Definition: fmgridcl.hxx:185
virtual VclPtr< BrowserHeader > imp_CreateHeaderBar(BrowseBox *pParent)
bool IsInColumnMove() const
Definition: fmgridcl.hxx:165
virtual void Command(const CommandEvent &rEvt) override
Definition: gridctrl.cxx:2541
sal_Int64 WinBits
virtual void BeginCursorAction()
Definition: gridctrl.cxx:3206
virtual void DeleteSelectedRows()
Definition: gridctrl.cxx:2602
virtual void ColumnMoved(sal_uInt16 nId) override
Definition: gridctrl.cxx:1441
virtual void SetDesignMode(bool bMode)
Definition: gridctrl.cxx:2316
virtual OUString GetAccessibleObjectName(AccessibleBrowseBoxObjType eObjType, sal_Int32 _nPosition=-1) const override
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &evt) override
Definition: fmgridif.cxx:1324
virtual void Select() override
Definition: gridctrl.cxx:831
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt)
class SAL_NO_VTABLE XPropertySet
Definition: xmlexchg.hxx:28
FmXGridPeer * m_pPeer
Definition: fmgridcl.hxx:98
DECL_LISTENERMULTIPLEXER_END void SAL_CALL inserted(::sal_Int32 ID) override
virtual void ShowColumn(sal_uInt16 nId)
show a column
Definition: gridctrl.cxx:3062
virtual void CellModified() override
Definition: gridctrl.cxx:2642
virtual void EndCursorAction()
Definition: gridctrl.cxx:3223
sal_uInt16 m_nMarkedColumnId
Definition: fmgridcl.hxx:100
virtual OUString GetAccessibleObjectDescription(AccessibleBrowseBoxObjType eObjType, sal_Int32 _nPosition=-1) const override
#define SAL_WARN_UNUSED
virtual void ColumnResized(sal_uInt16 nColId) override
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
virtual sal_Bool SAL_CALL commit() override
Definition: fmgridif.cxx:1448
AccessibleBrowseBoxObjType
virtual void HideColumn(sal_uInt16 nId)
hide a column
Definition: gridctrl.cxx:3033
virtual void KeyInput(const KeyEvent &rEvt) override
Definition: gridctrl.cxx:3016
virtual tools::Long QueryMinimumRowHeight()
virtual void Command(const CommandEvent &rCEvt) override
virtual void InitColumnsByFields(const css::uno::Reference< css::container::XIndexAccess > &xFields)=0
virtual void RowHeightChanged() override