1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: previewbase.cxx,v $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_fpicker.hxx"
33 #include "previewbase.hxx"
35 #ifndef _COM_SUN_STAR_UI_DIALOG_FILEPREVIEWIMAGEFORMATS_HPP_
36 #include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp>
39 using namespace com::sun::star::uno
;
40 using namespace com::sun::star::lang
;
43 //-------------------------------
45 //-------------------------------
47 PreviewBase::PreviewBase() :
48 m_ImageFormat(::com::sun::star::ui::dialogs::FilePreviewImageFormats::BITMAP
),
49 m_bShowState(sal_False
)
53 //-------------------------------
55 //-------------------------------
57 PreviewBase::~PreviewBase()
61 //-------------------------------
63 //-------------------------------
65 sal_Int32 SAL_CALL
PreviewBase::getTargetColorDepth() throw (RuntimeException
)
70 //-------------------------------
72 //-------------------------------
74 sal_Int32 SAL_CALL
PreviewBase::getAvailableWidth() throw (RuntimeException
)
79 //-------------------------------
81 //-------------------------------
83 sal_Int32 SAL_CALL
PreviewBase::getAvailableHeight() throw (RuntimeException
)
88 //-------------------------------
90 //-------------------------------
92 void SAL_CALL
PreviewBase::setImage( sal_Int16 aImageFormat
, const ::com::sun::star::uno::Any
& aImage
)
93 throw (IllegalArgumentException
, RuntimeException
)
95 if (aImageFormat
!= ::com::sun::star::ui::dialogs::FilePreviewImageFormats::BITMAP
)
96 throw IllegalArgumentException(
97 OUString::createFromAscii("unsupported image format"), 0, 1);
99 if (aImage
.hasValue() && (aImage
.getValueType() != getCppuType((Sequence
<sal_Int8
>*)0)))
100 throw IllegalArgumentException(
101 OUString::createFromAscii("invalid image data"), 0, 2);
103 // save the new image data and force a redraw
104 m_ImageData
= aImage
;
105 m_ImageFormat
= aImageFormat
;
108 //-------------------------------
110 //-------------------------------
112 void SAL_CALL
PreviewBase::getImage(sal_Int16
& aImageFormat
,com::sun::star::uno::Any
& aImage
)
114 aImageFormat
= m_ImageFormat
;
115 aImage
= m_ImageData
;
118 //-------------------------------
120 //-------------------------------
122 sal_Bool SAL_CALL
PreviewBase::setShowState( sal_Bool bShowState
) throw (RuntimeException
)
124 m_bShowState
= bShowState
;
128 //-------------------------------
130 //-------------------------------
132 sal_Bool SAL_CALL
PreviewBase::getShowState() throw (RuntimeException
)
137 //-------------------------------
139 //-------------------------------
141 sal_Bool SAL_CALL
PreviewBase::getImaginaryShowState() const
146 //-------------------------------
148 //-------------------------------
150 HWND SAL_CALL
PreviewBase::getWindowHandle() const