LibreOffice Module dbaccess (master) 1
dsEntriesNoExp.cxx
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
20#include <sal/config.h>
21
22#include <memory>
23
24#include <unodatbr.hxx>
25#include <browserids.hxx>
26#include <osl/diagnose.h>
27#include <dbtreelistbox.hxx>
28#include "dbtreemodel.hxx"
29
30using namespace ::com::sun::star::frame;
31using namespace ::dbtools;
32using namespace ::svx;
33
34namespace dbaui
35{
37{
38 OSL_ENSURE(isContainer(rEntry), "SbaTableQueryBrowser::getChildType: invalid entry!");
39 switch (getEntryType(rEntry))
40 {
42 return etTableOrView;
44 return etQuery;
45 default:
46 break;
47 }
48 return etUnknown;
49}
50
52{
53 return m_pTreeView->GetWidget().get_text(rEntry);
54}
55
57{
58 const weld::TreeView& rTreeView = m_pTreeView->GetWidget();
59 DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rEntry));
60 return pEntryData ? pEntryData->eType : etUnknown;
61}
62
63void SbaTableQueryBrowser::select(const weld::TreeIter* pEntry, bool bSelect)
64{
65 if (pEntry)
66 {
67 weld::TreeView& rTreeView = m_pTreeView->GetWidget();
68 rTreeView.set_text_emphasis(*pEntry, bSelect, 0);
69 }
70 else
71 {
72 OSL_FAIL("SbaTableQueryBrowser::select: invalid entry!");
73 }
74}
75
76void SbaTableQueryBrowser::selectPath(const weld::TreeIter* pEntry, bool bSelect)
77{
78 if (!pEntry)
79 return;
80 weld::TreeView& rTreeView = m_pTreeView->GetWidget();
81 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator(pEntry));
82 do
83 {
84 select(xEntry.get(), bSelect);
85 }
86 while (rTreeView.iter_parent(*xEntry));
87}
88
90{
91 weld::TreeView& rTreeView = m_pTreeView->GetWidget();
92 return rTreeView.get_text_emphasis(rEntry, 0);
93}
94
96{
97 if ( !m_bShowMenu )
98 {
99 InvalidateFeature(ID_BROWSER_INSERTCOLUMNS);
100 InvalidateFeature(ID_BROWSER_INSERTCONTENT);
101 InvalidateFeature(ID_BROWSER_FORMLETTER);
102 }
103 InvalidateFeature(ID_BROWSER_COPY);
104 InvalidateFeature(ID_BROWSER_CUT);
105}
106
108{
110
111 implDescribeSupportedFeature( ".uno:Title", ID_BROWSER_TITLE );
112 if ( !m_bShowMenu )
113 {
114 implDescribeSupportedFeature( ".uno:DSBEditDB", ID_TREE_EDIT_DATABASE );
115 implDescribeSupportedFeature( ".uno:DSBCloseConnection", ID_TREE_CLOSE_CONN );
116 implDescribeSupportedFeature( ".uno:DSBAdministrate", ID_TREE_ADMINISTRATE );
117
118 implDescribeSupportedFeature( ".uno:DSBrowserExplorer", ID_BROWSER_EXPLORER, CommandGroup::VIEW );
119
120 implDescribeSupportedFeature( ".uno:DSBFormLetter", ID_BROWSER_FORMLETTER, CommandGroup::DOCUMENT );
121 implDescribeSupportedFeature( ".uno:DSBInsertColumns", ID_BROWSER_INSERTCOLUMNS, CommandGroup::INSERT );
122 implDescribeSupportedFeature( ".uno:DSBInsertContent", ID_BROWSER_INSERTCONTENT, CommandGroup::INSERT );
123 implDescribeSupportedFeature( ".uno:DSBDocumentDataSource", ID_BROWSER_DOCUMENT_DATASOURCE, CommandGroup::VIEW );
124
125 implDescribeSupportedFeature( ".uno:DataSourceBrowser/FormLetter", ID_BROWSER_FORMLETTER );
126 implDescribeSupportedFeature( ".uno:DataSourceBrowser/InsertColumns", ID_BROWSER_INSERTCOLUMNS );
127 implDescribeSupportedFeature( ".uno:DataSourceBrowser/InsertContent", ID_BROWSER_INSERTCONTENT );
128 implDescribeSupportedFeature( ".uno:DataSourceBrowser/DocumentDataSource", ID_BROWSER_DOCUMENT_DATASOURCE );
129 }
130
131 implDescribeSupportedFeature( ".uno:CloseWin", ID_BROWSER_CLOSE, CommandGroup::DOCUMENT );
132 implDescribeSupportedFeature( ".uno:DBRebuildData", ID_BROWSER_REFRESH_REBUILD, CommandGroup::DATA );
133}
134
136{
137 switch ( _eType )
138 {
139 case etQuery:
140 case etQueryContainer:
142 case etTableOrView:
143 case etTableContainer:
145 default:
146 break;
147 }
148 OSL_FAIL( "SbaTableQueryBrowser::getDatabaseObjectType: folder types and 'Unknown' not allowed here!" );
150}
151
152} // namespace dbaui
153
154/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define ID_BROWSER_FORMLETTER
Definition: browserids.hxx:37
#define ID_TREE_ADMINISTRATE
Definition: browserids.hxx:62
#define ID_TREE_CLOSE_CONN
Definition: browserids.hxx:60
#define ID_BROWSER_INSERTCONTENT
Definition: browserids.hxx:38
#define ID_BROWSER_CLOSE
Definition: browserids.hxx:92
#define ID_BROWSER_EXPLORER
Definition: browserids.hxx:54
#define ID_BROWSER_DOCUMENT_DATASOURCE
Definition: browserids.hxx:55
#define ID_BROWSER_TITLE
Definition: browserids.hxx:34
#define ID_BROWSER_CUT
Definition: browserids.hxx:25
#define ID_BROWSER_REFRESH_REBUILD
Definition: browserids.hxx:75
#define ID_BROWSER_INSERTCOLUMNS
Definition: browserids.hxx:36
#define ID_BROWSER_COPY
Definition: browserids.hxx:24
#define ID_TREE_EDIT_DATABASE
Definition: browserids.hxx:59
EntryType getChildType(const weld::TreeIter &rEntry) const
void selectPath(const weld::TreeIter *pEntry, bool bSelect=true)
virtual sal_Bool SAL_CALL select(const css::uno::Any &aSelection) override
VclPtr< InterimDBTreeListBox > m_pTreeView
Definition: unodatbr.hxx:96
static sal_Int32 getDatabaseObjectType(EntryType _eType)
returns a DatabaseObject value corresponding to the given EntryType
virtual void describeSupportedFeatures() override
OUString GetEntryText(const weld::TreeIter &rEntry) const
static bool isContainer(EntryType _eType)
Definition: unodatbr.hxx:321
virtual void SelectionChanged() override
EntryType getEntryType(const weld::TreeIter &rEntry) const
bool isSelected(const weld::TreeIter &rEntry) const
virtual void describeSupportedFeatures() override
Definition: brwctrlr.cxx:668
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const=0
virtual bool get_text_emphasis(int row, int col) const=0
virtual void set_text_emphasis(int row, bool bOn, int col)=0
virtual bool iter_parent(TreeIter &rIter) const=0
virtual OUString get_id(int pos) const=0
SbaTableQueryBrowser::EntryType eType
Definition: dbtreemodel.hxx:46