tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / chart2 / source / tools / MediaDescriptorHelper.cxx
blobbd217b0fbf8c73a2cdfe0ba86c3f22382e6713e1
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 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;
44 auto addRegularProp = [&aRegularPropertiesRange, &nRegularCount](const beans::PropertyValue& rRegularProp)
46 aRegularPropertiesRange[nRegularCount] = rRegularProp;
47 ++nRegularCount;
49 auto addModelProp = [&aModelPropertiesRange, &nModelCount, &addRegularProp](const beans::PropertyValue& rModelProp)
51 addRegularProp(rModelProp);
52 aModelPropertiesRange[nModelCount] = rModelProp;
53 ++nModelCount;
56 //read given rMediaDescriptor and store in internal structures:
57 for( const beans::PropertyValue& rProp : rMediaDescriptor)
59 if (rProp.Name == "AsTemplate")
61 addModelProp(rProp);
63 else if (rProp.Name == "Author")
65 addModelProp(rProp);
67 else if (rProp.Name == "CharacterSet")
69 addModelProp(rProp);
71 else if (rProp.Name == "Comment")
73 addModelProp(rProp);
75 else if (rProp.Name == "ComponentData")
77 addModelProp(rProp);
79 else if (rProp.Name == "FilterData")
81 addModelProp(rProp);
83 else if (rProp.Name == "FilterName")
85 ISSET_FilterName = rProp.Value >>= FilterName;
86 addModelProp(rProp);
88 else if (rProp.Name == "FilterOptions")
90 addModelProp(rProp);
92 else if (rProp.Name == "FrameName")
94 addModelProp(rProp);
96 else if (rProp.Name == "Hidden")
98 addModelProp(rProp);
100 else if (rProp.Name == "HierarchicalDocumentName")
102 rProp.Value >>= HierarchicalDocumentName;
103 addModelProp(rProp);
105 else if (rProp.Name == "OutputStream")
107 ISSET_OutputStream = rProp.Value >>= OutputStream;
108 addRegularProp(rProp);
110 else if (rProp.Name == "InputStream")
112 ISSET_InputStream = rProp.Value >>= InputStream;
113 addRegularProp(rProp);
115 else if (rProp.Name == "InteractionHandler")
117 addRegularProp(rProp);
119 else if (rProp.Name == "JumpMark")
121 addRegularProp(rProp);
123 else if (rProp.Name == "MediaType")
125 addModelProp(rProp);
127 else if (rProp.Name == "OpenNewView")
129 addRegularProp(rProp);
131 else if (rProp.Name == "Overwrite")
133 addModelProp(rProp);
135 else if (rProp.Name == "Password")
137 addModelProp(rProp);
139 else if (rProp.Name == "PosSize")
141 addRegularProp(rProp);
143 else if (rProp.Name == "PostData")
145 addRegularProp(rProp);
147 else if (rProp.Name == "Preview")
149 addModelProp(rProp);
151 else if (rProp.Name == "ReadOnly")
153 rProp.Value >>= ReadOnly;
154 addRegularProp(rProp);
156 else if (rProp.Name == "Referer")
158 addModelProp(rProp);
160 else if (rProp.Name == "SetEmbedded")
162 addRegularProp(rProp);
164 else if (rProp.Name == "Silent")
166 addRegularProp(rProp);
168 else if (rProp.Name == "StatusIndicator")
170 addRegularProp(rProp);
172 else if (rProp.Name == "Storage")
174 ISSET_Storage = rProp.Value >>= Storage;
175 addModelProp(rProp);
177 else if (rProp.Name == "Stream")
179 ISSET_Stream = rProp.Value >>= Stream;
180 addModelProp(rProp);
182 else if (rProp.Name == "Unpacked")
184 addModelProp(rProp);
186 else if (rProp.Name == "URL")
188 ISSET_URL = rProp.Value >>= URL;
189 addModelProp(rProp);
191 else if (rProp.Name == "Version")
193 addModelProp(rProp);
195 else if (rProp.Name == "ViewData")
197 addModelProp(rProp);
199 else if (rProp.Name == "ViewId")
201 addModelProp(rProp);
205 aRegularProperties.realloc(nRegularCount);
206 m_aModelProperties.realloc(nModelCount);
209 void MediaDescriptorHelper::impl_init()
211 ISSET_FilterName = false;
213 ISSET_OutputStream = false;
214 ISSET_InputStream = false;
216 ReadOnly = false;
217 ISSET_URL = false;
219 ISSET_Storage = false;
220 ISSET_Stream = false;
225 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */