merge the formfield patch from ooo-build
[ooovba.git] / shell / inc / internal / thumbviewer.hxx
blob32334ee40ae3d53a6fb5407f2e5568e68c9c7ec4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: thumbviewer.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef THUMBVIEWER_HXX_INCLUDED
32 #define THUMBVIEWER_HXX_INCLUDED
34 #if defined _MSC_VER
35 #pragma warning(push, 1)
36 #pragma warning(disable:4917)
37 #endif
38 #include <objidl.h>
39 #include <shlobj.h>
40 #ifdef __MINGW32__
41 #include <algorithm>
42 using std::min;
43 using std::max;
44 #endif
45 #include <gdiplus.h>
46 #if defined _MSC_VER
47 #pragma warning(pop)
48 #endif
49 #include <string>
51 class CThumbviewer : public IPersistFile, public IExtractImage
53 public:
54 CThumbviewer(long RefCnt = 1);
55 virtual ~CThumbviewer();
57 //-----------------------------
58 // IUnknown methods
59 //-----------------------------
61 virtual HRESULT STDMETHODCALLTYPE QueryInterface(
62 REFIID riid,
63 void __RPC_FAR *__RPC_FAR *ppvObject);
65 virtual ULONG STDMETHODCALLTYPE AddRef( void);
67 virtual ULONG STDMETHODCALLTYPE Release( void);
69 //----------------------------
70 // IExtractImage methods
71 //----------------------------
73 virtual HRESULT STDMETHODCALLTYPE Extract(HBITMAP *phBmpImage);
75 virtual HRESULT STDMETHODCALLTYPE GetLocation(
76 LPWSTR pszPathBuffer,
77 DWORD cchMax,
78 DWORD *pdwPriority,
79 const SIZE *prgSize,
80 DWORD dwRecClrDepth,
81 DWORD *pdwFlags);
83 //----------------------------
84 // IPersist methods
85 //----------------------------
87 virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID* pClassID);
89 //----------------------------
90 // IPersistFile methods
91 //----------------------------
93 virtual HRESULT STDMETHODCALLTYPE IsDirty();
95 virtual HRESULT STDMETHODCALLTYPE Load(
96 /* [in] */ LPCOLESTR pszFileName,
97 /* [in] */ DWORD dwMode);
99 virtual HRESULT STDMETHODCALLTYPE Save(
100 /* [unique][in] */ LPCOLESTR pszFileName,
101 /* [in] */ BOOL fRemember);
103 virtual HRESULT STDMETHODCALLTYPE SaveCompleted(
104 /* [unique][in] */ LPCOLESTR pszFileName);
106 virtual HRESULT STDMETHODCALLTYPE GetCurFile(
107 /* [out] */ LPOLESTR __RPC_FAR *ppszFileName);
109 private:
110 Gdiplus::Rect CalcScaledAspectRatio(Gdiplus::Rect src, Gdiplus::Rect dest);
112 private:
113 long ref_count_;
114 std::wstring filename_;
115 SIZE thumbnail_size_;
116 DWORD color_depth_;
117 ULONG_PTR gdiplus_token_;
118 Gdiplus::Bitmap* signet_;
121 #endif