docthemes: Save themes def. to a file when added to ColorSets
[LibreOffice.git] / sw / source / core / inc / retrievedinputstreamdata.hxx
blobddb2c564a12a3bbd5ce1437fc7979138c2126ff2
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 .
19 #ifndef INCLUDED_SW_SOURCE_CORE_INC_RETRIEVEDINPUTSTREAMDATA_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_RETRIEVEDINPUTSTREAMDATA_HXX
22 #include <tools/link.hxx>
23 #include <sal/types.h>
24 #include <mutex>
25 #include <com/sun/star/uno/Reference.hxx>
27 #include <map>
28 #include <memory>
29 #include <utility>
31 namespace com::sun::star::io { class XInputStream; }
33 class SwAsyncRetrieveInputStreamThreadConsumer;
35 /** Singleton class to manage retrieved input stream data in Writer
37 OD 2007-01-29 #i73788#
38 The instance of this class provides data container for retrieved input
39 stream data. The data container is accessed via a key, which the data
40 manager provides on creation of the data container.
41 When a certain data container is filled with data, an user event is submitted
42 to trigger the processing of with data.
44 class SwRetrievedInputStreamDataManager
46 public:
48 typedef sal_uInt64 tDataKey;
50 struct tData
52 std::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > mpThreadConsumer;
53 css::uno::Reference<css::io::XInputStream> mxInputStream;
54 bool mbIsStreamReadOnly;
56 tData()
57 : mpThreadConsumer(),
58 mbIsStreamReadOnly( false )
59 {};
61 tData( std::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > pThreadConsumer )
62 : mpThreadConsumer(std::move( pThreadConsumer )),
63 mbIsStreamReadOnly( false )
64 {};
67 static SwRetrievedInputStreamDataManager& GetManager();
69 tDataKey ReserveData( std::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > const & pThreadConsumer );
71 void PushData( const tDataKey nDataKey,
72 css::uno::Reference<css::io::XInputStream> const & xInputStream,
73 const bool bIsStreamReadOnly );
75 bool PopData( const tDataKey nDataKey,
76 tData& rData );
78 DECL_STATIC_LINK( SwRetrievedInputStreamDataManager, LinkedInputStreamReady, void*, void );
80 private:
82 static tDataKey snNextKeyValue;
84 std::mutex maMutex;
86 std::map< tDataKey, tData > maInputStreamData;
88 #endif
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */