1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_fpicker.hxx"
30 #include "previewbase.hxx"
32 #ifndef _COM_SUN_STAR_UI_DIALOG_FILEPREVIEWIMAGEFORMATS_HPP_
33 #include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp>
36 using namespace com::sun::star::uno
;
37 using namespace com::sun::star::lang
;
40 //-------------------------------
42 //-------------------------------
44 PreviewBase::PreviewBase() :
45 m_ImageFormat(::com::sun::star::ui::dialogs::FilePreviewImageFormats::BITMAP
),
46 m_bShowState(sal_False
)
50 //-------------------------------
52 //-------------------------------
54 PreviewBase::~PreviewBase()
58 //-------------------------------
60 //-------------------------------
62 sal_Int32 SAL_CALL
PreviewBase::getTargetColorDepth() throw (RuntimeException
)
67 //-------------------------------
69 //-------------------------------
71 sal_Int32 SAL_CALL
PreviewBase::getAvailableWidth() throw (RuntimeException
)
76 //-------------------------------
78 //-------------------------------
80 sal_Int32 SAL_CALL
PreviewBase::getAvailableHeight() throw (RuntimeException
)
85 //-------------------------------
87 //-------------------------------
89 void SAL_CALL
PreviewBase::setImage( sal_Int16 aImageFormat
, const ::com::sun::star::uno::Any
& aImage
)
90 throw (IllegalArgumentException
, RuntimeException
)
92 if (aImageFormat
!= ::com::sun::star::ui::dialogs::FilePreviewImageFormats::BITMAP
)
93 throw IllegalArgumentException(
94 OUString::createFromAscii("unsupported image format"), 0, 1);
96 if (aImage
.hasValue() && (aImage
.getValueType() != getCppuType((Sequence
<sal_Int8
>*)0)))
97 throw IllegalArgumentException(
98 OUString::createFromAscii("invalid image data"), 0, 2);
100 // save the new image data and force a redraw
101 m_ImageData
= aImage
;
102 m_ImageFormat
= aImageFormat
;
105 //-------------------------------
107 //-------------------------------
109 void SAL_CALL
PreviewBase::getImage(sal_Int16
& aImageFormat
,com::sun::star::uno::Any
& aImage
)
111 aImageFormat
= m_ImageFormat
;
112 aImage
= m_ImageData
;
115 //-------------------------------
117 //-------------------------------
119 sal_Bool SAL_CALL
PreviewBase::setShowState( sal_Bool bShowState
) throw (RuntimeException
)
121 m_bShowState
= bShowState
;
125 //-------------------------------
127 //-------------------------------
129 sal_Bool SAL_CALL
PreviewBase::getShowState() throw (RuntimeException
)
134 //-------------------------------
136 //-------------------------------
138 sal_Bool SAL_CALL
PreviewBase::getImaginaryShowState() const
143 //-------------------------------
145 //-------------------------------
147 HWND SAL_CALL
PreviewBase::getWindowHandle() const