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