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