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 "storagetextstream.hxx"
22 #include <com/sun/star/io/TextOutputStream.hpp>
24 #include <tools/diagnose_ex.h>
29 using ::com::sun::star::uno::Reference
;
30 using ::com::sun::star::uno::XInterface
;
31 using ::com::sun::star::uno::UNO_QUERY
;
32 using ::com::sun::star::uno::UNO_QUERY_THROW
;
33 using ::com::sun::star::uno::UNO_SET_THROW
;
34 using ::com::sun::star::uno::Exception
;
35 using ::com::sun::star::uno::RuntimeException
;
36 using ::com::sun::star::uno::Any
;
37 using ::com::sun::star::uno::makeAny
;
38 using ::com::sun::star::uno::Sequence
;
39 using ::com::sun::star::uno::Type
;
40 using ::com::sun::star::uno::XComponentContext
;
41 using ::com::sun::star::embed::XStorage
;
42 using ::com::sun::star::io::TextOutputStream
;
43 using ::com::sun::star::io::XTextOutputStream2
;
44 using ::com::sun::star::io::XActiveDataSource
;
46 // StorageTextOutputStream_Data
47 struct StorageTextOutputStream_Data
49 Reference
< XTextOutputStream2
> xTextOutput
;
52 static const char sLineFeed
[] = "\n";
54 // StorageTextOutputStream
55 StorageTextOutputStream::StorageTextOutputStream( const Reference
<XComponentContext
>& i_rContext
,
56 const Reference
< XStorage
>& i_rParentStorage
,
57 const OUString
& i_rStreamName
59 :StorageOutputStream( i_rContext
, i_rParentStorage
, i_rStreamName
)
60 ,m_pData( new StorageTextOutputStream_Data
)
62 m_pData
->xTextOutput
= TextOutputStream::create( i_rContext
);
63 m_pData
->xTextOutput
->setEncoding( "UTF-8" );
64 m_pData
->xTextOutput
->setOutputStream( getOutputStream() );
67 StorageTextOutputStream::~StorageTextOutputStream()
71 void StorageTextOutputStream::writeLine( const OUString
& i_rLine
)
73 m_pData
->xTextOutput
->writeString( i_rLine
);
74 m_pData
->xTextOutput
->writeString( sLineFeed
);
77 void StorageTextOutputStream::writeLine()
79 m_pData
->xTextOutput
->writeString( sLineFeed
);
82 } // namespace dbaccess
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */