Line data Source code
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 :
20 : #include "MediaDescriptorHelper.hxx"
21 :
22 : using namespace ::com::sun::star;
23 :
24 : namespace apphelper
25 : {
26 :
27 : const short FLAG_DEPRECATED =1;
28 : const short FLAG_MODEL =2;
29 :
30 : #define WRITE_PROPERTY( MediaName, nFlags ) \
31 : if(rProp.Name == #MediaName) \
32 : { \
33 : if( rProp.Value >>= MediaName ) \
34 : ISSET_##MediaName = true; \
35 : if((nFlags & FLAG_DEPRECATED) != 0) \
36 : { \
37 : m_aDeprecatedProperties[nDeprecatedCount]=rProp;\
38 : nDeprecatedCount++; \
39 : } \
40 : else \
41 : { \
42 : m_aRegularProperties[nRegularCount]=rProp; \
43 : nRegularCount++; \
44 : if((nFlags & FLAG_MODEL) != 0) \
45 : { \
46 : m_aModelProperties[nModelCount]=rProp; \
47 : nModelCount++; \
48 : } \
49 : } \
50 : }
51 :
52 722 : MediaDescriptorHelper::MediaDescriptorHelper( const uno::Sequence<
53 722 : beans::PropertyValue > & rMediaDescriptor )
54 : {
55 722 : impl_init();
56 :
57 722 : m_aRegularProperties.realloc(0);
58 722 : m_aRegularProperties.realloc(rMediaDescriptor.getLength());
59 722 : sal_Int32 nRegularCount = 0;
60 :
61 722 : m_aDeprecatedProperties.realloc(0);
62 722 : m_aDeprecatedProperties.realloc(rMediaDescriptor.getLength());
63 722 : sal_Int32 nDeprecatedCount = 0;
64 :
65 722 : m_aAdditionalProperties.realloc(0);
66 722 : m_aAdditionalProperties.realloc(rMediaDescriptor.getLength());
67 722 : sal_Int32 nAdditionalCount = 0;
68 :
69 722 : m_aModelProperties.realloc(0);
70 722 : m_aModelProperties.realloc(rMediaDescriptor.getLength());
71 722 : sal_Int32 nModelCount = 0;
72 :
73 : //read given rMediaDescriptor and store in internal structures:
74 5656 : for( sal_Int32 i= rMediaDescriptor.getLength();i--;)
75 : {
76 4212 : const beans::PropertyValue& rProp = rMediaDescriptor[i];
77 4212 : WRITE_PROPERTY( AsTemplate, FLAG_MODEL )
78 4206 : else WRITE_PROPERTY( Author, FLAG_MODEL )
79 4206 : else WRITE_PROPERTY( CharacterSet, FLAG_MODEL )
80 4206 : else WRITE_PROPERTY( Comment, FLAG_MODEL )
81 4206 : else WRITE_PROPERTY( ComponentData, FLAG_MODEL )
82 4206 : else WRITE_PROPERTY( FileName, FLAG_DEPRECATED )
83 4206 : else WRITE_PROPERTY( FilterData, FLAG_MODEL )
84 4206 : else WRITE_PROPERTY( FilterName, FLAG_MODEL )
85 3484 : else WRITE_PROPERTY( FilterFlags, FLAG_DEPRECATED)
86 3484 : else WRITE_PROPERTY( FilterOptions, FLAG_MODEL )
87 3484 : else WRITE_PROPERTY( FrameName, FLAG_MODEL )
88 3484 : else WRITE_PROPERTY( Hidden, FLAG_MODEL )
89 3484 : else WRITE_PROPERTY( HierarchicalDocumentName, FLAG_MODEL )
90 2780 : else WRITE_PROPERTY( OutputStream, 0 )
91 2780 : else WRITE_PROPERTY( InputStream, 0 )
92 2762 : else WRITE_PROPERTY( InteractionHandler, 0 )
93 2750 : else WRITE_PROPERTY( JumpMark, 0 )
94 2750 : else WRITE_PROPERTY( MediaType, FLAG_MODEL )
95 2750 : else WRITE_PROPERTY( OpenFlags, FLAG_DEPRECATED )
96 2750 : else WRITE_PROPERTY( OpenNewView, 0 )
97 2750 : else WRITE_PROPERTY( Overwrite, FLAG_MODEL )
98 2750 : else WRITE_PROPERTY( Password, FLAG_MODEL )
99 2750 : else WRITE_PROPERTY( PosSize, 0 )
100 2750 : else WRITE_PROPERTY( PostData, 0 )
101 2750 : else WRITE_PROPERTY( PostString, FLAG_DEPRECATED )
102 2750 : else WRITE_PROPERTY( Preview, FLAG_MODEL )
103 2750 : else WRITE_PROPERTY( ReadOnly, 0 )
104 2590 : else WRITE_PROPERTY( Referer, FLAG_MODEL )
105 2590 : else WRITE_PROPERTY( SetEmbedded, 0 )
106 2590 : else WRITE_PROPERTY( Silent, 0 )
107 2590 : else WRITE_PROPERTY( StatusIndicator, 0 )
108 2578 : else WRITE_PROPERTY( Storage, FLAG_MODEL )
109 1870 : else WRITE_PROPERTY( Stream, FLAG_MODEL )
110 1858 : else WRITE_PROPERTY( TemplateName, FLAG_DEPRECATED )
111 1858 : else WRITE_PROPERTY( TemplateRegionName, FLAG_DEPRECATED )
112 1858 : else WRITE_PROPERTY( Unpacked, FLAG_MODEL )
113 1858 : else WRITE_PROPERTY( URL, FLAG_MODEL )
114 1840 : else WRITE_PROPERTY( Version, FLAG_MODEL )
115 1840 : else WRITE_PROPERTY( ViewData, FLAG_MODEL )
116 1840 : else WRITE_PROPERTY( ViewId, FLAG_MODEL )
117 1840 : else WRITE_PROPERTY( WinExtent, FLAG_DEPRECATED )
118 : else
119 : {
120 1840 : m_aAdditionalProperties[nAdditionalCount]=rProp;
121 1840 : nAdditionalCount++;
122 : }
123 : }
124 :
125 722 : m_aRegularProperties.realloc(nRegularCount);
126 722 : m_aDeprecatedProperties.realloc(nDeprecatedCount);
127 722 : m_aAdditionalProperties.realloc(nAdditionalCount);
128 722 : m_aModelProperties.realloc(nModelCount);
129 722 : }
130 :
131 722 : void MediaDescriptorHelper::impl_init()
132 : {
133 722 : AsTemplate = false;
134 722 : ISSET_AsTemplate = false;
135 :
136 722 : ISSET_Author = false;
137 722 : ISSET_CharacterSet = false;
138 722 : ISSET_Comment = false;
139 :
140 : // ::com::sun::star::uno::Any ComponentData;
141 722 : ISSET_ComponentData = false;
142 722 : ISSET_FileName = false;
143 :
144 : // ::com::sun::star::uno::Any FilterData;
145 722 : ISSET_FilterData = false;
146 722 : ISSET_FilterName = false;
147 722 : ISSET_FilterFlags = false;
148 722 : ISSET_FilterOptions = false;
149 722 : ISSET_FrameName = false;
150 :
151 722 : Hidden = false;
152 722 : ISSET_Hidden = false;
153 722 : ISSET_HierarchicalDocumentName = false;
154 722 : ISSET_OutputStream = false;
155 722 : ISSET_InputStream = false;
156 722 : ISSET_InteractionHandler = false;
157 722 : ISSET_JumpMark = false;
158 722 : ISSET_MediaType = false;
159 722 : ISSET_OpenFlags = false;
160 722 : OpenNewView = false;
161 722 : ISSET_OpenNewView = false;
162 722 : Overwrite = false;
163 722 : ISSET_Overwrite = false;
164 722 : ISSET_Password = false;
165 :
166 : // ::com::sun::star::awt::Rectangle PosSize;
167 722 : ISSET_PosSize = false;
168 :
169 : // ::com::sun::star::uno::Sequence< sal_Int8 > PostData;
170 722 : ISSET_PostData = false;
171 722 : ISSET_PostString = false;
172 722 : Preview = false;
173 722 : ISSET_Preview = false;
174 722 : ReadOnly = false;
175 722 : ISSET_ReadOnly = false;
176 722 : ISSET_Referer = false;
177 722 : ISSET_StatusIndicator = false;
178 722 : Silent = false;
179 722 : ISSET_Silent = false;
180 722 : ISSET_TemplateName = false;
181 722 : ISSET_TemplateRegionName = false;
182 722 : Unpacked = false;
183 722 : ISSET_Unpacked = false;
184 722 : ISSET_URL = false;
185 722 : Version = 0;
186 722 : ISSET_Version = false;
187 :
188 : // ::com::sun::star::uno::Any ViewData;
189 722 : ISSET_ViewData = false;
190 722 : ViewId = 0;
191 722 : ISSET_ViewId = false;
192 :
193 722 : ISSET_WinExtent = false;
194 :
195 722 : SetEmbedded = false;
196 722 : ISSET_SetEmbedded = false;
197 :
198 722 : ISSET_Storage = false;
199 722 : ISSET_Stream = false;
200 722 : }
201 :
202 : }
203 :
204 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|