bump product version to 4.1.6.2
[LibreOffice.git] / shell / inc / internal / thumbviewer.hxx
bloba9f467efb86ce42149388851442b443be84c61fa
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 #ifndef THUMBVIEWER_HXX_INCLUDED
21 #define THUMBVIEWER_HXX_INCLUDED
23 #if defined _MSC_VER
24 #pragma warning(push, 1)
25 #pragma warning(disable:4917)
26 #endif
27 #include <objidl.h>
28 #include <shlobj.h>
29 #ifdef __MINGW32__
30 #include <algorithm>
31 using std::min;
32 using std::max;
33 #endif
34 #ifndef DONT_HAVE_GDIPLUS
35 #include <gdiplus.h>
36 #endif
37 #if defined _MSC_VER
38 #pragma warning(pop)
39 #endif
40 #include <string>
42 class CThumbviewer : public IPersistFile, public IExtractImage
44 public:
45 CThumbviewer(long RefCnt = 1);
46 virtual ~CThumbviewer();
48 //-----------------------------
49 // IUnknown methods
50 //-----------------------------
52 virtual HRESULT STDMETHODCALLTYPE QueryInterface(
53 REFIID riid,
54 void __RPC_FAR *__RPC_FAR *ppvObject);
56 virtual ULONG STDMETHODCALLTYPE AddRef( void);
58 virtual ULONG STDMETHODCALLTYPE Release( void);
60 //----------------------------
61 // IExtractImage methods
62 //----------------------------
64 virtual HRESULT STDMETHODCALLTYPE Extract(HBITMAP *phBmpImage);
66 virtual HRESULT STDMETHODCALLTYPE GetLocation(
67 LPWSTR pszPathBuffer,
68 DWORD cchMax,
69 DWORD *pdwPriority,
70 const SIZE *prgSize,
71 DWORD dwRecClrDepth,
72 DWORD *pdwFlags);
74 //----------------------------
75 // IPersist methods
76 //----------------------------
78 virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID* pClassID);
80 //----------------------------
81 // IPersistFile methods
82 //----------------------------
84 virtual HRESULT STDMETHODCALLTYPE IsDirty();
86 virtual HRESULT STDMETHODCALLTYPE Load(
87 /* [in] */ LPCOLESTR pszFileName,
88 /* [in] */ DWORD dwMode);
90 virtual HRESULT STDMETHODCALLTYPE Save(
91 /* [unique][in] */ LPCOLESTR pszFileName,
92 /* [in] */ BOOL fRemember);
94 virtual HRESULT STDMETHODCALLTYPE SaveCompleted(
95 /* [unique][in] */ LPCOLESTR pszFileName);
97 virtual HRESULT STDMETHODCALLTYPE GetCurFile(
98 /* [out] */ LPOLESTR __RPC_FAR *ppszFileName);
100 private:
101 Gdiplus::Rect CalcScaledAspectRatio(Gdiplus::Rect src, Gdiplus::Rect dest);
103 private:
104 long ref_count_;
105 std::wstring filename_;
106 SIZE thumbnail_size_;
107 DWORD color_depth_;
108 ULONG_PTR gdiplus_token_;
109 Gdiplus::Bitmap* signet_;
112 #endif
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */