Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / dbaccess / source / ui / inc / imageprovider.hxx
blob5249fb0091fe9dfa9f688976b8ef12e0008a0244
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 .
20 #pragma once
22 #include <com/sun/star/graphic/XGraphic.hpp>
23 #include <com/sun/star/sdbc/XConnection.hpp>
25 namespace com::sun::star::sdb::application { class XTableUIProvider; }
27 namespace dbaui
29 /** provides images for database objects such as tables, queries, forms, reports ...
31 At the moment, this class cares for small icons only, that is, icons which can be used
32 in a tree control. On the medium term, we should extend it with support for different-sized
33 icons.
35 class ImageProvider
37 public:
38 /** creates a semi-functional ImageProvider instance
40 The resulting instance is not able to provide any concrete object images,
41 but only default images.
43 ImageProvider();
45 /** creates an ImageProvider instance
47 @param _rxConnection
48 denotes the connection to work for. Must not be <NULL/>.
50 ImageProvider(
51 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
54 /** returns the image to be used for a database object with the given name
56 @param _nDatabaseObjectType
57 the type of the object. Must be one of the css.sdb.application.DatabaseObject
58 constants.
59 @param _rName
60 the name of the object
61 @return
62 the name of the image to be used for the object.
64 OUString getImageId(
65 const OUString& _rName,
66 const sal_Int32 _nDatabaseObjectType
69 // check whether the connection can give us an icon
70 css::uno::Reference<css::graphic::XGraphic> getXGraphic(const OUString& _rName,
71 const sal_Int32 _nDatabaseObjectType);
73 /** returns the resource ID for the default image to be used for a database object
75 In opposite to getImageId, this method does not check the concrete object
76 for its image, but returns a default image to be used for all objects of the given
77 type.
79 @param _nDatabaseObjectType
80 the type of the object. Must be one of the css.sdb.application.DatabaseObject
81 constants.
82 @return
83 the resource image name to be used for the object type.
85 static OUString getDefaultImageResourceID(sal_Int32 _nDatabaseObjectType);
87 static OUString getFolderImageId(
88 sal_Int32 _nDatabaseObjectType
91 /** retrieves the image to be used for a database as a whole.
92 @return
93 the image to be used for folders of this type
95 static const OUString & getDatabaseImage();
96 private:
97 /// the connection we work with
98 css::uno::Reference< css::sdbc::XConnection > mxConnection;
99 /// the views of the connection, if the DB supports views
100 css::uno::Reference< css::container::XNameAccess > mxViews;
101 /// interface for providing table's UI
102 css::uno::Reference< css::sdb::application::XTableUIProvider > mxTableUI;
105 } // namespace dbaui
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */