1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: MediaDescriptorHelper.cxx,v $
10 * $Revision: 1.5.44.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
33 #include "MediaDescriptorHelper.hxx"
35 using namespace ::com::sun::star
;
41 const short FLAG_DEPRECATED
=1;
42 const short FLAG_MODEL
=2;
44 #define WRITE_PROPERTY( MediaName, nFlags ) \
45 if(rProp.Name.equals(::rtl::OUString::createFromAscii(#MediaName))) \
47 if( rProp.Value >>= MediaName ) \
48 ISSET_##MediaName = sal_True; \
49 if(nFlags & FLAG_DEPRECATED) \
51 m_aDeprecatedProperties[nDeprecatedCount]=rProp;\
56 m_aRegularProperties[nRegularCount]=rProp; \
58 if( nFlags & FLAG_MODEL) \
60 m_aModelProperties[nModelCount]=rProp; \
66 MediaDescriptorHelper::MediaDescriptorHelper( const uno::Sequence
<
67 beans::PropertyValue
> & rMediaDescriptor
)
71 m_aRegularProperties
.realloc(0);
72 m_aRegularProperties
.realloc(rMediaDescriptor
.getLength());
73 sal_Int32 nRegularCount
= 0;
75 m_aDeprecatedProperties
.realloc(0);
76 m_aDeprecatedProperties
.realloc(rMediaDescriptor
.getLength());
77 sal_Int32 nDeprecatedCount
= 0;
79 m_aAdditionalProperties
.realloc(0);
80 m_aAdditionalProperties
.realloc(rMediaDescriptor
.getLength());
81 sal_Int32 nAdditionalCount
= 0;
83 m_aModelProperties
.realloc(0);
84 m_aModelProperties
.realloc(rMediaDescriptor
.getLength());
85 sal_Int32 nModelCount
= 0;
88 //read given rMediaDescriptor and store in internal structures:
89 for( sal_Int32 i
= rMediaDescriptor
.getLength();i
--;)
91 const beans::PropertyValue
& rProp
= rMediaDescriptor
[i
];
92 WRITE_PROPERTY( AsTemplate
, FLAG_MODEL
)
93 else WRITE_PROPERTY( Author
, FLAG_MODEL
)
94 else WRITE_PROPERTY( CharacterSet
, FLAG_MODEL
)
95 else WRITE_PROPERTY( Comment
, FLAG_MODEL
)
96 else WRITE_PROPERTY( ComponentData
, FLAG_MODEL
)
97 else WRITE_PROPERTY( FileName
, FLAG_DEPRECATED
)
98 else WRITE_PROPERTY( FilterData
, FLAG_MODEL
)
99 else WRITE_PROPERTY( FilterName
, FLAG_MODEL
)
100 else WRITE_PROPERTY( FilterFlags
, FLAG_DEPRECATED
)
101 else WRITE_PROPERTY( FilterOptions
, FLAG_MODEL
)
102 else WRITE_PROPERTY( FrameName
, FLAG_MODEL
)
103 else WRITE_PROPERTY( Hidden
, FLAG_MODEL
)
104 else WRITE_PROPERTY( HierarchicalDocumentName
, FLAG_MODEL
)
105 else WRITE_PROPERTY( OutputStream
, 0 )
106 else WRITE_PROPERTY( InputStream
, 0 )
107 else WRITE_PROPERTY( InteractionHandler
, 0 )
108 else WRITE_PROPERTY( JumpMark
, 0 )
109 else WRITE_PROPERTY( MediaType
, FLAG_MODEL
)
110 else WRITE_PROPERTY( OpenFlags
, FLAG_DEPRECATED
)
111 else WRITE_PROPERTY( OpenNewView
, 0 )
112 else WRITE_PROPERTY( Overwrite
, FLAG_MODEL
)
113 else WRITE_PROPERTY( Password
, FLAG_MODEL
)
114 else WRITE_PROPERTY( PosSize
, 0 )
115 else WRITE_PROPERTY( PostData
, 0 )
116 else WRITE_PROPERTY( PostString
, FLAG_DEPRECATED
)
117 else WRITE_PROPERTY( Preview
, FLAG_MODEL
)
118 else WRITE_PROPERTY( ReadOnly
, 0 )
119 else WRITE_PROPERTY( Referer
, FLAG_MODEL
)
120 else WRITE_PROPERTY( SetEmbedded
, 0 )
121 else WRITE_PROPERTY( Silent
, 0 )
122 else WRITE_PROPERTY( StatusIndicator
, 0 )
123 else WRITE_PROPERTY( Storage
, FLAG_MODEL
)
124 else WRITE_PROPERTY( Stream
, FLAG_MODEL
)
125 else WRITE_PROPERTY( TemplateName
, FLAG_DEPRECATED
)
126 else WRITE_PROPERTY( TemplateRegionName
, FLAG_DEPRECATED
)
127 else WRITE_PROPERTY( Unpacked
, FLAG_MODEL
)
128 else WRITE_PROPERTY( URL
, FLAG_MODEL
)
129 else WRITE_PROPERTY( Version
, FLAG_MODEL
)
130 else WRITE_PROPERTY( ViewData
, FLAG_MODEL
)
131 else WRITE_PROPERTY( ViewId
, FLAG_MODEL
)
132 else WRITE_PROPERTY( WinExtent
, FLAG_DEPRECATED
)
135 m_aAdditionalProperties
[nAdditionalCount
]=rProp
;
140 m_aRegularProperties
.realloc(nRegularCount
);
141 m_aDeprecatedProperties
.realloc(nDeprecatedCount
);
142 m_aAdditionalProperties
.realloc(nAdditionalCount
);
143 m_aModelProperties
.realloc(nModelCount
);
146 void MediaDescriptorHelper::impl_init()
148 AsTemplate
= sal_False
;
149 ISSET_AsTemplate
= sal_False
;
151 ISSET_Author
= sal_False
;
152 ISSET_CharacterSet
= sal_False
;
153 ISSET_Comment
= sal_False
;
155 // ::com::sun::star::uno::Any ComponentData;
156 ISSET_ComponentData
= sal_False
;
157 ISSET_FileName
= sal_False
;
159 // ::com::sun::star::uno::Any FilterData;
160 ISSET_FilterData
= sal_False
;
161 ISSET_FilterName
= sal_False
;
162 ISSET_FilterFlags
= sal_False
;
163 ISSET_FilterOptions
= sal_False
;
164 ISSET_FrameName
= sal_False
;
167 ISSET_Hidden
= sal_False
;
168 ISSET_HierarchicalDocumentName
= sal_False
;
169 ISSET_OutputStream
= sal_False
;
170 ISSET_InputStream
= sal_False
;
171 ISSET_InteractionHandler
= sal_False
;
172 ISSET_JumpMark
= sal_False
;
173 ISSET_MediaType
= sal_False
;
174 ISSET_OpenFlags
= sal_False
;
175 OpenNewView
= sal_False
;
176 ISSET_OpenNewView
= sal_False
;
177 Overwrite
= sal_False
;
178 ISSET_Overwrite
= sal_False
;
179 ISSET_Password
= sal_False
;
181 // ::com::sun::star::awt::Rectangle PosSize;
182 ISSET_PosSize
= sal_False
;
184 // ::com::sun::star::uno::Sequence< sal_Int8 > PostData;
185 ISSET_PostData
= sal_False
;
186 ISSET_PostString
= sal_False
;
188 ISSET_Preview
= sal_False
;
189 ReadOnly
= sal_False
;
190 ISSET_ReadOnly
= sal_False
;
191 ISSET_Referer
= sal_False
;
192 ISSET_StatusIndicator
= sal_False
;
194 ISSET_Silent
= sal_False
;
195 ISSET_TemplateName
= sal_False
;
196 ISSET_TemplateRegionName
= sal_False
;
197 Unpacked
= sal_False
;
198 ISSET_Unpacked
= sal_False
;
199 ISSET_URL
= sal_False
;
201 ISSET_Version
= sal_False
;
203 // ::com::sun::star::uno::Any ViewData;
204 ISSET_ViewData
= sal_False
;
206 ISSET_ViewId
= sal_False
;
208 ISSET_WinExtent
= sal_False
;
210 ISSET_Storage
= sal_False
;
211 ISSET_Stream
= sal_False
;
214 MediaDescriptorHelper::~MediaDescriptorHelper()
219 uno::Sequence
< beans::PropertyValue
> MediaDescriptorHelper
220 ::getReducedForModel()
222 return m_aModelProperties
;