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 28 #ifndef DOCUMENT_STATISTIC_HXX_INCLUDED 29 #define DOCUMENT_STATISTIC_HXX_INCLUDED 30 31 #include <utility> 32 #include <string> 33 #include <vector> 34 #include "internal/metainforeader.hxx" 35 36 37 //------------------------------------ 38 // 39 //------------------------------------ 40 41 struct statistic_item 42 { 43 statistic_item(); 44 45 statistic_item( 46 const std::wstring& title, 47 const std::wstring& value, 48 bool editable) : 49 title_(title), 50 value_(value), 51 editable_(editable) 52 {} 53 54 std::wstring title_; 55 std::wstring value_; 56 bool editable_; 57 }; 58 59 //------------------------------------ 60 // 61 //------------------------------------ 62 63 typedef std::vector<statistic_item> statistic_item_list_t; 64 typedef std::pair<std::wstring, statistic_item_list_t> statistic_group_t; 65 typedef std::vector<statistic_group_t> statistic_group_list_t; 66 67 //------------------------------------ 68 // 69 //------------------------------------ 70 71 class document_statistic_reader; 72 typedef std::auto_ptr<document_statistic_reader> document_statistic_reader_ptr; 73 74 document_statistic_reader_ptr create_document_statistic_reader(const std::string& document_name, CMetaInfoReader* meta_info_accessor); 75 76 //------------------------------------ 77 // 78 //------------------------------------ 79 80 class document_statistic_reader 81 { 82 public: 83 virtual ~document_statistic_reader(); 84 85 void read(statistic_group_list_t* group_list); 86 87 std::string get_document_name() const; 88 89 protected: 90 document_statistic_reader(const std::string& document_name, CMetaInfoReader* meta_info_accessor); 91 92 virtual void fill_description_section(CMetaInfoReader *meta_info_accessor,statistic_group_list_t* group_list) = 0; 93 94 virtual void fill_origin_section( CMetaInfoReader *meta_info_accessor,statistic_group_list_t* group_list); 95 96 private: 97 std::string document_name_; 98 CMetaInfoReader* meta_info_accessor_; 99 100 friend document_statistic_reader_ptr create_document_statistic_reader( 101 const std::string& document_name, CMetaInfoReader* meta_info_accessor); 102 }; 103 104 //------------------------------------ 105 // 106 //------------------------------------ 107 108 class writer_document_statistic_reader : public document_statistic_reader 109 { 110 protected: 111 writer_document_statistic_reader(const std::string& document_name, CMetaInfoReader* meta_info_accessor); 112 113 virtual void fill_description_section(CMetaInfoReader *meta_info_accessor, statistic_group_list_t* group_list); 114 115 friend document_statistic_reader_ptr create_document_statistic_reader( 116 const std::string& document_name, CMetaInfoReader* meta_info_accessor); 117 }; 118 119 //------------------------------------ 120 // 121 //------------------------------------ 122 123 class calc_document_statistic_reader : public document_statistic_reader 124 { 125 protected: 126 calc_document_statistic_reader(const std::string& document_name, CMetaInfoReader* meta_info_accessor); 127 128 virtual void fill_description_section( CMetaInfoReader *meta_info_accessor,statistic_group_list_t* group_list); 129 130 friend document_statistic_reader_ptr create_document_statistic_reader( 131 const std::string& document_name, CMetaInfoReader* meta_info_accessor); 132 }; 133 134 //------------------------------------ 135 // 136 //------------------------------------ 137 138 class draw_impress_math_document_statistic_reader : public document_statistic_reader 139 { 140 protected: 141 draw_impress_math_document_statistic_reader(const std::string& document_name, CMetaInfoReader* meta_info_accessor); 142 143 virtual void fill_description_section(CMetaInfoReader *meta_info_accessor, statistic_group_list_t* group_list); 144 145 friend document_statistic_reader_ptr create_document_statistic_reader( 146 const std::string& document_name, CMetaInfoReader* meta_info_accessor); 147 }; 148 149 #endif 150