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 #pragma once
21 
22 #include <rtl/ustring.hxx>
23 #include <svtools/svtdllapi.h>
24 #include <unotools/ucbhelper.hxx>
25 #include <vcl/vclenum.hxx>
26 
27 enum class SvImageId {
28     NONE                   =    0,
29     START                  = 3076,  // must match to old Id's in SFX!
30 
31     Impress                = START + 47,
32     Bitmap                 = START + 49,
33     Calc                   = START + 50,
34     CalcTemplate           = START + 51,
35     Database               = START + 53,
36     ImpressTemplate        = START + 54,
37     GIF                    = START + 61,
38     HTML                   = START + 63,
39     JPG                    = START + 64,
40     Math                   = START + 68,
41     MathTemplate           = START + 69,
42     File                   = START + 74,
43     PCD                    = START + 76,
44     PCT                    = START + 77,
45     PCX                    = START + 78,
46     SIM                    = START + 79,
47     TextFile               = START + 80,
48     TIFF                   = START + 82,
49     WMF                    = START + 84,
50     Writer                 = START + 86,
51     WriterTemplate         = START + 87,
52     FixedDevice            = START + 88,
53     RemoveableDevice       = START + 89,
54     CDRomDevice            = START + 90,
55     NetworkDevice          = START + 91,
56     Table                  = START + 112,
57     Folder                 = START + 113,
58     DXF                    = START + 141,
59     MET                    = START + 142,
60     PNG                    = START + 143,
61     //retired SGF          = START + 144,
62     //retired SGV          = START + 145,
63     SVM                    = START + 146,
64     GlobalDoc              = START + 150,
65     Draw                   = START + 151,
66     DrawTemplate           = START + 152,
67     OO_DatabaseDoc         = START + 169,
68     OO_DrawDoc             = START + 170,
69     OO_MathDoc             = START + 171,
70     OO_GlobalDoc           = START + 172,
71     OO_ImpressDoc          = START + 173,
72     OO_CalcDoc             = START + 174,
73     OO_WriterDoc           = START + 175,
74     OO_DrawTemplate        = START + 176,
75     OO_ImpressTemplate     = START + 177,
76     OO_CalcTemplate        = START + 178,
77     OO_WriterTemplate      = START + 179,
78     Extension              = START + 180,
79 };
80 
81 
82 class Image;
83 class INetURLObject;
84 
85 namespace svtools {
86 
87 struct VolumeInfo
88 {
89     bool    m_bIsVolume;
90     bool    m_bIsRemote;
91     bool    m_bIsRemoveable;
92     bool    m_bIsFloppy;
93     bool    m_bIsCompactDisc;
94 
VolumeInfosvtools::VolumeInfo95     VolumeInfo() :
96         m_bIsVolume     ( false ),
97         m_bIsRemote     ( false ),
98         m_bIsRemoveable ( false ),
99         m_bIsFloppy     ( false ),
100         m_bIsCompactDisc( false ) {}
101 
VolumeInfosvtools::VolumeInfo102     VolumeInfo( bool _bIsVolume,
103                 bool _bIsRemote,
104                 bool _bIsRemoveable,
105                 bool _bIsFloppy,
106                 bool _bIsCompactDisc ) :
107         m_bIsVolume     ( _bIsVolume ),
108         m_bIsRemote     ( _bIsRemote ),
109         m_bIsRemoveable ( _bIsRemoveable ),
110         m_bIsFloppy     ( _bIsFloppy ),
111         m_bIsCompactDisc( _bIsCompactDisc ) {}
112 };
113 
114 }
115 
116 class SvFileInformationManager
117 {
118 private:
119     static OUString    GetDescription_Impl( const INetURLObject& rObject, bool bDetectFolder );
120 
121 public:
122     SVT_DLLPUBLIC static OUString GetImageId( const INetURLObject& rURL, bool bBig = false );
123     SVT_DLLPUBLIC static Image  GetImage(
124         const INetURLObject& rURL, bool bBig = false,
125         css::uno::Reference<css::ucb::XCommandEnvironment> const & env
126             = utl::UCBContentHelper::getDefaultCommandEnvironment());
127     SVT_DLLPUBLIC static OUString GetFileImageId( const INetURLObject& rURL );
128     SVT_DLLPUBLIC static Image  GetImageNoDefault(const INetURLObject& rURL, vcl::ImageType eImageType = vcl::ImageType::Small);
129     SVT_DLLPUBLIC static OUString GetFolderImageId( const svtools::VolumeInfo& rInfo );
130 
131     SVT_DLLPUBLIC static OUString GetDescription( const INetURLObject& rObject );
132     SVT_DLLPUBLIC static OUString GetFileDescription( const INetURLObject& rObject );
133     SVT_DLLPUBLIC static OUString GetFolderDescription( const svtools::VolumeInfo& rInfo );
134 };
135 
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
137