tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / package / source / xstor / oseekinstream.cxx
blobc791b96fe5e29c9b606b0741178995de87345bf3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <com/sun/star/lang/DisposedException.hpp>
21 #include <cppuhelper/typeprovider.hxx>
22 #include <cppuhelper/queryinterface.hxx>
23 #include <osl/diagnose.h>
24 #include <sal/log.hxx>
26 #include "oseekinstream.hxx"
27 #include "owriteablestream.hxx"
29 using namespace ::com::sun::star;
31 OInputSeekStream::OInputSeekStream( OWriteStream_Impl& pImpl,
32 uno::Reference < io::XInputStream > const & xStream,
33 const uno::Sequence< beans::PropertyValue >& aProps,
34 sal_Int32 nStorageType )
35 : OInputSeekStream_BASE(pImpl, xStream, aProps, nStorageType)
37 m_xSeekable.set( m_xStream, uno::UNO_QUERY );
38 OSL_ENSURE( m_xSeekable.is(), "No seeking support!" );
41 OInputSeekStream::OInputSeekStream( uno::Reference < io::XInputStream > const & xStream,
42 const uno::Sequence< beans::PropertyValue >& aProps,
43 sal_Int32 nStorageType )
44 : OInputSeekStream_BASE(xStream, aProps, nStorageType)
46 m_xSeekable.set( m_xStream, uno::UNO_QUERY );
47 OSL_ENSURE( m_xSeekable.is(), "No seeking support!" );
50 OInputSeekStream::~OInputSeekStream()
54 void SAL_CALL OInputSeekStream::seek( sal_Int64 location )
56 ::osl::MutexGuard aGuard( m_xMutex->GetMutex() );
57 if ( m_bDisposed )
59 SAL_INFO("package.xstor", "Disposed!");
60 throw lang::DisposedException();
63 if ( !m_xSeekable.is() )
65 SAL_INFO("package.xstor", "No seekable!");
66 throw uno::RuntimeException();
69 m_xSeekable->seek( location );
72 sal_Int64 SAL_CALL OInputSeekStream::getPosition()
74 ::osl::MutexGuard aGuard( m_xMutex->GetMutex() );
75 if ( m_bDisposed )
77 SAL_INFO("package.xstor", "Disposed!");
78 throw lang::DisposedException();
81 if ( !m_xSeekable.is() )
83 SAL_INFO("package.xstor", "No seekable!");
84 throw uno::RuntimeException();
87 return m_xSeekable->getPosition();
90 sal_Int64 SAL_CALL OInputSeekStream::getLength()
92 ::osl::MutexGuard aGuard( m_xMutex->GetMutex() );
93 if ( m_bDisposed )
95 SAL_INFO("package.xstor", "Disposed!");
96 throw lang::DisposedException();
99 if ( !m_xSeekable.is() )
101 SAL_INFO("package.xstor", "No seekable!");
102 throw uno::RuntimeException();
105 return m_xSeekable->getLength();
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */