1*b557fc96SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*b557fc96SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*b557fc96SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*b557fc96SAndrew Rist * distributed with this work for additional information 6*b557fc96SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*b557fc96SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*b557fc96SAndrew Rist * "License"); you may not use this file except in compliance 9*b557fc96SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*b557fc96SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*b557fc96SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*b557fc96SAndrew Rist * software distributed under the License is distributed on an 15*b557fc96SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b557fc96SAndrew Rist * KIND, either express or implied. See the License for the 17*b557fc96SAndrew Rist * specific language governing permissions and limitations 18*b557fc96SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*b557fc96SAndrew Rist *************************************************************/ 21*b557fc96SAndrew Rist 22*b557fc96SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_fpicker.hxx" 26cdf0e10cSrcweir #include "previewbase.hxx" 27cdf0e10cSrcweir 28cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_DIALOG_FILEPREVIEWIMAGEFORMATS_HPP_ 29cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp> 30cdf0e10cSrcweir #endif 31cdf0e10cSrcweir 32cdf0e10cSrcweir using namespace com::sun::star::uno; 33cdf0e10cSrcweir using namespace com::sun::star::lang; 34cdf0e10cSrcweir using namespace rtl; 35cdf0e10cSrcweir 36cdf0e10cSrcweir //------------------------------- 37cdf0e10cSrcweir // 38cdf0e10cSrcweir //------------------------------- 39cdf0e10cSrcweir 40cdf0e10cSrcweir PreviewBase::PreviewBase() : 41cdf0e10cSrcweir m_ImageFormat(::com::sun::star::ui::dialogs::FilePreviewImageFormats::BITMAP), 42cdf0e10cSrcweir m_bShowState(sal_False) 43cdf0e10cSrcweir { 44cdf0e10cSrcweir } 45cdf0e10cSrcweir 46cdf0e10cSrcweir //------------------------------- 47cdf0e10cSrcweir // 48cdf0e10cSrcweir //------------------------------- 49cdf0e10cSrcweir 50cdf0e10cSrcweir PreviewBase::~PreviewBase() 51cdf0e10cSrcweir { 52cdf0e10cSrcweir } 53cdf0e10cSrcweir 54cdf0e10cSrcweir //------------------------------- 55cdf0e10cSrcweir // 56cdf0e10cSrcweir //------------------------------- 57cdf0e10cSrcweir 58cdf0e10cSrcweir sal_Int32 SAL_CALL PreviewBase::getTargetColorDepth() throw (RuntimeException) 59cdf0e10cSrcweir { 60cdf0e10cSrcweir return 0; 61cdf0e10cSrcweir } 62cdf0e10cSrcweir 63cdf0e10cSrcweir //------------------------------- 64cdf0e10cSrcweir // 65cdf0e10cSrcweir //------------------------------- 66cdf0e10cSrcweir 67cdf0e10cSrcweir sal_Int32 SAL_CALL PreviewBase::getAvailableWidth() throw (RuntimeException) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir return 0; 70cdf0e10cSrcweir } 71cdf0e10cSrcweir 72cdf0e10cSrcweir //------------------------------- 73cdf0e10cSrcweir // 74cdf0e10cSrcweir //------------------------------- 75cdf0e10cSrcweir 76cdf0e10cSrcweir sal_Int32 SAL_CALL PreviewBase::getAvailableHeight() throw (RuntimeException) 77cdf0e10cSrcweir { 78cdf0e10cSrcweir return 0; 79cdf0e10cSrcweir } 80cdf0e10cSrcweir 81cdf0e10cSrcweir //------------------------------- 82cdf0e10cSrcweir // 83cdf0e10cSrcweir //------------------------------- 84cdf0e10cSrcweir 85cdf0e10cSrcweir void SAL_CALL PreviewBase::setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& aImage ) 86cdf0e10cSrcweir throw (IllegalArgumentException, RuntimeException) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir if (aImageFormat != ::com::sun::star::ui::dialogs::FilePreviewImageFormats::BITMAP) 89cdf0e10cSrcweir throw IllegalArgumentException( 90cdf0e10cSrcweir OUString::createFromAscii("unsupported image format"), 0, 1); 91cdf0e10cSrcweir 92cdf0e10cSrcweir if (aImage.hasValue() && (aImage.getValueType() != getCppuType((Sequence<sal_Int8>*)0))) 93cdf0e10cSrcweir throw IllegalArgumentException( 94cdf0e10cSrcweir OUString::createFromAscii("invalid image data"), 0, 2); 95cdf0e10cSrcweir 96cdf0e10cSrcweir // save the new image data and force a redraw 97cdf0e10cSrcweir m_ImageData = aImage; 98cdf0e10cSrcweir m_ImageFormat = aImageFormat; 99cdf0e10cSrcweir } 100cdf0e10cSrcweir 101cdf0e10cSrcweir //------------------------------- 102cdf0e10cSrcweir // 103cdf0e10cSrcweir //------------------------------- 104cdf0e10cSrcweir 105cdf0e10cSrcweir void SAL_CALL PreviewBase::getImage(sal_Int16& aImageFormat,com::sun::star::uno::Any& aImage) 106cdf0e10cSrcweir { 107cdf0e10cSrcweir aImageFormat = m_ImageFormat; 108cdf0e10cSrcweir aImage = m_ImageData; 109cdf0e10cSrcweir } 110cdf0e10cSrcweir 111cdf0e10cSrcweir //------------------------------- 112cdf0e10cSrcweir // 113cdf0e10cSrcweir //------------------------------- 114cdf0e10cSrcweir 115cdf0e10cSrcweir sal_Bool SAL_CALL PreviewBase::setShowState( sal_Bool bShowState ) throw (RuntimeException) 116cdf0e10cSrcweir { 117cdf0e10cSrcweir m_bShowState = bShowState; 118cdf0e10cSrcweir return sal_True; 119cdf0e10cSrcweir } 120cdf0e10cSrcweir 121cdf0e10cSrcweir //------------------------------- 122cdf0e10cSrcweir // 123cdf0e10cSrcweir //------------------------------- 124cdf0e10cSrcweir 125cdf0e10cSrcweir sal_Bool SAL_CALL PreviewBase::getShowState() throw (RuntimeException) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir return sal_False; 128cdf0e10cSrcweir } 129cdf0e10cSrcweir 130cdf0e10cSrcweir //------------------------------- 131cdf0e10cSrcweir // 132cdf0e10cSrcweir //------------------------------- 133cdf0e10cSrcweir 134cdf0e10cSrcweir sal_Bool SAL_CALL PreviewBase::getImaginaryShowState() const 135cdf0e10cSrcweir { 136cdf0e10cSrcweir return m_bShowState; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir //------------------------------- 140cdf0e10cSrcweir // 141cdf0e10cSrcweir //------------------------------- 142cdf0e10cSrcweir 143cdf0e10cSrcweir HWND SAL_CALL PreviewBase::getWindowHandle() const 144cdf0e10cSrcweir { 145cdf0e10cSrcweir return 0; 146cdf0e10cSrcweir } 147