1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _PREVIEWADAPTER_HXX_
25 #define _PREVIEWADAPTER_HXX_
26 
27 #include <sal/types.h>
28 #include <com/sun/star/uno/Sequence.hxx>
29 #include <com/sun/star/uno/RuntimeException.hpp>
30 #include <com/sun/star/lang/IllegalArgumentException.hpp>
31 #include <com/sun/star/uno/Any.hxx>
32 
33 #if defined _MSC_VER
34 #pragma warning(push, 1)
35 #endif
36 #include <windows.h>
37 #if defined _MSC_VER
38 #pragma warning(pop)
39 #endif
40 #include <memory>
41 
42 // forward declaration
43 class CPreviewAdapterImpl;
44 
45 //---------------------------------------------
46 // A kind of a facade for the preview class.
47 // We want to hide the fact that the preview
48 // window may only become visible if there is
49 // a valid parent window (means, the FilePicker)
50 // is in execution mode. So unless someone sets
51 // the preview active with a valid parent
52 // window the preview may not be visible
53 //---------------------------------------------
54 
55 class CPreviewAdapter
56 {
57 public:
58 
59 	// ctor
60 	CPreviewAdapter(HINSTANCE instance);
61 
62 	~CPreviewAdapter();
63 
64 	::com::sun::star::uno::Sequence<sal_Int16> SAL_CALL getSupportedImageFormats();
65 
66     sal_Int32 SAL_CALL getTargetColorDepth();
67 
68     sal_Int32 SAL_CALL getAvailableWidth();
69 
70     sal_Int32 SAL_CALL getAvailableHeight();
71 
72     void SAL_CALL setImage(sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& aImage)
73 		throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
74 
75     sal_Bool SAL_CALL setShowState(sal_Bool bShowState);
76 
77     sal_Bool SAL_CALL getShowState();
78 
79 	void SAL_CALL setParent(HWND parent);
80 
81 	//--------------------------------------
82 	// notification from parent
83 	//--------------------------------------
84 
85 	void SAL_CALL notifyParentShow(bool bShow);
86 
87 	void SAL_CALL notifyParentSizeChanged();
88 
89 	void SAL_CALL notifyParentWindowPosChanged();
90 
91 private:
92 	// hide implementation details using the
93 	// bridge pattern
94 	std::auto_ptr<CPreviewAdapterImpl> m_pImpl;
95 
96 // prevent copy and assignment
97 private:
98     CPreviewAdapter(const CPreviewAdapter&);
99     CPreviewAdapter& operator=(const CPreviewAdapter&);
100 };
101 
102 
103 #endif
104