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
47namespace PowerPoint7Struct
48{
50struct 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 }
59 bool isValid() const
60 {
61 return m_isMaster || m_inHandout || m_id!=0;
62 }
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 }
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 }
80 bool operator!=(SlideId const &id) const
81 {
82 return !operator==(id);
83 }
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 }
98 int m_id;
105};
107struct Zone {
110 {
111 for (auto &val : m_values) val=0;
112 }
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 }
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 }
135 int m_values[6];
136};
137}
138#endif
139// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
namespace used to define basic struct of a Microsoft PowerPoint 95 files (Windows)
Definition: PowerPoint7Graph.hxx:62
a slide id
Definition: PowerPoint7Struct.hxx:50
bool m_inHandout
a flag to know if the content is in the handout part
Definition: PowerPoint7Struct.hxx:104
bool isValid() const
returns true if the id is valid
Definition: PowerPoint7Struct.hxx:59
bool operator<(SlideId const &id) const
operator<
Definition: PowerPoint7Struct.hxx:64
bool m_isMaster
a flag to know if this is a master slide or a normal slide
Definition: PowerPoint7Struct.hxx:100
SlideId(unsigned long id=0)
Definition: PowerPoint7Struct.hxx:51
friend std::ostream & operator<<(std::ostream &o, SlideId const &id)
operator<<
Definition: PowerPoint7Struct.hxx:85
int m_id
the slide id
Definition: PowerPoint7Struct.hxx:98
bool m_inNotes
a flag to know if the content is in the notes part
Definition: PowerPoint7Struct.hxx:102
bool operator!=(SlideId const &id) const
operator==
Definition: PowerPoint7Struct.hxx:80
bool operator==(SlideId const &id) const
operator==
Definition: PowerPoint7Struct.hxx:72
a zone header of a PowerPoint7Parser
Definition: PowerPoint7Struct.hxx:107
int m_values[6]
some value
Definition: PowerPoint7Struct.hxx:135
std::string getName() const
returns a basic name
Definition: PowerPoint7Struct.hxx:116
Zone()
constructor
Definition: PowerPoint7Struct.hxx:109
int m_type
the type
Definition: PowerPoint7Struct.hxx:131
long m_dataSize
the data size
Definition: PowerPoint7Struct.hxx:133
friend std::ostream & operator<<(std::ostream &o, Zone const &z)
operator<<
Definition: PowerPoint7Struct.hxx:123
bool read(MWAWInputStreamPtr stream, long endPos=-1)
try to read a zone header
Definition: PowerPoint7Struct.cxx:38

Generated on Wed May 3 2023 07:18:29 for libmwaw by doxygen 1.9.6