1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _MEDIADESCRIPTORHELPER_HXX
24 #define _MEDIADESCRIPTORHELPER_HXX
25 
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <com/sun/star/beans/PropertyValue.hpp>
28 #include <com/sun/star/util/URL.hpp>
29 #include <com/sun/star/awt/Rectangle.hpp>
30 #include <com/sun/star/io/XStream.hpp>
31 #include <com/sun/star/io/XInputStream.hpp>
32 #include <com/sun/star/io/XOutputStream.hpp>
33 #include <com/sun/star/embed/XStorage.hpp>
34 #include "charttoolsdllapi.hxx"
35 
36 /*
37 * This class helps to read and write the properties mentioned in the service description
38 * com.sun.star.document.MediaDescriptor from and to a sequence of PropertyValues.
39 * Properties that are not mentioned in the service description
40 * are stored in the member AdditionalProperties.
41 *
42 * As an additional feature this helper class can generate a reduced sequence of PropertyValues
43 * that does not contain properties which are known to be only view relevant. This
44 * reduced sequence than might be attached to a model directly.
45 */
46 
47 namespace apphelper
48 {
49 
50 class OOO_DLLPUBLIC_CHARTTOOLS MediaDescriptorHelper
51 {
52 private:
53 	//MediaDescriptorHelper(){};
54 public:
55 	MediaDescriptorHelper( const ::com::sun::star::uno::Sequence<
56 							::com::sun::star::beans::PropertyValue > & rMediaDescriptor );
57 	virtual ~MediaDescriptorHelper();
58 
59 	::com::sun::star::uno::Sequence<
60 				::com::sun::star::beans::PropertyValue > getReducedForModel();
61 
62 public:
63 	//---------------------
64 	//all properties given in the constructor are stored in the following three sequences
65 
66 	::com::sun::star::uno::Sequence<
67 		::com::sun::star::beans::PropertyValue >
68 						m_aRegularProperties; //these are the properties which are described in service com.sun.star.document.MediaDescriptor and not marked as deprecated
69 
70 	::com::sun::star::uno::Sequence<
71 		::com::sun::star::beans::PropertyValue >
72 						m_aDeprecatedProperties; //these are properties which are described in service com.sun.star.document.MediaDescriptor but are marked as deprecated
73 
74 	::com::sun::star::uno::Sequence<
75 		::com::sun::star::beans::PropertyValue >
76 						m_aAdditionalProperties; //these are properties which are not described in service com.sun.star.document.MediaDescriptor
77 
78 	//----------------------
79 	//properties which should be given to a model are additionally stored in this sequence (not documented properties and deprecated properties are not included!)
80 	::com::sun::star::uno::Sequence<
81 		::com::sun::star::beans::PropertyValue >
82 						m_aModelProperties; //these are properties which are not described in service com.sun.star.document.MediaDescriptor
83 
84 
85 	//@todo define this for debug only, except URL
86 	sal_Bool			AsTemplate; //document is a template.
87 	sal_Bool			ISSET_AsTemplate;
88 	::rtl::OUString		Author; //
89 	sal_Bool			ISSET_Author;
90 	::rtl::OUString		CharacterSet; //identifier of used character set.
91 	sal_Bool			ISSET_CharacterSet;
92 	::rtl::OUString		Comment;//
93 	sal_Bool			ISSET_Comment;
94 
95 	::com::sun::star::uno::Any
96 						ComponentData;//
97 	sal_Bool			ISSET_ComponentData;
98 	::rtl::OUString		FileName; //deprecated, same as url
99 	sal_Bool			ISSET_FileName;
100 	::com::sun::star::uno::Any
101 						FilterData;//
102 	sal_Bool			ISSET_FilterData;
103 	::rtl::OUString		FilterName; //internal filter name.
104 	sal_Bool			ISSET_FilterName;
105 	::rtl::OUString		FilterFlags;//deprecated,
106 	sal_Bool			ISSET_FilterFlags;
107 	::rtl::OUString		FilterOptions;//
108 	sal_Bool			ISSET_FilterOptions;
109 			//not documented ... @todo remove?
110 	::rtl::OUString		FrameName; //name of target frame.
111 	sal_Bool			ISSET_FrameName;
112     sal_Bool			Hidden; //load document, invisible.
113 	sal_Bool			ISSET_Hidden;
114 
115     ::rtl::OUString		HierarchicalDocumentName;
116     sal_Bool			ISSET_HierarchicalDocumentName;
117 
118 
119     ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
120                         OutputStream; //a stream to receive the document data for saving
121     sal_Bool			ISSET_OutputStream;
122 	::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
123 						InputStream; //content of document.
124 	sal_Bool			ISSET_InputStream;
125 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
126 						InteractionHandler; //	//::com::sun::star::task::XInteractionHandler
127 	sal_Bool			ISSET_InteractionHandler;
128 
129 	::rtl::OUString		JumpMark;	//specifies the name of a mark within the document where the first view is to position itself.
130 	sal_Bool			ISSET_JumpMark;
131 	::rtl::OUString		MediaType; //mime type.
132 	sal_Bool			ISSET_MediaType;
133 	::rtl::OUString		OpenFlags; //deprecated
134 	sal_Bool			ISSET_OpenFlags;
135 	sal_Bool			OpenNewView; //opens a new view for an already loaded document.
136 	sal_Bool			ISSET_OpenNewView;
137 	sal_Bool			Overwrite; //opens a new view for an already loaded document.
138 	sal_Bool			ISSET_Overwrite;
139 	::rtl::OUString		Password; //
140 	sal_Bool			ISSET_Password;
141 
142 		//not documented ... @todo remove?
143 	::com::sun::star::awt::Rectangle
144 						PosSize; //position and size of document window.
145 	sal_Bool			ISSET_PosSize;
146 
147 	::com::sun::star::uno::Sequence< sal_Int8 >
148 						PostData; //contains the data for HTTP post method as a sequence of bytes.
149 	sal_Bool			ISSET_PostData;
150 	::rtl::OUString		PostString; //deprecated, contains the data for HTTP post method as a sequence of bytes.
151 	sal_Bool			ISSET_PostString;
152     sal_Bool			Preview; //show preview.
153 	sal_Bool			ISSET_Preview;
154 	sal_Bool			ReadOnly; //open document readonly.
155 	sal_Bool			ISSET_ReadOnly;
156 	::rtl::OUString		Referer; //name of document referrer.
157 	sal_Bool			ISSET_Referer;
158 
159 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
160 						StatusIndicator; //  //::com::sun::star::task::XStatusIndicator
161 	sal_Bool			ISSET_StatusIndicator;
162 		//not documented ... @todo remove?
163     sal_Bool			Silent; //prevents dialogs to query for more information.
164 	sal_Bool			ISSET_Silent;
165     ::rtl::OUString		TemplateName; //deprecated, name of the template instead of the URL.
166 	sal_Bool			ISSET_TemplateName;
167     ::rtl::OUString		TemplateRegionName; //deprecated, name of the region of the template.
168 	sal_Bool			ISSET_TemplateRegionName;
169 	sal_Bool			Unpacked;
170 	sal_Bool			ISSET_Unpacked;
171     ::rtl::OUString     URL;// FileName, URL of the document.
172 	sal_Bool			ISSET_URL;
173 	sal_Int16			Version; //storage version.
174 	sal_Bool			ISSET_Version;
175 
176 	::com::sun::star::uno::Any
177 						ViewData;//
178 	sal_Bool			ISSET_ViewData;
179 	sal_Int16			ViewId; //id of the initial view.
180 	sal_Bool			ISSET_ViewId;
181 
182     // new framework objects
183     ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
184                         Storage;
185     sal_Bool            ISSET_Storage;
186     ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >
187                         Stream;
188     sal_Bool            ISSET_Stream;
189 
190     // undocumented SFX Properties
191     ::com::sun::star::uno::Sequence< sal_Int32 >
192                         WinExtent;
193     sal_Bool            ISSET_WinExtent;
194     sal_Bool            SetEmbedded;
195     sal_Bool            ISSET_SetEmbedded;
196 
197 protected:
198 SAL_DLLPRIVATE void impl_init();
199 };
200 
201 }
202 
203 #endif
204