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 <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
;
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
39 sal_Int32 nRegularCount
= 0;
40 sal_Int32 nModelCount
= 0;
42 auto addRegularProp
= [&aRegularProperties
, &nRegularCount
](const beans::PropertyValue
& rRegularProp
)
44 aRegularProperties
[nRegularCount
] = rRegularProp
;
47 auto addModelProp
= [this, &nModelCount
, &addRegularProp
](const beans::PropertyValue
& rModelProp
)
49 addRegularProp(rModelProp
);
50 m_aModelProperties
[nModelCount
] = rModelProp
;
54 //read given rMediaDescriptor and store in internal structures:
55 for( const beans::PropertyValue
& rProp
: rMediaDescriptor
)
57 if (rProp
.Name
== "AsTemplate")
61 else if (rProp
.Name
== "Author")
65 else if (rProp
.Name
== "CharacterSet")
69 else if (rProp
.Name
== "Comment")
73 else if (rProp
.Name
== "ComponentData")
77 else if (rProp
.Name
== "FilterData")
81 else if (rProp
.Name
== "FilterName")
83 ISSET_FilterName
= rProp
.Value
>>= FilterName
;
86 else if (rProp
.Name
== "FilterOptions")
90 else if (rProp
.Name
== "FrameName")
94 else if (rProp
.Name
== "Hidden")
98 else if (rProp
.Name
== "HierarchicalDocumentName")
100 rProp
.Value
>>= HierarchicalDocumentName
;
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")
125 else if (rProp
.Name
== "OpenNewView")
127 addRegularProp(rProp
);
129 else if (rProp
.Name
== "Overwrite")
133 else if (rProp
.Name
== "Password")
137 else if (rProp
.Name
== "PosSize")
139 addRegularProp(rProp
);
141 else if (rProp
.Name
== "PostData")
143 addRegularProp(rProp
);
145 else if (rProp
.Name
== "Preview")
149 else if (rProp
.Name
== "ReadOnly")
151 rProp
.Value
>>= ReadOnly
;
152 addRegularProp(rProp
);
154 else if (rProp
.Name
== "Referer")
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
;
175 else if (rProp
.Name
== "Stream")
177 ISSET_Stream
= rProp
.Value
>>= Stream
;
180 else if (rProp
.Name
== "Unpacked")
184 else if (rProp
.Name
== "URL")
186 ISSET_URL
= rProp
.Value
>>= URL
;
189 else if (rProp
.Name
== "Version")
193 else if (rProp
.Name
== "ViewData")
197 else if (rProp
.Name
== "ViewId")
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;
217 ISSET_Storage
= false;
218 ISSET_Stream
= false;
223 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */