PowerPoint7Struct.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3/* libmwaw
4* Version: MPL 2.0 / LGPLv2+
5*
6* The contents of this file are subject to the Mozilla Public License Version
7* 2.0 (the "License"); you may not use this file except in compliance with
8* the License or as specified alternatively below. You may obtain a copy of
9* the License at http://www.mozilla.org/MPL/
10*
11* Software distributed under the License is distributed on an "AS IS" basis,
12* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13* for the specific language governing rights and limitations under the
14* License.
15*
16* Major Contributor(s):
17* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20* Copyright (C) 2006, 2007 Andrew Ziem
21* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22*
23*
24* All Rights Reserved.
25*
26* For minor contributions see the git repository.
27*
28* Alternatively, the contents of this file may be used under the terms of
29* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30* in which case the provisions of the LGPLv2+ are applicable
31* instead of those above.
32*/
33
34#ifndef POWER_POINT7_STRUCT
35# define POWER_POINT7_STRUCT
36
37#include <string>
38#include <sstream>
39
40#include "libmwaw_internal.hxx"
41
42#include "MWAWDebug.hxx"
43#include "MWAWInputStream.hxx"
44
47 namespace PowerPoint7Struct
48{
50 struct SlideId {
51 explicit SlideId(unsigned long id=0)
52 : m_id(int(id&0x7fffffffL))
53 , m_isMaster((id&0x80000000L) ? true : false)
54 , m_inNotes(false)
55 , m_inHandout(false)
56 {
57 }
58
59 bool isValid() const
60 {
61 return m_isMaster || m_inHandout || m_id!=0;
62 }
63
64 bool operator<(SlideId const &id) const
65 {
66 if (m_isMaster!=id.m_isMaster) return m_isMaster;
67 if (m_inNotes!=id.m_inNotes) return m_inNotes;
68 if (m_inHandout!=id.m_inHandout) return m_inHandout;
69 return m_id < id.m_id;
70 }
71
72 bool operator==(SlideId const &id) const
73 {
74 if (m_isMaster!=id.m_isMaster) return false;
75 if (m_inNotes!=id.m_inNotes) return false;
76 if (m_inHandout!=id.m_inHandout) return false;
77 return m_id == id.m_id;
78 }
79
80 bool operator!=(SlideId const &id) const
81 {
82 return !operator==(id);
83 }
84
85 friend std::ostream &operator<<(std::ostream &o, SlideId const &id)
86 {
87 if (id.m_isMaster)
88 o << "MS" << id.m_id;
89 else if (id.m_id)
90 o << "S" << id.m_id;
91 if (id.m_inNotes)
92 o << "[note]";
93 if (id.m_inHandout)
94 o << "Handout";
95 return o;
96 }
97
98 int m_id;
100 bool m_isMaster;
102 bool m_inNotes;
104 bool m_inHandout;
105};
106
107 struct Zone {
109 Zone() : m_type(0), m_dataSize(0)
110 {
111 for (auto &val : m_values) val=0;
112 }
113
114 bool read(MWAWInputStreamPtr stream, long endPos=-1);
116 std::string getName() const
117 {
118 std::stringstream s;
119 s << "Zone" << std::hex << m_type << std::dec << "A";
120 return s.str();
121 }
122
123 friend std::ostream &operator<<(std::ostream &o, Zone const &z)
124 {
125 for (int i=0; i<6; ++i) {
126 if (z.m_values[i]) o << "z" << i << "=" << z.m_values[i] << ",";
127 }
128 return o;
129 }
130
131 int m_type;
133 long m_dataSize;
135 int m_values[6];
136};
137}
138#endif
139// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWInputStream.hxx
libmwaw_internal.hxx
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
PowerPoint7Struct
namespace used to define basic struct of a Microsoft PowerPoint 95 files (Windows)
Definition PowerPoint7Graph.hxx:62
PowerPoint7Struct::SlideId::m_inHandout
bool m_inHandout
a flag to know if the content is in the handout part
Definition PowerPoint7Struct.hxx:104
PowerPoint7Struct::SlideId::isValid
bool isValid() const
returns true if the id is valid
Definition PowerPoint7Struct.hxx:59
PowerPoint7Struct::SlideId::operator<
bool operator<(SlideId const &id) const
operator<
Definition PowerPoint7Struct.hxx:64
PowerPoint7Struct::SlideId::m_isMaster
bool m_isMaster
a flag to know if this is a master slide or a normal slide
Definition PowerPoint7Struct.hxx:100
PowerPoint7Struct::SlideId::SlideId
SlideId(unsigned long id=0)
Definition PowerPoint7Struct.hxx:51
PowerPoint7Struct::SlideId::operator<<
friend std::ostream & operator<<(std::ostream &o, SlideId const &id)
operator<<
Definition PowerPoint7Struct.hxx:85
PowerPoint7Struct::SlideId::m_id
int m_id
the slide id
Definition PowerPoint7Struct.hxx:98
PowerPoint7Struct::SlideId::m_inNotes
bool m_inNotes
a flag to know if the content is in the notes part
Definition PowerPoint7Struct.hxx:102
PowerPoint7Struct::SlideId::operator!=
bool operator!=(SlideId const &id) const
operator==
Definition PowerPoint7Struct.hxx:80
PowerPoint7Struct::SlideId::operator==
bool operator==(SlideId const &id) const
operator==
Definition PowerPoint7Struct.hxx:72
PowerPoint7Struct::Zone::m_values
int m_values[6]
some value
Definition PowerPoint7Struct.hxx:135
PowerPoint7Struct::Zone::getName
std::string getName() const
returns a basic name
Definition PowerPoint7Struct.hxx:116
PowerPoint7Struct::Zone::Zone
Zone()
constructor
Definition PowerPoint7Struct.hxx:109
PowerPoint7Struct::Zone::m_type
int m_type
the type
Definition PowerPoint7Struct.hxx:131
PowerPoint7Struct::Zone::m_dataSize
long m_dataSize
the data size
Definition PowerPoint7Struct.hxx:133
PowerPoint7Struct::Zone::operator<<
friend std::ostream & operator<<(std::ostream &o, Zone const &z)
operator<<
Definition PowerPoint7Struct.hxx:123
PowerPoint7Struct::Zone::read
bool read(MWAWInputStreamPtr stream, long endPos=-1)
try to read a zone header
Definition PowerPoint7Struct.cxx:38