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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_fpicker.hxx"
26 #include "previewbase.hxx"
27
28 #ifndef _COM_SUN_STAR_UI_DIALOG_FILEPREVIEWIMAGEFORMATS_HPP_
29 #include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp>
30 #endif
31
32 using namespace com::sun::star::uno;
33 using namespace com::sun::star::lang;
34 using namespace rtl;
35
36 //-------------------------------
37 //
38 //-------------------------------
39
PreviewBase()40 PreviewBase::PreviewBase() :
41 m_ImageFormat(::com::sun::star::ui::dialogs::FilePreviewImageFormats::BITMAP),
42 m_bShowState(sal_False)
43 {
44 }
45
46 //-------------------------------
47 //
48 //-------------------------------
49
~PreviewBase()50 PreviewBase::~PreviewBase()
51 {
52 }
53
54 //-------------------------------
55 //
56 //-------------------------------
57
getTargetColorDepth()58 sal_Int32 SAL_CALL PreviewBase::getTargetColorDepth() throw (RuntimeException)
59 {
60 return 0;
61 }
62
63 //-------------------------------
64 //
65 //-------------------------------
66
getAvailableWidth()67 sal_Int32 SAL_CALL PreviewBase::getAvailableWidth() throw (RuntimeException)
68 {
69 return 0;
70 }
71
72 //-------------------------------
73 //
74 //-------------------------------
75
getAvailableHeight()76 sal_Int32 SAL_CALL PreviewBase::getAvailableHeight() throw (RuntimeException)
77 {
78 return 0;
79 }
80
81 //-------------------------------
82 //
83 //-------------------------------
84
setImage(sal_Int16 aImageFormat,const::com::sun::star::uno::Any & aImage)85 void SAL_CALL PreviewBase::setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& aImage )
86 throw (IllegalArgumentException, RuntimeException)
87 {
88 if (aImageFormat != ::com::sun::star::ui::dialogs::FilePreviewImageFormats::BITMAP)
89 throw IllegalArgumentException(
90 OUString::createFromAscii("unsupported image format"), 0, 1);
91
92 if (aImage.hasValue() && (aImage.getValueType() != getCppuType((Sequence<sal_Int8>*)0)))
93 throw IllegalArgumentException(
94 OUString::createFromAscii("invalid image data"), 0, 2);
95
96 // save the new image data and force a redraw
97 m_ImageData = aImage;
98 m_ImageFormat = aImageFormat;
99 }
100
101 //-------------------------------
102 //
103 //-------------------------------
104
getImage(sal_Int16 & aImageFormat,com::sun::star::uno::Any & aImage)105 void SAL_CALL PreviewBase::getImage(sal_Int16& aImageFormat,com::sun::star::uno::Any& aImage)
106 {
107 aImageFormat = m_ImageFormat;
108 aImage = m_ImageData;
109 }
110
111 //-------------------------------
112 //
113 //-------------------------------
114
setShowState(sal_Bool bShowState)115 sal_Bool SAL_CALL PreviewBase::setShowState( sal_Bool bShowState ) throw (RuntimeException)
116 {
117 m_bShowState = bShowState;
118 return sal_True;
119 }
120
121 //-------------------------------
122 //
123 //-------------------------------
124
getShowState()125 sal_Bool SAL_CALL PreviewBase::getShowState() throw (RuntimeException)
126 {
127 return sal_False;
128 }
129
130 //-------------------------------
131 //
132 //-------------------------------
133
getImaginaryShowState() const134 sal_Bool SAL_CALL PreviewBase::getImaginaryShowState() const
135 {
136 return m_bShowState;
137 }
138
139 //-------------------------------
140 //
141 //-------------------------------
142
getWindowHandle() const143 HWND SAL_CALL PreviewBase::getWindowHandle() const
144 {
145 return 0;
146 }
147