update dev300-m58
[ooovba.git] / shell / source / win32 / shlxthandler / propsheets / document_statistic.cxx
blob2e8bdc5e3a98fc151f7550d426ecf6cf7383e267
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: document_statistic.cxx,v $
10 * $Revision: 1.7 $
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_shell.hxx"
34 #ifdef _MSC_VER
35 #pragma warning (disable : 4786 4503)
36 #endif
37 #include "document_statistic.hxx"
38 #include "internal/utilities.hxx"
39 #include "internal/metainforeader.hxx"
40 #include "internal/resource.h"
41 #include "internal/fileextensions.hxx"
42 #include "internal/config.hxx"
43 #include "internal/iso8601_converter.hxx"
45 //#####################################
46 const bool READONLY = false;
47 const bool WRITEABLE = true;
49 //#####################################
50 document_statistic_reader_ptr create_document_statistic_reader(const std::string& document_name, CMetaInfoReader* meta_info_accessor)
52 File_Type_t file_type = get_file_type(document_name);
54 if (WRITER == file_type)
55 return document_statistic_reader_ptr(new writer_document_statistic_reader(document_name, meta_info_accessor));
56 else if (CALC == file_type)
57 return document_statistic_reader_ptr(new calc_document_statistic_reader(document_name, meta_info_accessor));
58 else
59 return document_statistic_reader_ptr(new draw_impress_math_document_statistic_reader(document_name, meta_info_accessor));
63 //#####################################
64 document_statistic_reader::document_statistic_reader(const std::string& document_name, CMetaInfoReader* meta_info_accessor) :
65 document_name_(document_name),
66 meta_info_accessor_(meta_info_accessor)
69 //#####################################
70 document_statistic_reader::~document_statistic_reader()
73 //#####################################
74 void document_statistic_reader::read(statistic_group_list_t* group_list)
76 group_list->clear();
77 fill_description_section(meta_info_accessor_, group_list);
78 fill_origin_section(meta_info_accessor_, group_list);
81 //#####################################
82 std::string document_statistic_reader::get_document_name() const
84 return document_name_;
87 //#####################################
88 void document_statistic_reader::fill_origin_section(CMetaInfoReader *meta_info_accessor, statistic_group_list_t* group_list)
90 statistic_item_list_t il;
92 il.push_back(statistic_item(GetResString(IDS_AUTHOR), meta_info_accessor->getTagData( META_INFO_AUTHOR ), READONLY));
94 il.push_back(statistic_item(GetResString(IDS_MODIFIED),
95 iso8601_date_to_local_date(meta_info_accessor->getTagData(META_INFO_MODIFIED )), READONLY));
97 il.push_back(statistic_item(GetResString(IDS_DOCUMENT_NUMBER), meta_info_accessor->getTagData( META_INFO_DOCUMENT_NUMBER ), READONLY));
99 il.push_back(statistic_item(GetResString(IDS_EDITING_TIME),
100 iso8601_duration_to_local_duration(meta_info_accessor->getTagData( META_INFO_EDITING_TIME )), READONLY));
102 group_list->push_back(statistic_group_t(GetResString(IDS_ORIGIN), il));
105 //#####################################
106 writer_document_statistic_reader::writer_document_statistic_reader(const std::string& document_name, CMetaInfoReader* meta_info_accessor) :
107 document_statistic_reader(document_name, meta_info_accessor)
110 //#####################################
111 void writer_document_statistic_reader::fill_description_section(CMetaInfoReader *meta_info_accessor, statistic_group_list_t* group_list)
113 statistic_item_list_t il;
115 il.push_back(statistic_item(GetResString(IDS_TITLE), meta_info_accessor->getTagData( META_INFO_TITLE ), READONLY));
116 il.push_back(statistic_item(GetResString(IDS_COMMENTS), meta_info_accessor->getTagData( META_INFO_DESCRIPTION ), READONLY));
117 il.push_back(statistic_item(GetResString(IDS_SUBJECT), meta_info_accessor->getTagData( META_INFO_SUBJECT ), READONLY));
118 il.push_back(statistic_item(GetResString(IDS_KEYWORDS), meta_info_accessor->getTagData(META_INFO_KEYWORDS ), READONLY));
119 il.push_back(statistic_item(GetResString(IDS_PAGES), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_PAGES) , READONLY));
120 il.push_back(statistic_item(GetResString(IDS_TABLES), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_TABLES) , READONLY));
121 il.push_back(statistic_item(GetResString(IDS_GRAPHICS), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_DRAWS) , READONLY));
122 il.push_back(statistic_item(GetResString(IDS_OLE_OBJECTS), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_OBJECTS) , READONLY));
123 il.push_back(statistic_item(GetResString(IDS_PARAGRAPHS), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_PARAGRAPHS) , READONLY));
124 il.push_back(statistic_item(GetResString(IDS_WORDS), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_WORDS) , READONLY));
125 il.push_back(statistic_item(GetResString(IDS_CHARACTERS), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_CHARACTERS) , READONLY));
127 group_list->push_back(statistic_group_t(GetResString(IDS_DESCRIPTION), il));
130 //#######################################
131 calc_document_statistic_reader::calc_document_statistic_reader(
132 const std::string& document_name, CMetaInfoReader* meta_info_accessor) :
133 document_statistic_reader(document_name, meta_info_accessor)
136 //#######################################
137 void calc_document_statistic_reader::fill_description_section(
138 CMetaInfoReader *meta_info_accessor,statistic_group_list_t* group_list)
140 statistic_item_list_t il;
142 il.push_back(statistic_item(GetResString(IDS_TITLE), meta_info_accessor->getTagData( META_INFO_TITLE ), READONLY));
143 il.push_back(statistic_item(GetResString(IDS_COMMENTS), meta_info_accessor->getTagData( META_INFO_DESCRIPTION ), READONLY));
144 il.push_back(statistic_item(GetResString(IDS_SUBJECT), meta_info_accessor->getTagData( META_INFO_SUBJECT ), READONLY));
145 il.push_back(statistic_item(GetResString(IDS_KEYWORDS), meta_info_accessor->getTagData(META_INFO_KEYWORDS ), READONLY));
146 il.push_back(statistic_item(GetResString(IDS_TABLES), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_TABLES) , READONLY));
147 il.push_back(statistic_item(GetResString(IDS_CELLS), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_CELLS) , READONLY));
148 il.push_back(statistic_item(GetResString(IDS_OLE_OBJECTS), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_OBJECTS) , READONLY));
150 group_list->push_back(statistic_group_t(GetResString(IDS_DESCRIPTION), il));
153 //#######################################
154 draw_impress_math_document_statistic_reader::draw_impress_math_document_statistic_reader(
155 const std::string& document_name, CMetaInfoReader* meta_info_accessor) :
156 document_statistic_reader(document_name, meta_info_accessor)
159 //#######################################
160 void draw_impress_math_document_statistic_reader::fill_description_section(
161 CMetaInfoReader *meta_info_accessor, statistic_group_list_t* group_list)
163 statistic_item_list_t il;
165 il.push_back(statistic_item(GetResString(IDS_TITLE), meta_info_accessor->getTagData( META_INFO_TITLE ), READONLY));
166 il.push_back(statistic_item(GetResString(IDS_COMMENTS), meta_info_accessor->getTagData( META_INFO_DESCRIPTION ), READONLY));
167 il.push_back(statistic_item(GetResString(IDS_SUBJECT), meta_info_accessor->getTagData( META_INFO_SUBJECT ), READONLY));
168 il.push_back(statistic_item(GetResString(IDS_KEYWORDS), meta_info_accessor->getTagData(META_INFO_KEYWORDS ), READONLY));
169 il.push_back(statistic_item(GetResString(IDS_PAGES), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_PAGES) , READONLY));
170 il.push_back(statistic_item(GetResString(IDS_OLE_OBJECTS), meta_info_accessor->getTagAttribute( META_INFO_DOCUMENT_STATISTIC,META_INFO_OBJECTS) , READONLY));
172 group_list->push_back(statistic_group_t(GetResString(IDS_DESCRIPTION), il));