Bump version to 6.4-15
[LibreOffice.git] / include / svx / fmgridcl.hxx
blob82c98efe28c0eebaffb0f395ec8269da0b183dc3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVX_FMGRIDCL_HXX
20 #define INCLUDED_SVX_FMGRIDCL_HXX
22 #include <svx/gridctrl.hxx>
23 #include <vcl/transfer.hxx>
24 #include <svx/svxdllapi.h>
25 #include <memory>
27 namespace com::sun::star::beans { class XPropertySet; }
28 namespace com::sun::star::container { class XIndexContainer; }
29 namespace com::sun::star::container { class XNameAccess; }
31 // FmGridHeader
33 struct FmGridHeaderData;
34 class SAL_WARN_UNUSED SVX_DLLPUBLIC FmGridHeader
35 :public ::svt::EditBrowserHeader
36 ,public DropTargetHelper
38 protected:
39 std::unique_ptr<FmGridHeaderData> m_pImpl;
41 public:
42 FmGridHeader( BrowseBox* pParent, WinBits nWinBits = WB_STDHEADERBAR | WB_DRAG );
43 virtual ~FmGridHeader() override;
44 virtual void dispose() override;
46 public:
47 // trigger context menu execution
48 void triggerColumnContextMenu( const ::Point& _rPreferredPos );
50 protected:
51 virtual void Command( const CommandEvent& rCEvt ) override;
52 virtual void RequestHelp( const HelpEvent& rHEvt ) override;
53 virtual void Select() override;
55 /** the value returned by GetItemPos is meaningless for the grid model if there are hidden columns,
56 so use GetModelColumnPos instead
58 sal_uInt16 GetModelColumnPos(sal_uInt16 nId) const;
60 /** This is called before executing a context menu for a column. rMenu contains the initial entries
61 handled by this base class' method (which always has to be called).
62 Derived classes may alter the menu in any way and handle any additional entries in
63 PostExecuteColumnContextMenu.
64 All disabled entries will be removed before executing the menu, so be careful with separators
65 near entries you probably wish to disable ...
67 virtual void PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMenu);
68 /** After executing the context menu for a column this method is called.
70 virtual void PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMenu& rMenu, sal_uInt16 nExecutionResult);
72 // DropTargetHelper
73 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
74 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
76 /** selects the column at the selection supplier.
77 @param nColumnId
78 The column id.
80 void notifyColumnSelect(sal_uInt16 nColumnId);
81 private:
82 DECL_LINK( OnAsyncExecuteDrop, void*, void );
86 // FmGridControl
88 class FmXGridPeer;
89 class SAL_WARN_UNUSED SVX_DLLPUBLIC FmGridControl : public DbGridControl
92 friend class FmGridHeader;
93 friend class FmXGridPeer;
95 FmXGridPeer* m_pPeer;
96 sal_Int32 m_nCurrentSelectedColumn; // this is the column model (not the view) position...
97 sal_uInt16 m_nMarkedColumnId;
98 bool m_bSelecting;
99 bool m_bInColumnMove : 1;
101 public:
102 FmGridControl(
103 const css::uno::Reference< css::uno::XComponentContext >&,
104 vcl::Window* pParent,
105 FmXGridPeer* _pPeer,
106 WinBits nBits);
108 // Window
109 virtual void KeyInput( const KeyEvent& rKEvt ) override;
111 // css::beans::XPropertyChangeListener
112 void propertyChange(const css::beans::PropertyChangeEvent& evt);
114 // css::form::XPositioningListener
115 void positioned();
117 // XBound
118 bool commit();
120 // css::form::XInsertListener
121 void inserted();
123 void markColumn(sal_uInt16 nId);
124 bool isColumnMarked(sal_uInt16 nId) const;
126 sal_Int32 GetSelectedColumn() const { return m_nCurrentSelectedColumn;}
128 /** return the name of the specified object.
129 @param eObjType
130 The type to ask for
131 @param _nPosition
132 The position of a tablecell (index position), header bar column/row cell
133 @return
134 The name of the specified object.
136 virtual OUString GetAccessibleObjectName( ::vcl::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
138 /** return the description of the specified object.
139 @param eObjType
140 The type to ask for
141 @param _nPosition
142 The position of a tablecell (index position), header bar column/row cell
143 @return
144 The description of the specified object.
146 virtual OUString GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
148 protected:
149 virtual void Command(const CommandEvent& rEvt) override;
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;
162 bool IsInColumnMove() const {return m_bInColumnMove;}
164 virtual void BeginCursorAction() override;
165 virtual void EndCursorAction() override;
166 virtual void Select() override;
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;
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
182 FmXGridPeer* GetPeer() const {return m_pPeer;}
184 css::uno::Sequence< css::uno::Any>
185 getSelectionBookmarks();
186 bool selectBookmarks(const css::uno::Sequence< css::uno::Any>& _rBookmarks);
188 /** returns if a column is selected
189 @param _pColumn
190 The column to compare with.
191 @return
192 <TRUE/> if the column is selected, otherwise <FALSE/>
194 bool isColumnSelected(DbGridColumn const * _pColumn);
197 #endif // INCLUDED_SVX_FMGRIDCL_HXX
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */