LibreOffice Module chart2 (master) 1
MediaDescriptorHelper.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
21#include <com/sun/star/beans/PropertyValue.hpp>
22#include <com/sun/star/embed/XStorage.hpp>
23#include <com/sun/star/uno/Sequence.hxx>
24#include <com/sun/star/uno/Any.hxx>
25#include <com/sun/star/uno/Reference.hxx>
26
27using namespace ::com::sun::star;
28
29namespace apphelper
30{
31
33 beans::PropertyValue > & rMediaDescriptor )
34 : m_aModelProperties(rMediaDescriptor.getLength())
35{
36 auto aModelPropertiesRange = asNonConstRange(m_aModelProperties);
37 css::uno::Sequence< css::beans::PropertyValue >
38 aRegularProperties(rMediaDescriptor.getLength()); //these are the properties which are described in service com.sun.star.document.MediaDescriptor and not marked as deprecated
39 auto aRegularPropertiesRange = asNonConstRange(aRegularProperties);
40 impl_init();
41 sal_Int32 nRegularCount = 0;
42 sal_Int32 nModelCount = 0;
43
44 auto addRegularProp = [&aRegularPropertiesRange, &nRegularCount](const beans::PropertyValue& rRegularProp)
45 {
46 aRegularPropertiesRange[nRegularCount] = rRegularProp;
47 ++nRegularCount;
48 };
49 auto addModelProp = [&aModelPropertiesRange, &nModelCount, &addRegularProp](const beans::PropertyValue& rModelProp)
50 {
51 addRegularProp(rModelProp);
52 aModelPropertiesRange[nModelCount] = rModelProp;
53 ++nModelCount;
54 };
55
56 //read given rMediaDescriptor and store in internal structures:
57 for( const beans::PropertyValue& rProp : rMediaDescriptor)
58 {
59 if (rProp.Name == "AsTemplate")
60 {
61 addModelProp(rProp);
62 }
63 else if (rProp.Name == "Author")
64 {
65 addModelProp(rProp);
66 }
67 else if (rProp.Name == "CharacterSet")
68 {
69 addModelProp(rProp);
70 }
71 else if (rProp.Name == "Comment")
72 {
73 addModelProp(rProp);
74 }
75 else if (rProp.Name == "ComponentData")
76 {
77 addModelProp(rProp);
78 }
79 else if (rProp.Name == "FilterData")
80 {
81 addModelProp(rProp);
82 }
83 else if (rProp.Name == "FilterName")
84 {
85 ISSET_FilterName = rProp.Value >>= FilterName;
86 addModelProp(rProp);
87 }
88 else if (rProp.Name == "FilterOptions")
89 {
90 addModelProp(rProp);
91 }
92 else if (rProp.Name == "FrameName")
93 {
94 addModelProp(rProp);
95 }
96 else if (rProp.Name == "Hidden")
97 {
98 addModelProp(rProp);
99 }
100 else if (rProp.Name == "HierarchicalDocumentName")
101 {
102 rProp.Value >>= HierarchicalDocumentName;
103 addModelProp(rProp);
104 }
105 else if (rProp.Name == "OutputStream")
106 {
107 ISSET_OutputStream = rProp.Value >>= OutputStream;
108 addRegularProp(rProp);
109 }
110 else if (rProp.Name == "InputStream")
111 {
112 ISSET_InputStream = rProp.Value >>= InputStream;
113 addRegularProp(rProp);
114 }
115 else if (rProp.Name == "InteractionHandler")
116 {
117 addRegularProp(rProp);
118 }
119 else if (rProp.Name == "JumpMark")
120 {
121 addRegularProp(rProp);
122 }
123 else if (rProp.Name == "MediaType")
124 {
125 addModelProp(rProp);
126 }
127 else if (rProp.Name == "OpenNewView")
128 {
129 addRegularProp(rProp);
130 }
131 else if (rProp.Name == "Overwrite")
132 {
133 addModelProp(rProp);
134 }
135 else if (rProp.Name == "Password")
136 {
137 addModelProp(rProp);
138 }
139 else if (rProp.Name == "PosSize")
140 {
141 addRegularProp(rProp);
142 }
143 else if (rProp.Name == "PostData")
144 {
145 addRegularProp(rProp);
146 }
147 else if (rProp.Name == "Preview")
148 {
149 addModelProp(rProp);
150 }
151 else if (rProp.Name == "ReadOnly")
152 {
153 rProp.Value >>= ReadOnly;
154 addRegularProp(rProp);
155 }
156 else if (rProp.Name == "Referer")
157 {
158 addModelProp(rProp);
159 }
160 else if (rProp.Name == "SetEmbedded")
161 {
162 addRegularProp(rProp);
163 }
164 else if (rProp.Name == "Silent")
165 {
166 addRegularProp(rProp);
167 }
168 else if (rProp.Name == "StatusIndicator")
169 {
170 addRegularProp(rProp);
171 }
172 else if (rProp.Name == "Storage")
173 {
174 ISSET_Storage = rProp.Value >>= Storage;
175 addModelProp(rProp);
176 }
177 else if (rProp.Name == "Stream")
178 {
179 ISSET_Stream = rProp.Value >>= Stream;
180 addModelProp(rProp);
181 }
182 else if (rProp.Name == "Unpacked")
183 {
184 addModelProp(rProp);
185 }
186 else if (rProp.Name == "URL")
187 {
188 ISSET_URL = rProp.Value >>= URL;
189 addModelProp(rProp);
190 }
191 else if (rProp.Name == "Version")
192 {
193 addModelProp(rProp);
194 }
195 else if (rProp.Name == "ViewData")
196 {
197 addModelProp(rProp);
198 }
199 else if (rProp.Name == "ViewId")
200 {
201 addModelProp(rProp);
202 }
203 }
204
205 aRegularProperties.realloc(nRegularCount);
206 m_aModelProperties.realloc(nModelCount);
207}
208
210{
211 ISSET_FilterName = false;
212
213 ISSET_OutputStream = false;
214 ISSET_InputStream = false;
215
216 ReadOnly = false;
217 ISSET_URL = false;
218
219 ISSET_Storage = false;
220 ISSET_Stream = false;
221}
222
223}
224
225/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::embed::XStorage > Storage
css::uno::Reference< css::io::XStream > Stream
MediaDescriptorHelper(const css::uno::Sequence< css::beans::PropertyValue > &rMediaDescriptor)
css::uno::Sequence< css::beans::PropertyValue > m_aModelProperties
css::uno::Reference< css::io::XOutputStream > OutputStream
css::uno::Reference< css::io::XInputStream > InputStream
double getLength(const B2DPolygon &rCandidate)