LibreOffice Module dbaccess (master) 1
AppDetailView.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#pragma once
20
21#include <com/sun/star/container/XNameAccess.hpp>
22#include <com/sun/star/sdbc/XConnection.hpp>
23#include <com/sun/star/ucb/XContent.hpp>
24#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
25#include <vcl/mnemonic.hxx>
26#include <IClipBoardTest.hxx>
27#include "AppTitleWindow.hxx"
28#include <AppElementType.hxx>
29
30#include <vector>
31
32namespace dbaui
33{
34 class OAppBorderWindow;
35 class OApplicationDetailView;
36 class OAppDetailPageHelper;
37 class OTasksWindow;
38 class TreeListBox;
39
40 struct TaskEntry
41 {
42 OUString sUNOCommand;
44 OUString sTitle;
46 // TODO: we should be consistent in the task pane and the menus/toolbars:
47 // If an entry is disabled in the latter, it should also be disabled in the former.
48 // If an entry is *hidden* in the former, it should also be hidden in the latter.
49
50 TaskEntry( const char* _pAsciiUNOCommand, TranslateId pHelpID, TranslateId pTitleResourceID, bool _bHideWhenDisabled = false );
51 };
52 typedef std::vector< TaskEntry > TaskEntryList;
53
55 {
60 };
61
62 class OTasksWindow final : public OChildWindow
63 {
64 std::unique_ptr<weld::TreeView> m_xTreeView;
65 std::unique_ptr<weld::Label> m_xDescription;
66 std::unique_ptr<weld::TextView> m_xHelpText;
68
70
71 DECL_LINK(onSelected, weld::TreeView&, bool);
72 DECL_LINK(OnEntrySelectHdl, weld::TreeView&, void);
73 DECL_LINK(FocusInHdl, weld::Widget&, void);
74 DECL_LINK(FocusOutHdl, weld::Widget&, void);
75
76 void updateHelpText();
77
78 public:
81
82 virtual void GrabFocus() override;
83
84 virtual bool HasChildPathFocus() const override;
85
87
89 void fillTaskEntryList( const TaskEntryList& _rList );
90
91 void Clear();
92 void setHelpText(TranslateId pId);
93 };
94
96 {
97 std::unique_ptr<weld::Builder> m_xBuilder;
98 std::unique_ptr<weld::Container> m_xContainer;
99 std::unique_ptr<weld::Paned> m_xHorzSplitter;
100 std::unique_ptr<weld::Container> m_xTasksParent;
101 std::unique_ptr<weld::Container> m_xContainerParent;
102 std::unique_ptr<OTitleWindow> m_xTasks;
103 std::unique_ptr<OTitleWindow> m_xTitleContainer;
105 std::shared_ptr<OChildWindow> m_xControlHelper;
106 std::vector< TaskPaneData > m_aTaskPaneData;
108
111
112 public:
113 OApplicationDetailView(weld::Container* pParent, OAppBorderWindow& rBorder, PreviewMode ePreviewMode);
115
120 void createTablesPage(const css::uno::Reference< css::sdbc::XConnection>& _xConnection);
121
128 void createPage(ElementType _eType,const css::uno::Reference< css::container::XNameAccess >& _xContainer);
129
130 void setTaskExternalMnemonics( MnemonicGenerator const & _rMnemonics );
131
133 OTasksWindow& getTasksWindow() const { return *static_cast< OTasksWindow* >( m_xTasks->getChildWindow() ); }
134
135 bool isCutAllowed() override ;
136 bool isCopyAllowed() override ;
137 bool isPasteAllowed() override;
138 void copy() override;
139 void cut() override;
140 void paste() override;
141
149 OUString getQualifiedName(const weld::TreeIter* _pEntry) const;
150
159 static bool isLeaf(const weld::TreeView& rTreeView, const weld::TreeIter& rEntry);
160
165 bool isALeafSelected() const;
166
169 void selectAll();
170
172 bool isSortUp() const;
173
175 void sortDown();
176
178 void sortUp();
179
181 bool isFilled() const;
182
185
190 void clearPages(bool _bTaskAlso = true);
191
193 sal_Int32 getElementCount() const;
194
196 sal_Int32 getSelectionCount();
197
202 void getSelectionElementNames(std::vector< OUString>& _rNames ) const;
203
207 const weld::TreeView& rControl,
208 css::uno::Sequence< css::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
209 );
210
214 const ElementType _eType,
215 css::uno::Sequence< css::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
216 );
217
220 vcl::Window* getMenuParent() const;
221 void adjustMenuPosition(const weld::TreeView& rControl, ::Point& rPos) const;
222
227 void selectElements(const css::uno::Sequence< OUString>& _aNames);
228
239 std::unique_ptr<weld::TreeIter> elementAdded(ElementType eType,
240 const OUString& rName,
241 const css::uno::Any& rObject);
242
256 ,const OUString& _rOldName
257 ,const OUString& _rNewName );
258
267 void elementRemoved(ElementType _eType
268 ,const OUString& _rName );
269
272
274 bool isPreviewEnabled() const;
275
280 void switchPreview(PreviewMode _eMode);
281
286 void showPreview(const css::uno::Reference< css::ucb::XContent >& _xContent);
287
297 void showPreview( const OUString& _sDataSourceName,
298 const OUString& _sName,
299 bool _bTable);
300
301 std::unique_ptr<weld::TreeIter> getEntry(const Point& rPosPixel) const;
302
303 TreeListBox* getTreeWindow() const;
304
305 bool HasChildPathFocus() const;
306 private:
307 void impl_createPage(
308 ElementType _eType,
309 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
310 const css::uno::Reference< css::container::XNameAccess >& _rxNonTableElements
311 );
312
314 void impl_fillTaskPaneData( ElementType _eType, TaskPaneData& _rData ) const;
315 };
316}
317
318/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 getElementCount() const
returns the count of entries
std::unique_ptr< weld::TreeIter > getEntry(const Point &rPosPixel) const
void impl_createPage(ElementType _eType, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, const css::uno::Reference< css::container::XNameAccess > &_rxNonTableElements)
void createPage(ElementType _eType, const css::uno::Reference< css::container::XNameAccess > &_xContainer)
creates the page for the specific type.
void impl_fillTaskPaneData(ElementType _eType, TaskPaneData &_rData) const
std::vector< TaskPaneData > m_aTaskPaneData
std::shared_ptr< OChildWindow > m_xControlHelper
void createTablesPage(const css::uno::Reference< css::sdbc::XConnection > &_xConnection)
creates the tables page
std::unique_ptr< weld::Container > m_xTasksParent
static bool isLeaf(const weld::TreeView &rTreeView, const weld::TreeIter &rEntry)
returns if an entry is a leaf
void selectAll()
select all entries in the detail page
OUString getQualifiedName(const weld::TreeIter *_pEntry) const
return the qualified name.
sal_Int32 getSelectionCount()
returns the count of selected entries
std::unique_ptr< weld::Container > m_xContainer
const OAppDetailPageHelper * GetControlHelper() const
void setTaskExternalMnemonics(MnemonicGenerator const &_rMnemonics)
void elementRemoved(ElementType _eType, const OUString &_rName)
removes an element from the detail page.
void sortUp()
sort the entries in the detail page up
PreviewMode getPreviewMode() const
returns the preview mode
std::unique_ptr< weld::Paned > m_xHorzSplitter
const TaskPaneData & impl_getTaskPaneData(ElementType _eType)
OTasksWindow & getTasksWindow() const
ElementType getElementType() const
return the element of currently select entry
std::unique_ptr< weld::TreeIter > elementAdded(ElementType eType, const OUString &rName, const css::uno::Any &rObject)
adds a new object to the detail page.
vcl::Window * getMenuParent() const
get the menu parent window for the given control
void selectElements(const css::uno::Sequence< OUString > &_aNames)
select all names on the currently selected container.
void describeCurrentSelectionForControl(const weld::TreeView &rControl, css::uno::Sequence< css::sdb::application::NamedDatabaseObject > &_out_rSelectedObjects)
describes the current selection for the given control
bool isALeafSelected() const
returns if one of the selected entries is a leaf
bool isPreviewEnabled() const
<TRUE> if the preview is enabled
OAppBorderWindow & getBorderWin() const
bool isFilled() const
returns <TRUE> when a detail page was filled
MnemonicGenerator m_aExternalMnemonics
void clearPages(bool _bTaskAlso=true)
clears the detail pages.
void showPreview(const css::uno::Reference< css::ucb::XContent > &_xContent)
shows the Preview of the content when it is enabled.
OAppBorderWindow & m_rBorderWin
void describeCurrentSelectionForType(const ElementType _eType, css::uno::Sequence< css::sdb::application::NamedDatabaseObject > &_out_rSelectedObjects)
describes the current selection for the given ElementType
void elementReplaced(ElementType eType, const OUString &_rOldName, const OUString &_rNewName)
replaces an objects name with a new one
bool isSortUp() const
returns <TRUE> if it sorts ascending
std::unique_ptr< OTitleWindow > m_xTasks
void sortDown()
sort the entries in the detail page down
std::unique_ptr< weld::Builder > m_xBuilder
std::unique_ptr< OTitleWindow > m_xTitleContainer
std::unique_ptr< weld::Container > m_xContainerParent
void switchPreview(PreviewMode _eMode)
switches to the given preview mode
OApplicationDetailView(weld::Container *pParent, OAppBorderWindow &rBorder, PreviewMode ePreviewMode)
void adjustMenuPosition(const weld::TreeView &rControl, ::Point &rPos) const
TreeListBox * getTreeWindow() const
void getSelectionElementNames(std::vector< OUString > &_rNames) const
returns the element names which are selected
DECL_LINK(onSelected, weld::TreeView &, bool)
void setHelpText(TranslateId pId)
DECL_LINK(FocusInHdl, weld::Widget &, void)
OTasksWindow(weld::Container *pParent, OApplicationDetailView *pDetailView)
DECL_LINK(OnEntrySelectHdl, weld::TreeView &, void)
virtual void GrabFocus() override
void fillTaskEntryList(const TaskEntryList &_rList)
fills the Creation listbox with the necessary strings and images
OApplicationDetailView * getDetailView() const
std::unique_ptr< weld::Label > m_xDescription
virtual bool HasChildPathFocus() const override
OApplicationDetailView * m_pDetailView
std::unique_ptr< weld::TextView > m_xHelpText
std::unique_ptr< weld::TreeView > m_xTreeView
DECL_LINK(FocusOutHdl, weld::Widget &, void)
OUString eType
Definition: generalpage.cxx:78
std::vector< TaskEntry > TaskEntryList
TranslateId pHelpID
TaskEntry(const char *_pAsciiUNOCommand, TranslateId pHelpID, TranslateId pTitleResourceID, bool _bHideWhenDisabled=false)
TaskEntryList aTasks
the tasks available in the pane
TranslateId pTitleId
the resource ID for the title of the pane