1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "previewbase.hxx"
22 #include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp>
24 using namespace com::sun::star::uno
;
25 using namespace com::sun::star::lang
;
28 //-------------------------------
30 //-------------------------------
32 PreviewBase::PreviewBase() :
33 m_ImageFormat(::com::sun::star::ui::dialogs::FilePreviewImageFormats::BITMAP
),
34 m_bShowState(sal_False
)
38 //-------------------------------
40 //-------------------------------
42 PreviewBase::~PreviewBase()
46 //-------------------------------
48 //-------------------------------
50 sal_Int32 SAL_CALL
PreviewBase::getTargetColorDepth() throw (RuntimeException
)
55 //-------------------------------
57 //-------------------------------
59 sal_Int32 SAL_CALL
PreviewBase::getAvailableWidth() throw (RuntimeException
)
64 //-------------------------------
66 //-------------------------------
68 sal_Int32 SAL_CALL
PreviewBase::getAvailableHeight() throw (RuntimeException
)
73 //-------------------------------
75 //-------------------------------
77 void SAL_CALL
PreviewBase::setImage( sal_Int16 aImageFormat
, const ::com::sun::star::uno::Any
& aImage
)
78 throw (IllegalArgumentException
, RuntimeException
)
80 if (aImageFormat
!= ::com::sun::star::ui::dialogs::FilePreviewImageFormats::BITMAP
)
81 throw IllegalArgumentException(
82 OUString("unsupported image format"), 0, 1);
84 if (aImage
.hasValue() && (aImage
.getValueType() != getCppuType((Sequence
<sal_Int8
>*)0)))
85 throw IllegalArgumentException(
86 OUString("invalid image data"), 0, 2);
88 // save the new image data and force a redraw
90 m_ImageFormat
= aImageFormat
;
93 //-------------------------------
95 //-------------------------------
97 void SAL_CALL
PreviewBase::getImage(sal_Int16
& aImageFormat
,com::sun::star::uno::Any
& aImage
)
99 aImageFormat
= m_ImageFormat
;
100 aImage
= m_ImageData
;
103 //-------------------------------
105 //-------------------------------
107 sal_Bool SAL_CALL
PreviewBase::setShowState( sal_Bool bShowState
) throw (RuntimeException
)
109 m_bShowState
= bShowState
;
113 //-------------------------------
115 //-------------------------------
117 sal_Bool SAL_CALL
PreviewBase::getShowState() throw (RuntimeException
)
122 //-------------------------------
124 //-------------------------------
126 sal_Bool SAL_CALL
PreviewBase::getImaginaryShowState() const
131 //-------------------------------
133 //-------------------------------
135 HWND SAL_CALL
PreviewBase::getWindowHandle() const
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */