1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _DXCANVAS_DXCONFIG_HXX
29 #define _DXCANVAS_DXCONFIG_HXX
30 
31 #include <unotools/configitem.hxx>
32 #include <boost/optional.hpp>
33 #include <set>
34 
35 namespace basegfx { class B2IVector; }
36 
37 namespace dxcanvas
38 {
39     /** Provide DX canvas config data
40      */
41     class DXCanvasItem : public ::utl::ConfigItem
42     {
43     public:
44         DXCanvasItem();
45 
46         struct DeviceInfo
47         {
48             sal_Int32 nVendorId;
49             sal_Int32 nDeviceId;
50             sal_Int32 nDeviceSubSysId;
51             sal_Int32 nDeviceRevision;
52 
53             sal_Int32 nDriverId;
54             sal_Int32 nDriverVersion;
55             sal_Int32 nDriverSubVersion;
56             sal_Int32 nDriverBuildId;
57 
58             bool operator<( const DeviceInfo& rRHS ) const
59             {
60                 return nVendorId != rRHS.nVendorId ? nVendorId < rRHS.nVendorId :
61                     (nDeviceId != rRHS.nDeviceId ? nDeviceId < rRHS.nDeviceId :
62                      (nDeviceSubSysId != rRHS.nDeviceSubSysId ? nDeviceSubSysId < rRHS.nDeviceSubSysId :
63                       (nDeviceRevision != rRHS.nDeviceRevision ? nDeviceRevision < rRHS.nDeviceRevision :
64                        (nDriverId != rRHS.nDriverId ? nDriverId < rRHS.nDriverId :
65                         (nDriverVersion != rRHS.nDriverVersion ? nDriverVersion < rRHS.nDriverVersion :
66                          (nDriverSubVersion != rRHS.nDriverSubVersion ? nDriverSubVersion < rRHS.nDriverSubVersion :
67                           (nDriverBuildId != rRHS.nDriverBuildId ? nDriverBuildId < rRHS.nDriverBuildId : false)))))));
68             }
69         };
70 
71         ~DXCanvasItem();
72 
73         bool isDeviceUsable( const DeviceInfo& rDeviceInfo ) const;
74         bool isBlacklistCurrentDevice() const;
75         void blacklistDevice( const DeviceInfo& rDeviceInfo );
76         void adaptMaxTextureSize( basegfx::B2IVector& io_maxTextureSize ) const;
77             virtual void            Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
78             virtual void            Commit();
79 
80     private:
81         typedef std::set< DeviceInfo > ValueSet;
82         ValueSet                   maValues;
83         boost::optional<sal_Int32> maMaxTextureSize;
84         bool                       mbBlacklistCurrentDevice;
85         bool                       mbValuesDirty;
86     };
87 }
88 
89 #endif /* #ifndef _DXCANVAS_DXCONFIG_HXX */
90