nss: upgrade to release 3.73
[LibreOffice.git] / chart2 / source / tools / MediaDescriptorHelper.cxx
blob73c326fdcb383cf90fccd18a0249302ba6aa5815
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 <MediaDescriptorHelper.hxx>
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>
27 using namespace ::com::sun::star;
29 namespace apphelper
32 MediaDescriptorHelper::MediaDescriptorHelper( const uno::Sequence<
33 beans::PropertyValue > & rMediaDescriptor )
34 : m_aModelProperties(rMediaDescriptor.getLength())
36 css::uno::Sequence< css::beans::PropertyValue >
37 aRegularProperties(rMediaDescriptor.getLength()); //these are the properties which are described in service com.sun.star.document.MediaDescriptor and not marked as deprecated
38 impl_init();
39 sal_Int32 nRegularCount = 0;
40 sal_Int32 nModelCount = 0;
42 auto addRegularProp = [&aRegularProperties, &nRegularCount](const beans::PropertyValue& rRegularProp)
44 aRegularProperties[nRegularCount] = rRegularProp;
45 ++nRegularCount;
47 auto addModelProp = [this, &nModelCount, &addRegularProp](const beans::PropertyValue& rModelProp)
49 addRegularProp(rModelProp);
50 m_aModelProperties[nModelCount] = rModelProp;
51 ++nModelCount;
54 //read given rMediaDescriptor and store in internal structures:
55 for( const beans::PropertyValue& rProp : rMediaDescriptor)
57 if (rProp.Name == "AsTemplate")
59 addModelProp(rProp);
61 else if (rProp.Name == "Author")
63 addModelProp(rProp);
65 else if (rProp.Name == "CharacterSet")
67 addModelProp(rProp);
69 else if (rProp.Name == "Comment")
71 addModelProp(rProp);
73 else if (rProp.Name == "ComponentData")
75 addModelProp(rProp);
77 else if (rProp.Name == "FilterData")
79 addModelProp(rProp);
81 else if (rProp.Name == "FilterName")
83 ISSET_FilterName = rProp.Value >>= FilterName;
84 addModelProp(rProp);
86 else if (rProp.Name == "FilterOptions")
88 addModelProp(rProp);
90 else if (rProp.Name == "FrameName")
92 addModelProp(rProp);
94 else if (rProp.Name == "Hidden")
96 addModelProp(rProp);
98 else if (rProp.Name == "HierarchicalDocumentName")
100 rProp.Value >>= HierarchicalDocumentName;
101 addModelProp(rProp);
103 else if (rProp.Name == "OutputStream")
105 ISSET_OutputStream = rProp.Value >>= OutputStream;
106 addRegularProp(rProp);
108 else if (rProp.Name == "InputStream")
110 ISSET_InputStream = rProp.Value >>= InputStream;
111 addRegularProp(rProp);
113 else if (rProp.Name == "InteractionHandler")
115 addRegularProp(rProp);
117 else if (rProp.Name == "JumpMark")
119 addRegularProp(rProp);
121 else if (rProp.Name == "MediaType")
123 addModelProp(rProp);
125 else if (rProp.Name == "OpenNewView")
127 addRegularProp(rProp);
129 else if (rProp.Name == "Overwrite")
131 addModelProp(rProp);
133 else if (rProp.Name == "Password")
135 addModelProp(rProp);
137 else if (rProp.Name == "PosSize")
139 addRegularProp(rProp);
141 else if (rProp.Name == "PostData")
143 addRegularProp(rProp);
145 else if (rProp.Name == "Preview")
147 addModelProp(rProp);
149 else if (rProp.Name == "ReadOnly")
151 rProp.Value >>= ReadOnly;
152 addRegularProp(rProp);
154 else if (rProp.Name == "Referer")
156 addModelProp(rProp);
158 else if (rProp.Name == "SetEmbedded")
160 addRegularProp(rProp);
162 else if (rProp.Name == "Silent")
164 addRegularProp(rProp);
166 else if (rProp.Name == "StatusIndicator")
168 addRegularProp(rProp);
170 else if (rProp.Name == "Storage")
172 ISSET_Storage = rProp.Value >>= Storage;
173 addModelProp(rProp);
175 else if (rProp.Name == "Stream")
177 ISSET_Stream = rProp.Value >>= Stream;
178 addModelProp(rProp);
180 else if (rProp.Name == "Unpacked")
182 addModelProp(rProp);
184 else if (rProp.Name == "URL")
186 ISSET_URL = rProp.Value >>= URL;
187 addModelProp(rProp);
189 else if (rProp.Name == "Version")
191 addModelProp(rProp);
193 else if (rProp.Name == "ViewData")
195 addModelProp(rProp);
197 else if (rProp.Name == "ViewId")
199 addModelProp(rProp);
203 aRegularProperties.realloc(nRegularCount);
204 m_aModelProperties.realloc(nModelCount);
207 void MediaDescriptorHelper::impl_init()
209 ISSET_FilterName = false;
211 ISSET_OutputStream = false;
212 ISSET_InputStream = false;
214 ReadOnly = false;
215 ISSET_URL = false;
217 ISSET_Storage = false;
218 ISSET_Stream = false;
223 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */