libstaroffice_internal.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libstaroffice
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
#ifndef LIBSTAROFFICE_INTERNAL_H
#define LIBSTAROFFICE_INTERNAL_H
#include <assert.h>
#include <math.h>
#ifdef DEBUG
#include <stdio.h>
#endif
#include <cmath>
#include <limits>
#include <map>
#include <memory>
#include <ostream>
#include <string>
#include <vector>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include <librevenge-stream/librevenge-stream.h>
#include <librevenge/librevenge.h>
#if defined(_MSC_VER) || defined(__DJGPP__)
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef unsigned __int64 uint64_t;
typedef __int64 int64_t;
#else /* !_MSC_VER && !__DJGPP__*/
# ifdef HAVE_CONFIG_H
# include <config.h>
# ifdef HAVE_STDINT_H
# include <stdint.h>
# endif
# ifdef HAVE_INTTYPES_H
# include <inttypes.h>
# endif
# else
// assume that the headers are there inside LibreOffice build when no HAVE_CONFIG_H is defined
# include <stdint.h>
# include <inttypes.h>
# endif
#endif /* _MSC_VER || __DJGPP__ */
// define gmtime_r and localtime_r on Windows, so that can use
// thread-safe functions on other environments
#ifdef _WIN32
# define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
# define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
#endif
template <class T>
struct STOFF_shared_ptr_noop_deleter {
void operator()(T *) {}
};
#if defined(HAVE_CLANG_ATTRIBUTE_FALLTHROUGH)
# define STOFF_FALLTHROUGH [[clang::fallthrough]]
#elif defined(HAVE_GCC_ATTRIBUTE_FALLTHROUGH)
# define STOFF_FALLTHROUGH __attribute__((fallthrough))
#else
# define STOFF_FALLTHROUGH ((void) 0)
#endif
#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
# define LIBSTOFF_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
#else
# define LIBSTOFF_ATTRIBUTE_PRINTF(fmt, arg)
#endif
#define STOFF_N_ELEMENTS(m) sizeof(m)/sizeof(m[0])
/* ---------- debug --------------- */
#ifdef DEBUG
namespace libstoff
{
void printDebugMsg(const char *format, ...) LIBSTOFF_ATTRIBUTE_PRINTF(1,2);
}
#define STOFF_DEBUG_MSG(M) libstoff::printDebugMsg M
#else
#define STOFF_DEBUG_MSG(M)
#endif
namespace libstoff
{
// Various exceptions:
class VersionException
{
};
class FileException
{
};
class ParseException
{
};
class GenericException
{
};
class WrongPasswordException
{
};
}
/* ---------- input ----------------- */
namespace libstoff
{
uint8_t readU8(librevenge::RVNGInputStream *input);
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
librevenge::RVNGString getString(std::vector<uint32_t> const &unicode);
template<typename T>
bool checkAddOverflow(T x, T y)
{
return (x < 0 && y < std::numeric_limits<T>::lowest() - x)
|| (x > 0 && y > std::numeric_limits<T>::max() - x);
}
}
/* ---------- small enum/class ------------- */
namespace libstoff
{
enum Position { Left = 0, Right = 1, Top = 2, Bottom = 3, HMiddle = 4, VMiddle = 5 };
enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08, HMiddleBit = 0x10, VMiddleBit = 0x20 };
enum NumberingType { NONE, BULLET, ARABIC, LOWERCASE, UPPERCASE, LOWERCASE_ROMAN, UPPERCASE_ROMAN };
std::string numberingTypeToString(NumberingType type);
std::string numberingValueToString(NumberingType type, int value);
enum SubDocumentType { DOC_NONE, DOC_CHART, DOC_CHART_ZONE, DOC_COMMENT_ANNOTATION, DOC_GRAPHIC_GROUP, DOC_HEADER_FOOTER_REGION, DOC_NOTE, DOC_SHEET, DOC_TABLE, DOC_TEXT_BOX };
}
struct STOFFColor {
explicit STOFFColor(uint32_t argb=0) : m_value(argb)
{
}
STOFFColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) :
m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
{
}
STOFFColor &operator=(uint32_t argb)
{
m_value = argb;
return *this;
}
static STOFFColor colorFromCMYK(unsigned char c, unsigned char m, unsigned char y, unsigned char k)
{
double w=1.-double(k)/255.;
return STOFFColor
(static_cast<unsigned char>(255 * (1-double(c)/255) * w),
static_cast<unsigned char>(255 * (1-double(m)/255) * w),
static_cast<unsigned char>(255 * (1-double(y)/255) * w)
);
}
static STOFFColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L)
{
double c=(1-((L>=128) ? (2*double(L)-255) : (255-2*double(L)))/255)*
double(S)/255;
double tmp=std::fmod((double(H)*6/255),2)-1;
double x=c*(1-(tmp>0 ? tmp : -tmp));
auto C=static_cast<unsigned char>(255*c);
auto M=static_cast<unsigned char>(double(L)-255*c/2);
auto X=static_cast<unsigned char>(255*x);
if (H<=42) return STOFFColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M));
if (H<=85) return STOFFColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M));
if (H<=127) return STOFFColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X));
if (H<=170) return STOFFColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C));
if (H<=212) return STOFFColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M),static_cast<unsigned char>(M+C));
return STOFFColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M),static_cast<unsigned char>(M+X));
}
static STOFFColor black()
{
return STOFFColor(0,0,0);
}
static STOFFColor white()
{
return STOFFColor(255,255,255);
}
static STOFFColor barycenter(float alpha, STOFFColor const &colA,
float beta, STOFFColor const &colB);
uint32_t value() const
{
return m_value;
}
unsigned char getAlpha() const
{
return static_cast<unsigned char>((m_value>>24)&0xFF);
}
void setAlpha(unsigned char alpha)
{
m_value=(m_value&0xFFFFFF)|uint32_t(alpha<<24);
}
unsigned char getBlue() const
{
return static_cast<unsigned char>(m_value&0xFF);
}
unsigned char getRed() const
{
return static_cast<unsigned char>((m_value>>16)&0xFF);
}
unsigned char getGreen() const
{
return static_cast<unsigned char>((m_value>>8)&0xFF);
}
bool isBlack() const
{
return (m_value&0xFFFFFF)==0;
}
bool isWhite() const
{
return (m_value&0xFFFFFF)==0xFFFFFF;
}
bool operator==(STOFFColor const &c) const
{
return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
}
bool operator!=(STOFFColor const &c) const
{
return !operator==(c);
}
bool operator<(STOFFColor const &c) const
{
return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
}
bool operator<=(STOFFColor const &c) const
{
return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
}
bool operator>(STOFFColor const &c) const
{
return !operator<=(c);
}
bool operator>=(STOFFColor const &c) const
{
return !operator<(c);
}
friend std::ostream &operator<< (std::ostream &o, STOFFColor const &c);
std::string str() const;
protected:
uint32_t m_value;
};
struct STOFFBorderLine {
STOFFBorderLine() : m_outWidth(0), m_inWidth(0), m_color(STOFFColor::black()), m_distance(0) { }
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
bool isEmpty() const
{
return m_outWidth==0 && m_inWidth==0;
}
bool operator==(STOFFBorderLine const &orig) const
{
return !operator!=(orig);
}
bool operator!=(STOFFBorderLine const &orig) const
{
return m_outWidth != orig.m_outWidth || m_inWidth != orig.m_inWidth ||
m_distance != orig.m_distance || m_color != orig.m_color;
}
friend std::ostream &operator<< (std::ostream &o, STOFFBorderLine const &border);
int m_outWidth;
int m_inWidth;
STOFFColor m_color;
int m_distance;
};
struct STOFFField {
STOFFField() : m_propertyList()
{
}
void addTo(librevenge::RVNGPropertyList &propList) const;
librevenge::RVNGPropertyList m_propertyList;
};
struct STOFFLink {
STOFFLink() : m_HRef("")
{
}
bool addTo(librevenge::RVNGPropertyList &propList) const;
std::string m_HRef;
};
struct STOFFNote {
enum Type { FootNote, EndNote };
explicit STOFFNote(Type type) : m_type(type), m_label(""), m_number(-1)
{
}
Type m_type;
librevenge::RVNGString m_label;
int m_number;
};
struct STOFFEmbeddedObject {
STOFFEmbeddedObject() : m_dataList(), m_typeList(), m_filenameLink("")
{
}
STOFFEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
std::string const &type="image/pict") : m_dataList(), m_typeList(), m_filenameLink("")
{
add(binaryData, type);
}
STOFFEmbeddedObject(STOFFEmbeddedObject const &)=default;
STOFFEmbeddedObject(STOFFEmbeddedObject &&)=default;
STOFFEmbeddedObject &operator=(STOFFEmbeddedObject const &)=default;
STOFFEmbeddedObject &operator=(STOFFEmbeddedObject &&)=default;
~STOFFEmbeddedObject();
bool isEmpty() const
{
if (!m_filenameLink.empty())
return false;
for (const auto &i : m_dataList) {
if (!i.empty())
return false;
}
return true;
}
void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
{
size_t pos=m_dataList.size();
if (pos<m_typeList.size()) pos=m_typeList.size();
m_dataList.resize(pos+1);
m_dataList[pos]=binaryData;
m_typeList.resize(pos+1);
m_typeList[pos]=type;
}
bool addTo(librevenge::RVNGPropertyList &propList) const;
bool addAsFillImageTo(librevenge::RVNGPropertyList &propList) const;
friend std::ostream &operator<<(std::ostream &o, STOFFEmbeddedObject const &pict);
int cmp(STOFFEmbeddedObject const &pict) const;
std::vector<librevenge::RVNGBinaryData> m_dataList;
std::vector<std::string> m_typeList;
librevenge::RVNGString m_filenameLink;
};
// forward declarations of basic classes and smart pointers
class STOFFFont;
class STOFFFrameStyle;
class STOFFGraphicShape;
class STOFFGraphicStyle;
class STOFFList;
class STOFFParagraph;
class STOFFSection;
class STOFFPageSpan;
class STOFFEntry;
class STOFFHeader;
class STOFFParser;
class STOFFPosition;
class STOFFGraphicListener;
class STOFFInputStream;
class STOFFListener;
class STOFFListManager;
class STOFFParserState;
class STOFFSpreadsheetListener;
class STOFFSubDocument;
class STOFFTextListener;
typedef std::shared_ptr<STOFFGraphicListener> STOFFGraphicListenerPtr;
typedef std::shared_ptr<STOFFInputStream> STOFFInputStreamPtr;
typedef std::shared_ptr<STOFFListener> STOFFListenerPtr;
typedef std::shared_ptr<STOFFListManager> STOFFListManagerPtr;
typedef std::shared_ptr<STOFFParserState> STOFFParserStatePtr;
typedef std::shared_ptr<STOFFSpreadsheetListener> STOFFSpreadsheetListenerPtr;
typedef std::shared_ptr<STOFFSubDocument> STOFFSubDocumentPtr;
typedef std::shared_ptr<STOFFTextListener> STOFFTextListenerPtr;
template <class T> struct STOFFVariable {
STOFFVariable() : m_data(), m_set(false) {}
explicit STOFFVariable(T const &def) : m_data(def), m_set(false) {}
STOFFVariable(STOFFVariable const &orig) : m_data(orig.m_data), m_set(orig.m_set) {}
STOFFVariable &operator=(STOFFVariable const &orig)
{
if (this != &orig) {
m_data = orig.m_data;
m_set = orig.m_set;
}
return std::forward<STOFFVariable &>(*this);
}
STOFFVariable &operator=(T const &val)
{
m_data = val;
m_set = true;
return std::forward<STOFFVariable &>(*this);
}
void insert(STOFFVariable const &orig)
{
if (orig.m_set) {
m_data = orig.m_data;
m_set = orig.m_set;
}
}
T const *operator->() const
{
return &m_data;
}
T *operator->()
{
m_set = true;
return &m_data;
}
T const &operator*() const
{
return m_data;
}
T &operator*()
{
m_set = true;
return m_data;
}
T const &get() const
{
return m_data;
}
bool isSet() const
{
return m_set;
}
void setSet(bool newVal)
{
m_set=newVal;
}
protected:
T m_data;
bool m_set;
};
/* ---------- vec2/box2f ------------- */
template <class T> class STOFFVec2
{
public:
STOFFVec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
template <class U> STOFFVec2(STOFFVec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
T x() const
{
return m_x;
}
T y() const
{
return m_y;
}
T operator[](int c) const
{
if (c<0 || c>1) throw libstoff::GenericException();
return (c==0) ? m_x : m_y;
}
T &operator[](int c)
{
if (c<0 || c>1) throw libstoff::GenericException();
return (c==0) ? m_x : m_y;
}
void set(T xx, T yy)
{
m_x = xx;
m_y = yy;
}
void setX(T xx)
{
m_x = xx;
}
void setY(T yy)
{
m_y = yy;
}
void add(T dx, T dy)
{
if (libstoff::checkAddOverflow(m_x, dx) || libstoff::checkAddOverflow(m_y, dy))
throw libstoff::GenericException();
m_x += dx;
m_y += dy;
}
STOFFVec2<T> &operator+=(STOFFVec2<T> const &p)
{
add(p.m_x, p.m_y);
return *this;
}
STOFFVec2<T> &operator-=(STOFFVec2<T> const &p)
{
// check if negation of either of the coords will cause overflow
const T diff = std::numeric_limits<T>::min() + std::numeric_limits<T>::max();
if (libstoff::checkAddOverflow(p.m_x, diff) || libstoff::checkAddOverflow(p.m_y, diff))
throw libstoff::GenericException();
add(-p.m_x, -p.m_y);
return *this;
}
template <class U>
STOFFVec2<T> &operator*=(U scale)
{
m_x = T(m_x*scale);
m_y = T(m_y*scale);
return *this;
}
friend STOFFVec2<T> operator+(STOFFVec2<T> const &p1, STOFFVec2<T> const &p2)
{
STOFFVec2<T> p(p1);
return p+=p2;
}
friend STOFFVec2<T> operator-(STOFFVec2<T> const &p1, STOFFVec2<T> const &p2)
{
STOFFVec2<T> p(p1);
return p-=p2;
}
template <class U>
friend STOFFVec2<T> operator*(U scale, STOFFVec2<T> const &p1)
{
STOFFVec2<T> p(p1);
return p *= scale;
}
bool operator==(STOFFVec2<T> const &p) const
{
return cmpY(p) == 0;
}
bool operator!=(STOFFVec2<T> const &p) const
{
return cmpY(p) != 0;
}
bool operator<(STOFFVec2<T> const &p) const
{
return cmpY(p) < 0;
}
int cmp(STOFFVec2<T> const &p) const
{
if (m_x < p.m_x) return -1;
if (m_x > p.m_x) return 1;
if (m_y < p.m_y) return -1;
if (m_y > p.m_y) return 1;
return 0;
}
int cmpY(STOFFVec2<T> const &p) const
{
if (m_y < p.m_y) return -1;
if (m_y > p.m_y) return 1;
if (m_x < p.m_x) return -1;
if (m_x > p.m_x) return 1;
return 0;
}
friend std::ostream &operator<< (std::ostream &o, STOFFVec2<T> const &f)
{
o << f.m_x << "x" << f.m_y;
return o;
}
struct PosSizeLtX {
bool operator()(STOFFVec2<T> const &s1, STOFFVec2<T> const &s2) const
{
return s1.cmp(s2) < 0;
}
};
typedef std::map<STOFFVec2<T>, T,struct PosSizeLtX> MapX;
struct PosSizeLtY {
bool operator()(STOFFVec2<T> const &s1, STOFFVec2<T> const &s2) const
{
return s1.cmpY(s2) < 0;
}
};
typedef std::map<STOFFVec2<T>, T,struct PosSizeLtY> MapY;
protected:
T m_x, m_y;
};
typedef STOFFVec2<bool> STOFFVec2b;
typedef STOFFVec2<int> STOFFVec2i;
typedef STOFFVec2<long> STOFFVec2l;
typedef STOFFVec2<float> STOFFVec2f;
template <class T> class STOFFVec3
{
public:
STOFFVec3(T xx=0,T yy=0,T zz=0)
{
m_val[0] = xx;
m_val[1] = yy;
m_val[2] = zz;
}
template <class U> STOFFVec3(STOFFVec3<U> const &p)
{
for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
}
T x() const
{
return m_val[0];
}
T y() const
{
return m_val[1];
}
T z() const
{
return m_val[2];
}
T operator[](int c) const
{
if (c<0 || c>2) throw libstoff::GenericException();
return m_val[c];
}
T &operator[](int c)
{
if (c<0 || c>2) throw libstoff::GenericException();
return m_val[c];
}
void set(T xx, T yy, T zz)
{
m_val[0] = xx;
m_val[1] = yy;
m_val[2] = zz;
}
void setX(T xx)
{
m_val[0] = xx;
}
void setY(T yy)
{
m_val[1] = yy;
}
void setZ(T zz)
{
m_val[2] = zz;
}
void add(T dx, T dy, T dz)
{
m_val[0] += dx;
m_val[1] += dy;
m_val[2] += dz;
}
STOFFVec3<T> &operator+=(STOFFVec3<T> const &p)
{
for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
return *this;
}
STOFFVec3<T> &operator-=(STOFFVec3<T> const &p)
{
for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
return *this;
}
template <class U>
STOFFVec3<T> &operator*=(U scale)
{
for (auto &c : m_val) c = T(c*scale);
return *this;
}
friend STOFFVec3<T> operator+(STOFFVec3<T> const &p1, STOFFVec3<T> const &p2)
{
STOFFVec3<T> p(p1);
return p+=p2;
}
friend STOFFVec3<T> operator-(STOFFVec3<T> const &p1, STOFFVec3<T> const &p2)
{
STOFFVec3<T> p(p1);
return p-=p2;
}
template <class U>
friend STOFFVec3<T> operator*(U scale, STOFFVec3<T> const &p1)
{
STOFFVec3<T> p(p1);
return p *= scale;
}
bool operator==(STOFFVec3<T> const &p) const
{
return cmp(p) == 0;
}
bool operator!=(STOFFVec3<T> const &p) const
{
return cmp(p) != 0;
}
bool operator<(STOFFVec3<T> const &p) const
{
return cmp(p) < 0;
}
int cmp(STOFFVec3<T> const &p) const
{
for (int c = 0; c < 3; c++) {
if (m_val[c]<p.m_val[c]) return -1;
if (m_val[c]>p.m_val[c]) return 1;
}
return 0;
}
friend std::ostream &operator<< (std::ostream &o, STOFFVec3<T> const &f)
{
o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
return o;
}
struct PosSizeLt {
bool operator()(STOFFVec3<T> const &s1, STOFFVec3<T> const &s2) const
{
return s1.cmp(s2) < 0;
}
};
typedef std::map<STOFFVec3<T>, T,struct PosSizeLt> Map;
protected:
T m_val[3];
};
typedef STOFFVec3<bool> STOFFVec3b;
typedef STOFFVec3<unsigned char> STOFFVec3uc;
typedef STOFFVec3<int> STOFFVec3i;
typedef STOFFVec3<float> STOFFVec3f;
template <class T> class STOFFBox2
{
public:
STOFFBox2(STOFFVec2<T> minPt=STOFFVec2<T>(), STOFFVec2<T> maxPt=STOFFVec2<T>())
{
m_pt[0] = minPt;
m_pt[1] = maxPt;
}
template <class U> STOFFBox2(STOFFBox2<U> const &p)
{
for (int c=0; c < 2; c++) m_pt[c] = p[c];
}
STOFFVec2<T> const &min() const
{
return m_pt[0];
}
STOFFVec2<T> const &max() const
{
return m_pt[1];
}
STOFFVec2<T> &min()
{
return m_pt[0];
}
STOFFVec2<T> &max()
{
return m_pt[1];
}
STOFFVec2<T> const &operator[](int c) const
{
if (c<0 || c>1) throw libstoff::GenericException();
return m_pt[c];
}
STOFFVec2<T> size() const
{
return m_pt[1]-m_pt[0];
}
STOFFVec2<T> center() const
{
return STOFFVec2<T>((m_pt[0].x()+m_pt[1].x())/2,
(m_pt[0].y()+m_pt[1].y())/2);
}
void set(STOFFVec2<T> const &x, STOFFVec2<T> const &y)
{
m_pt[0] = x;
m_pt[1] = y;
}
void setMin(STOFFVec2<T> const &x)
{
m_pt[0] = x;
}
void setMax(STOFFVec2<T> const &y)
{
m_pt[1] = y;
}
void resizeFromMin(STOFFVec2<T> const &sz)
{
m_pt[1] = m_pt[0]+sz;
}
void resizeFromMax(STOFFVec2<T> const &sz)
{
m_pt[0] = m_pt[1]-sz;
}
void resizeFromCenter(STOFFVec2<T> const &sz)
{
STOFFVec2<T> centerPt = 0.5*(m_pt[0]+m_pt[1]);
m_pt[0] = centerPt - 0.5*sz;
m_pt[1] = centerPt + (sz - 0.5*sz);
}
template <class U> void scale(U factor)
{
m_pt[0] *= factor;
m_pt[1] *= factor;
}
void extend(T val)
{
m_pt[0] -= STOFFVec2<T>(val/2,val/2);
m_pt[1] += STOFFVec2<T>(val-(val/2),val-(val/2));
}
STOFFBox2<T> getUnion(STOFFBox2<T> const &box) const
{
STOFFBox2<T> res;
res.m_pt[0]=STOFFVec2<T>(m_pt[0][0]<box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
m_pt[0][1]<box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
res.m_pt[1]=STOFFVec2<T>(m_pt[1][0]>box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
m_pt[1][1]>box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
return res;
}
STOFFBox2<T> getIntersection(STOFFBox2<T> const &box) const
{
STOFFBox2<T> res;
res.m_pt[0]=STOFFVec2<T>(m_pt[0][0]>box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
m_pt[0][1]>box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
res.m_pt[1]=STOFFVec2<T>(m_pt[1][0]<box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
m_pt[1][1]<box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
return res;
}
bool operator==(STOFFBox2<T> const &p) const
{
return cmp(p) == 0;
}
bool operator!=(STOFFBox2<T> const &p) const
{
return cmp(p) != 0;
}
bool operator<(STOFFBox2<T> const &p) const
{
return cmp(p) < 0;
}
int cmp(STOFFBox2<T> const &p) const
{
int diff = m_pt[0].cmpY(p.m_pt[0]);
if (diff) return diff;
diff = m_pt[1].cmpY(p.m_pt[1]);
if (diff) return diff;
return 0;
}
friend std::ostream &operator<< (std::ostream &o, STOFFBox2<T> const &f)
{
o << "(" << f.m_pt[0] << "<->" << f.m_pt[1] << ")";
return o;
}
struct PosSizeLt {
bool operator()(STOFFBox2<T> const &s1, STOFFBox2<T> const &s2) const
{
return s1.cmp(s2) < 0;
}
};
typedef std::map<STOFFBox2<T>, T,struct PosSizeLt> Map;
protected:
STOFFVec2<T> m_pt[2];
};
typedef STOFFBox2<int> STOFFBox2i;
typedef STOFFBox2<float> STOFFBox2f;
typedef STOFFBox2<long> STOFFBox2l;
namespace libstoff
{
bool convertToDateTime(uint32_t date, uint32_t time, std::string &dateTime);
void splitString(librevenge::RVNGString const &string, librevenge::RVNGString const &delim,
librevenge::RVNGString &string1, librevenge::RVNGString &string2);
librevenge::RVNGString simplifyString(librevenge::RVNGString const &s);
std::string getCellName(STOFFVec2i const &cellPos, STOFFVec2b const &relative=STOFFVec2b(true,true));
// some geometrical function
float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest);
STOFFVec2f rotatePointAroundCenter(STOFFVec2f const &point, STOFFVec2f const &center, float angle);
STOFFBox2f rotateBoxFromCenter(STOFFBox2f const &box, float angle);
}
#endif /* LIBSTAROFFICE_INTERNAL_H */
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
STOFFBox2
small class which defines a 2D Box
Definition libstaroffice_internal.hxx:956
STOFFBox2::resizeFromMin
void resizeFromMin(STOFFVec2< T > const &sz)
resize the box keeping the minimum
Definition libstaroffice_internal.hxx:1028
STOFFBox2::extend
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition libstaroffice_internal.hxx:1053
STOFFBox2::getIntersection
STOFFBox2< T > getIntersection(STOFFBox2< T > const &box) const
returns the intersection between this and box
Definition libstaroffice_internal.hxx:1070
STOFFBox2::min
STOFFVec2< T > & min()
the minimum 2D point (in x and in y)
Definition libstaroffice_internal.hxx:981
STOFFBox2::STOFFBox2
STOFFBox2(STOFFBox2< U > const &p)
generic constructor
Definition libstaroffice_internal.hxx:965
STOFFBox2::operator[]
STOFFVec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition libstaroffice_internal.hxx:993
STOFFBox2::set
void set(STOFFVec2< T > const &x, STOFFVec2< T > const &y)
resets the data to minimum x and maximum y
Definition libstaroffice_internal.hxx:1011
STOFFBox2::operator<
bool operator<(STOFFBox2< T > const &p) const
comparison operator< : fist sorts min by Y,X values then max extremity
Definition libstaroffice_internal.hxx:1090
STOFFBox2::min
STOFFVec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition libstaroffice_internal.hxx:971
STOFFBox2::setMin
void setMin(STOFFVec2< T > const &x)
resets the minimum point
Definition libstaroffice_internal.hxx:1017
STOFFBox2::setMax
void setMax(STOFFVec2< T > const &y)
resets the maximum point
Definition libstaroffice_internal.hxx:1022
STOFFBox2::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFBox2< T > const &f)
print data in form X0xY0<->X1xY1
Definition libstaroffice_internal.hxx:1106
STOFFBox2::size
STOFFVec2< T > size() const
the box size
Definition libstaroffice_internal.hxx:999
STOFFBox2::STOFFBox2
STOFFBox2(STOFFVec2< T > minPt=STOFFVec2< T >(), STOFFVec2< T > maxPt=STOFFVec2< T >())
constructor
Definition libstaroffice_internal.hxx:959
STOFFBox2< int >::m_pt
STOFFVec2< int > m_pt[2]
Definition libstaroffice_internal.hxx:1129
STOFFBox2::scale
void scale(U factor)
scales all points of the box by factor
Definition libstaroffice_internal.hxx:1046
STOFFBox2::cmp
int cmp(STOFFBox2< T > const &p) const
comparison function : fist sorts min by Y,X values then max extremity
Definition libstaroffice_internal.hxx:1096
STOFFBox2::resizeFromCenter
void resizeFromCenter(STOFFVec2< T > const &sz)
resize the box keeping the center
Definition libstaroffice_internal.hxx:1038
STOFFBox2::operator==
bool operator==(STOFFBox2< T > const &p) const
comparison operator==
Definition libstaroffice_internal.hxx:1080
STOFFBox2::resizeFromMax
void resizeFromMax(STOFFVec2< T > const &sz)
resize the box keeping the maximum
Definition libstaroffice_internal.hxx:1033
STOFFBox2::center
STOFFVec2< T > center() const
the box center
Definition libstaroffice_internal.hxx:1004
STOFFBox2::max
STOFFVec2< T > & max()
the maximum 2D point (in x and in y)
Definition libstaroffice_internal.hxx:986
STOFFBox2::operator!=
bool operator!=(STOFFBox2< T > const &p) const
comparison operator!=
Definition libstaroffice_internal.hxx:1085
STOFFBox2::max
STOFFVec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition libstaroffice_internal.hxx:976
STOFFBox2::getUnion
STOFFBox2< T > getUnion(STOFFBox2< T > const &box) const
returns the union between this and box
Definition libstaroffice_internal.hxx:1060
STOFFBox2::Map
std::map< STOFFBox2< T >, T, struct PosSizeLt > Map
map of STOFFBox2
Definition libstaroffice_internal.hxx:1125
STOFFEntry
basic class to store an entry in a file This contained :
Definition STOFFEntry.hxx:47
STOFFFont
Class to store font.
Definition STOFFFont.hxx:44
STOFFFrameStyle
Class to store a frame style.
Definition STOFFFrameStyle.hxx:46
STOFFGraphicListener
This class contains the code needed to create Graphic document.
Definition STOFFGraphicListener.hxx:60
STOFFGraphicShape
a structure used to define a picture shape
Definition STOFFGraphicShape.hxx:46
STOFFGraphicStyle
Class to store a graphic style.
Definition STOFFGraphicStyle.hxx:45
STOFFHeader
a function used by STOFFDocument to store the version of document
Definition STOFFHeader.hxx:57
STOFFInputStream
Internal class used to read the file stream Internal class used to read the file stream,...
Definition STOFFInputStream.hxx:54
STOFFListManager
a manager which manages the lists, keeps the different kind of lists, to assure the unicity of each l...
Definition STOFFList.hxx:210
STOFFList
a small structure used to store the informations about a list
Definition STOFFList.hxx:110
STOFFListener
This class contains a virtual interface to all listener.
Definition STOFFListener.hxx:51
STOFFPageSpan
A class which defines the page properties.
Definition STOFFPageSpan.hxx:76
STOFFParagraph
class to store the paragraph properties
Definition STOFFParagraph.hxx:48
STOFFParserState
a class to define the parser state
Definition STOFFParser.hxx:50
STOFFParser
virtual class which defines the ancestor of all main zone parser
Definition STOFFParser.hxx:90
STOFFPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition STOFFPosition.hxx:48
STOFFSection
a class which stores section properties
Definition STOFFSection.hxx:46
STOFFSpreadsheetListener
This class contents the main functions needed to create a spreadsheet processing Document.
Definition STOFFSpreadsheetListener.hxx:65
STOFFSubDocument
abstract class used to store a subdocument (with a comparison function)
Definition STOFFSubDocument.hxx:42
STOFFTextListener
This class contains the code needed to create Text document.
Definition STOFFTextListener.hxx:60
STOFFVec2
small class which defines a vector with 2 elements
Definition libstaroffice_internal.hxx:589
STOFFVec2::operator==
bool operator==(STOFFVec2< T > const &p) const
comparison==
Definition libstaroffice_internal.hxx:691
STOFFVec2::setX
void setX(T xx)
resets the first element
Definition libstaroffice_internal.hxx:626
STOFFVec2::operator*=
STOFFVec2< T > & operator*=(U scale)
generic operator*=
Definition libstaroffice_internal.hxx:663
STOFFVec2::operator*
friend STOFFVec2< T > operator*(U scale, STOFFVec2< T > const &p1)
generic operator*
Definition libstaroffice_internal.hxx:684
STOFFVec2::MapY
std::map< STOFFVec2< T >, T, struct PosSizeLtY > MapY
map of STOFFVec2
Definition libstaroffice_internal.hxx:759
STOFFVec2::STOFFVec2
STOFFVec2(STOFFVec2< U > const &p)
generic copy constructor
Definition libstaroffice_internal.hxx:594
STOFFVec2< bool >::m_y
bool m_y
Definition libstaroffice_internal.hxx:761
STOFFVec2::MapX
std::map< STOFFVec2< T >, T, struct PosSizeLtX > MapX
map of STOFFVec2
Definition libstaroffice_internal.hxx:744
STOFFVec2::operator+=
STOFFVec2< T > & operator+=(STOFFVec2< T > const &p)
operator+=
Definition libstaroffice_internal.hxx:646
STOFFVec2::setY
void setY(T yy)
resets the second element
Definition libstaroffice_internal.hxx:631
STOFFVec2< bool >::y
bool y() const
Definition libstaroffice_internal.hxx:602
STOFFVec2< bool >::m_x
bool m_x
Definition libstaroffice_internal.hxx:761
STOFFVec2::operator-=
STOFFVec2< T > & operator-=(STOFFVec2< T > const &p)
operator-=
Definition libstaroffice_internal.hxx:652
STOFFVec2::operator[]
T & operator[](int c)
operator[]
Definition libstaroffice_internal.hxx:613
STOFFVec2::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFVec2< T > const &f)
operator<<: prints data in form "XxY"
Definition libstaroffice_internal.hxx:725
STOFFVec2::cmpY
int cmpY(STOFFVec2< T > const &p) const
a comparison function: which first compares y then x
Definition libstaroffice_internal.hxx:715
STOFFVec2::cmp
int cmp(STOFFVec2< T > const &p) const
a comparison function: which first compares x then y
Definition libstaroffice_internal.hxx:706
STOFFVec2< bool >::x
bool x() const
Definition libstaroffice_internal.hxx:597
STOFFVec2::operator[]
T operator[](int c) const
operator[]
Definition libstaroffice_internal.hxx:607
STOFFVec2::STOFFVec2
STOFFVec2(T xx=0, T yy=0)
constructor
Definition libstaroffice_internal.hxx:592
STOFFVec2::set
void set(T xx, T yy)
resets the two elements
Definition libstaroffice_internal.hxx:620
STOFFVec2::add
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition libstaroffice_internal.hxx:637
STOFFVec2::operator-
friend STOFFVec2< T > operator-(STOFFVec2< T > const &p1, STOFFVec2< T > const &p2)
operator-
Definition libstaroffice_internal.hxx:677
STOFFVec2::operator!=
bool operator!=(STOFFVec2< T > const &p) const
comparison!=
Definition libstaroffice_internal.hxx:696
STOFFVec2::operator<
bool operator<(STOFFVec2< T > const &p) const
comparison<: sort by y
Definition libstaroffice_internal.hxx:701
STOFFVec2::operator+
friend STOFFVec2< T > operator+(STOFFVec2< T > const &p1, STOFFVec2< T > const &p2)
operator+
Definition libstaroffice_internal.hxx:671
STOFFVec3
small class which defines a vector with 3 elements
Definition libstaroffice_internal.hxx:777
STOFFVec3< bool >::m_val
bool m_val[3]
Definition libstaroffice_internal.hxx:940
STOFFVec3::operator+
friend STOFFVec3< T > operator+(STOFFVec3< T > const &p1, STOFFVec3< T > const &p2)
operator+
Definition libstaroffice_internal.hxx:872
STOFFVec3::operator-
friend STOFFVec3< T > operator-(STOFFVec3< T > const &p1, STOFFVec3< T > const &p2)
operator-
Definition libstaroffice_internal.hxx:878
STOFFVec3::setX
void setX(T xx)
resets the first element
Definition libstaroffice_internal.hxx:828
STOFFVec3::z
T z() const
third element
Definition libstaroffice_internal.hxx:803
STOFFVec3::STOFFVec3
STOFFVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition libstaroffice_internal.hxx:780
STOFFVec3::y
T y() const
second element
Definition libstaroffice_internal.hxx:798
STOFFVec3::x
T x() const
first element
Definition libstaroffice_internal.hxx:793
STOFFVec3::operator*=
STOFFVec3< T > & operator*=(U scale)
generic operator*=
Definition libstaroffice_internal.hxx:865
STOFFVec3::operator+=
STOFFVec3< T > & operator+=(STOFFVec3< T > const &p)
operator+=
Definition libstaroffice_internal.hxx:852
STOFFVec3::operator*
friend STOFFVec3< T > operator*(U scale, STOFFVec3< T > const &p1)
generic operator*
Definition libstaroffice_internal.hxx:885
STOFFVec3::set
void set(T xx, T yy, T zz)
resets the three elements
Definition libstaroffice_internal.hxx:821
STOFFVec3::STOFFVec3
STOFFVec3(STOFFVec3< U > const &p)
generic copy constructor
Definition libstaroffice_internal.hxx:787
STOFFVec3::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFVec3< T > const &f)
operator<<: prints data in form "XxYxZ"
Definition libstaroffice_internal.hxx:917
STOFFVec3::setZ
void setZ(T zz)
resets the third element
Definition libstaroffice_internal.hxx:838
STOFFVec3::operator[]
T & operator[](int c)
operator[]
Definition libstaroffice_internal.hxx:814
STOFFVec3::add
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition libstaroffice_internal.hxx:844
STOFFVec3::operator!=
bool operator!=(STOFFVec3< T > const &p) const
comparison!=
Definition libstaroffice_internal.hxx:897
STOFFVec3::operator<
bool operator<(STOFFVec3< T > const &p) const
comparison<: which first compares x values, then y values then z values.
Definition libstaroffice_internal.hxx:902
STOFFVec3::Map
std::map< STOFFVec3< T >, T, struct PosSizeLt > Map
map of STOFFVec3
Definition libstaroffice_internal.hxx:936
STOFFVec3::operator-=
STOFFVec3< T > & operator-=(STOFFVec3< T > const &p)
operator-=
Definition libstaroffice_internal.hxx:858
STOFFVec3::operator==
bool operator==(STOFFVec3< T > const &p) const
comparison==
Definition libstaroffice_internal.hxx:892
STOFFVec3::setY
void setY(T yy)
resets the second element
Definition libstaroffice_internal.hxx:833
STOFFVec3::cmp
int cmp(STOFFVec3< T > const &p) const
a comparison function: which first compares x values, then y values then z values.
Definition libstaroffice_internal.hxx:907
STOFFVec3::operator[]
T operator[](int c) const
operator[]
Definition libstaroffice_internal.hxx:808
libstoff::FileException
Definition libstaroffice_internal.hxx:140
libstoff::GenericException
Definition libstaroffice_internal.hxx:148
libstoff::ParseException
Definition libstaroffice_internal.hxx:144
libstoff::VersionException
Definition libstaroffice_internal.hxx:136
libstoff::WrongPasswordException
Definition libstaroffice_internal.hxx:152
STOFFVec2l
STOFFVec2< long > STOFFVec2l
STOFFVec2 of long.
Definition libstaroffice_internal.hxx:769
STOFFSubDocumentPtr
std::shared_ptr< STOFFSubDocument > STOFFSubDocumentPtr
a smart pointer of STOFFSubDocument
Definition libstaroffice_internal.hxx:499
STOFFGraphicListenerPtr
std::shared_ptr< STOFFGraphicListener > STOFFGraphicListenerPtr
a smart pointer of STOFFGraphicListener
Definition libstaroffice_internal.hxx:487
LIBSTOFF_ATTRIBUTE_PRINTF
#define LIBSTOFF_ATTRIBUTE_PRINTF(fmt, arg)
Definition libstaroffice_internal.hxx:116
STOFFSpreadsheetListenerPtr
std::shared_ptr< STOFFSpreadsheetListener > STOFFSpreadsheetListenerPtr
a smart pointer of STOFFSpreadsheetListener
Definition libstaroffice_internal.hxx:497
STOFFParserStatePtr
std::shared_ptr< STOFFParserState > STOFFParserStatePtr
a smart pointer of STOFFParserState
Definition libstaroffice_internal.hxx:495
STOFFBox2i
STOFFBox2< int > STOFFBox2i
STOFFBox2 of int.
Definition libstaroffice_internal.hxx:1133
STOFFListManagerPtr
std::shared_ptr< STOFFListManager > STOFFListManagerPtr
a smart pointer of STOFFListManager
Definition libstaroffice_internal.hxx:493
STOFFListenerPtr
std::shared_ptr< STOFFListener > STOFFListenerPtr
a smart pointer of STOFFListener
Definition libstaroffice_internal.hxx:491
STOFFVec2i
STOFFVec2< int > STOFFVec2i
STOFFVec2 of int.
Definition libstaroffice_internal.hxx:767
STOFFVec3f
STOFFVec3< float > STOFFVec3f
STOFFVec3 of float.
Definition libstaroffice_internal.hxx:950
STOFFVec3b
STOFFVec3< bool > STOFFVec3b
STOFFVec3 of bool.
Definition libstaroffice_internal.hxx:944
STOFFBox2l
STOFFBox2< long > STOFFBox2l
STOFFBox2 of long.
Definition libstaroffice_internal.hxx:1137
STOFFVec3uc
STOFFVec3< unsigned char > STOFFVec3uc
STOFFVec3 of unsigned char.
Definition libstaroffice_internal.hxx:946
STOFFInputStreamPtr
std::shared_ptr< STOFFInputStream > STOFFInputStreamPtr
a smart pointer of STOFFInputStream
Definition libstaroffice_internal.hxx:489
STOFFVec2b
STOFFVec2< bool > STOFFVec2b
STOFFVec2 of bool.
Definition libstaroffice_internal.hxx:765
STOFFVec2f
STOFFVec2< float > STOFFVec2f
STOFFVec2 of float.
Definition libstaroffice_internal.hxx:771
STOFFVec3i
STOFFVec3< int > STOFFVec3i
STOFFVec3 of int.
Definition libstaroffice_internal.hxx:948
STOFFBox2f
STOFFBox2< float > STOFFBox2f
STOFFBox2 of float.
Definition libstaroffice_internal.hxx:1135
STOFFTextListenerPtr
std::shared_ptr< STOFFTextListener > STOFFTextListenerPtr
a smart pointer of STOFFTextListener
Definition libstaroffice_internal.hxx:501
libstoff
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition libstaroffice_internal.cxx:51
libstoff::numberingTypeToString
std::string numberingTypeToString(NumberingType type)
Definition libstaroffice_internal.cxx:124
libstoff::NumberingType
NumberingType
Definition libstaroffice_internal.hxx:182
libstoff::UPPERCASE
@ UPPERCASE
Definition libstaroffice_internal.hxx:182
libstoff::ARABIC
@ ARABIC
Definition libstaroffice_internal.hxx:182
libstoff::LOWERCASE
@ LOWERCASE
Definition libstaroffice_internal.hxx:182
libstoff::LOWERCASE_ROMAN
@ LOWERCASE_ROMAN
Definition libstaroffice_internal.hxx:182
libstoff::UPPERCASE_ROMAN
@ UPPERCASE_ROMAN
Definition libstaroffice_internal.hxx:182
libstoff::NONE
@ NONE
Definition libstaroffice_internal.hxx:182
libstoff::BULLET
@ BULLET
Definition libstaroffice_internal.hxx:182
libstoff::HMiddleBit
@ HMiddleBit
Definition libstaroffice_internal.hxx:180
libstoff::TopBit
@ TopBit
Definition libstaroffice_internal.hxx:180
libstoff::BottomBit
@ BottomBit
Definition libstaroffice_internal.hxx:180
libstoff::RightBit
@ RightBit
Definition libstaroffice_internal.hxx:180
libstoff::VMiddleBit
@ VMiddleBit
Definition libstaroffice_internal.hxx:180
libstoff::LeftBit
@ LeftBit
Definition libstaroffice_internal.hxx:180
libstoff::appendUnicode
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string
Definition libstaroffice_internal.cxx:81
libstoff::simplifyString
librevenge::RVNGString simplifyString(librevenge::RVNGString const &s)
returns a simplify version of a string.
Definition libstaroffice_internal.cxx:430
libstoff::getCellName
std::string getCellName(STOFFVec2i const &cellPos, STOFFVec2b const &relative)
returns the cell name corresponding to a cell's position
Definition libstaroffice_internal.cxx:455
libstoff::getString
librevenge::RVNGString getString(std::vector< uint32_t > const &unicode)
transform a unicode string in a RNVGString
Definition libstaroffice_internal.cxx:63
libstoff::convertToDateTime
bool convertToDateTime(uint32_t date, uint32_t time, std::string &dateTime)
convert a date/time in a date time format
Definition libstaroffice_internal.cxx:389
libstoff::rotatePointAroundCenter
STOFFVec2f rotatePointAroundCenter(STOFFVec2f const &point, STOFFVec2f const &center, float angle)
rotate a point around center, angle is given in degree
Definition libstaroffice_internal.cxx:471
libstoff::Position
Position
basic position enum
Definition libstaroffice_internal.hxx:178
libstoff::Right
@ Right
Definition libstaroffice_internal.hxx:178
libstoff::Top
@ Top
Definition libstaroffice_internal.hxx:178
libstoff::VMiddle
@ VMiddle
Definition libstaroffice_internal.hxx:178
libstoff::HMiddle
@ HMiddle
Definition libstaroffice_internal.hxx:178
libstoff::Left
@ Left
Definition libstaroffice_internal.hxx:178
libstoff::Bottom
@ Bottom
Definition libstaroffice_internal.hxx:178
libstoff::numberingValueToString
std::string numberingValueToString(NumberingType type, int value)
Definition libstaroffice_internal.cxx:146
libstoff::checkAddOverflow
bool checkAddOverflow(T x, T y)
checks whether addition of x and y would overflow
Definition libstaroffice_internal.hxx:167
libstoff::getScaleFactor
float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest)
factor to convert from one unit to other
Definition libstaroffice_internal.cxx:499
libstoff::SubDocumentType
SubDocumentType
Definition libstaroffice_internal.hxx:185
libstoff::DOC_SHEET
@ DOC_SHEET
Definition libstaroffice_internal.hxx:185
libstoff::DOC_TEXT_BOX
@ DOC_TEXT_BOX
Definition libstaroffice_internal.hxx:185
libstoff::DOC_GRAPHIC_GROUP
@ DOC_GRAPHIC_GROUP
Definition libstaroffice_internal.hxx:185
libstoff::DOC_NONE
@ DOC_NONE
Definition libstaroffice_internal.hxx:185
libstoff::DOC_HEADER_FOOTER_REGION
@ DOC_HEADER_FOOTER_REGION
Definition libstaroffice_internal.hxx:185
libstoff::DOC_CHART
@ DOC_CHART
Definition libstaroffice_internal.hxx:185
libstoff::DOC_COMMENT_ANNOTATION
@ DOC_COMMENT_ANNOTATION
Definition libstaroffice_internal.hxx:185
libstoff::DOC_CHART_ZONE
@ DOC_CHART_ZONE
Definition libstaroffice_internal.hxx:185
libstoff::DOC_TABLE
@ DOC_TABLE
Definition libstaroffice_internal.hxx:185
libstoff::DOC_NOTE
@ DOC_NOTE
Definition libstaroffice_internal.hxx:185
libstoff::rotateBoxFromCenter
STOFFBox2f rotateBoxFromCenter(STOFFBox2f const &box, float angle)
rotate a bdox and returns the final bdbox, angle is given in degree
Definition libstaroffice_internal.cxx:479
libstoff::splitString
void splitString(librevenge::RVNGString const &string, librevenge::RVNGString const &delim, librevenge::RVNGString &string1, librevenge::RVNGString &string2)
split a string in two. If the delimiter is not present, string1=string
Definition libstaroffice_internal.cxx:414
libstoff::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition libstaroffice_internal.cxx:52
STOFFBorderLine
a border line
Definition libstaroffice_internal.hxx:326
STOFFBorderLine::m_color
STOFFColor m_color
the border color
Definition libstaroffice_internal.hxx:357
STOFFBorderLine::m_outWidth
int m_outWidth
the outline width in TWIP
Definition libstaroffice_internal.hxx:353
STOFFBorderLine::m_inWidth
int m_inWidth
the inline width in TWIP
Definition libstaroffice_internal.hxx:355
STOFFBorderLine::addTo
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition libstaroffice_internal.cxx:256
STOFFBorderLine::operator==
bool operator==(STOFFBorderLine const &orig) const
operator==
Definition libstaroffice_internal.hxx:339
STOFFBorderLine::operator!=
bool operator!=(STOFFBorderLine const &orig) const
operator!=
Definition libstaroffice_internal.hxx:344
STOFFBorderLine::m_distance
int m_distance
the border distance
Definition libstaroffice_internal.hxx:359
STOFFBorderLine::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFBorderLine const &border)
operator<<
Definition libstaroffice_internal.cxx:282
STOFFBorderLine::STOFFBorderLine
STOFFBorderLine()
constructor
Definition libstaroffice_internal.hxx:328
STOFFBorderLine::isEmpty
bool isEmpty() const
returns true if the border is empty
Definition libstaroffice_internal.hxx:334
STOFFBox2::PosSizeLt
internal struct used to create sorted map, sorted first min then max
Definition libstaroffice_internal.hxx:1115
STOFFBox2::PosSizeLt::operator()
bool operator()(STOFFBox2< T > const &s1, STOFFBox2< T > const &s2) const
comparaison function
Definition libstaroffice_internal.hxx:1117
STOFFColor
the class to store a color
Definition libstaroffice_internal.hxx:189
STOFFColor::colorFromHSL
static STOFFColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L)
return a color from a hsl color (basic)
Definition libstaroffice_internal.hxx:216
STOFFColor::getRed
unsigned char getRed() const
returns the red value
Definition libstaroffice_internal.hxx:267
STOFFColor::operator>=
bool operator>=(STOFFColor const &c) const
operator>=
Definition libstaroffice_internal.hxx:312
STOFFColor::operator=
STOFFColor & operator=(uint32_t argb)
operator=
Definition libstaroffice_internal.hxx:200
STOFFColor::barycenter
static STOFFColor barycenter(float alpha, STOFFColor const &colA, float beta, STOFFColor const &colB)
return alpha*colA+beta*colB
Definition libstaroffice_internal.cxx:200
STOFFColor::getBlue
unsigned char getBlue() const
returns the green value
Definition libstaroffice_internal.hxx:262
STOFFColor::operator<
bool operator<(STOFFColor const &c) const
operator<
Definition libstaroffice_internal.hxx:297
STOFFColor::getGreen
unsigned char getGreen() const
returns the green value
Definition libstaroffice_internal.hxx:272
STOFFColor::colorFromCMYK
static STOFFColor colorFromCMYK(unsigned char c, unsigned char m, unsigned char y, unsigned char k)
return a color from a cmyk color ( basic)
Definition libstaroffice_internal.hxx:206
STOFFColor::black
static STOFFColor black()
return the back color
Definition libstaroffice_internal.hxx:233
STOFFColor::str
std::string str() const
print the color in the form #rrggbb
Definition libstaroffice_internal.cxx:226
STOFFColor::m_value
uint32_t m_value
the argb color
Definition libstaroffice_internal.hxx:322
STOFFColor::isBlack
bool isBlack() const
return true if the color is black
Definition libstaroffice_internal.hxx:277
STOFFColor::operator==
bool operator==(STOFFColor const &c) const
operator==
Definition libstaroffice_internal.hxx:287
STOFFColor::operator!=
bool operator!=(STOFFColor const &c) const
operator!=
Definition libstaroffice_internal.hxx:292
STOFFColor::setAlpha
void setAlpha(unsigned char alpha)
reset the alpha value
Definition libstaroffice_internal.hxx:257
STOFFColor::isWhite
bool isWhite() const
return true if the color is white
Definition libstaroffice_internal.hxx:282
STOFFColor::STOFFColor
STOFFColor(uint32_t argb=0)
constructor
Definition libstaroffice_internal.hxx:191
STOFFColor::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFColor const &c)
operator<< in the form #rrggbb
Definition libstaroffice_internal.cxx:214
STOFFColor::operator<=
bool operator<=(STOFFColor const &c) const
operator<=
Definition libstaroffice_internal.hxx:302
STOFFColor::getAlpha
unsigned char getAlpha() const
returns the alpha value
Definition libstaroffice_internal.hxx:252
STOFFColor::STOFFColor
STOFFColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition libstaroffice_internal.hxx:195
STOFFColor::value
uint32_t value() const
return the rgba value
Definition libstaroffice_internal.hxx:247
STOFFColor::operator>
bool operator>(STOFFColor const &c) const
operator>
Definition libstaroffice_internal.hxx:307
STOFFColor::white
static STOFFColor white()
return the white color
Definition libstaroffice_internal.hxx:238
STOFFEmbeddedObject
small class use to define a embedded object
Definition libstaroffice_internal.hxx:408
STOFFEmbeddedObject::addAsFillImageTo
bool addAsFillImageTo(librevenge::RVNGPropertyList &propList) const
add the link property to a graph style as bitmap
Definition libstaroffice_internal.cxx:297
STOFFEmbeddedObject::STOFFEmbeddedObject
STOFFEmbeddedObject(STOFFEmbeddedObject &&)=default
STOFFEmbeddedObject::addTo
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist
Definition libstaroffice_internal.cxx:309
STOFFEmbeddedObject::STOFFEmbeddedObject
STOFFEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
constructor
Definition libstaroffice_internal.hxx:414
STOFFEmbeddedObject::m_typeList
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition libstaroffice_internal.hxx:458
STOFFEmbeddedObject::STOFFEmbeddedObject
STOFFEmbeddedObject(STOFFEmbeddedObject const &)=default
STOFFEmbeddedObject::operator=
STOFFEmbeddedObject & operator=(STOFFEmbeddedObject const &)=default
STOFFEmbeddedObject::add
void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
add a picture
Definition libstaroffice_internal.hxx:437
STOFFEmbeddedObject::m_filenameLink
librevenge::RVNGString m_filenameLink
a picture link
Definition libstaroffice_internal.hxx:460
STOFFEmbeddedObject::operator=
STOFFEmbeddedObject & operator=(STOFFEmbeddedObject &&)=default
STOFFEmbeddedObject::m_dataList
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition libstaroffice_internal.hxx:456
STOFFEmbeddedObject::cmp
int cmp(STOFFEmbeddedObject const &pict) const
a comparison function
Definition libstaroffice_internal.cxx:347
STOFFEmbeddedObject::~STOFFEmbeddedObject
~STOFFEmbeddedObject()
destructor
Definition libstaroffice_internal.cxx:293
STOFFEmbeddedObject::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFEmbeddedObject const &pict)
operator<<
Definition libstaroffice_internal.cxx:372
STOFFEmbeddedObject::isEmpty
bool isEmpty() const
return true if the picture contains no data
Definition libstaroffice_internal.hxx:426
STOFFEmbeddedObject::STOFFEmbeddedObject
STOFFEmbeddedObject()
empty constructor
Definition libstaroffice_internal.hxx:410
STOFFField::m_propertyList
librevenge::RVNGPropertyList m_propertyList
the property list
Definition libstaroffice_internal.hxx:371
STOFFField::addTo
void addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist (if possible)
Definition libstaroffice_internal.cxx:234
STOFFField::STOFFField
STOFFField()
basic constructor
Definition libstaroffice_internal.hxx:365
STOFFLink::m_HRef
std::string m_HRef
the href field
Definition libstaroffice_internal.hxx:385
STOFFLink::addTo
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist (if needed )
Definition libstaroffice_internal.cxx:247
STOFFLink::STOFFLink
STOFFLink()
basic constructor
Definition libstaroffice_internal.hxx:377
STOFFNote::STOFFNote
STOFFNote(Type type)
constructor
Definition libstaroffice_internal.hxx:393
STOFFNote::m_label
librevenge::RVNGString m_label
the note label
Definition libstaroffice_internal.hxx:399
STOFFNote::m_number
int m_number
the note number if defined
Definition libstaroffice_internal.hxx:401
STOFFNote::Type
Type
enum to define note type
Definition libstaroffice_internal.hxx:391
STOFFNote::FootNote
@ FootNote
Definition libstaroffice_internal.hxx:391
STOFFNote::EndNote
@ EndNote
Definition libstaroffice_internal.hxx:391
STOFFNote::m_type
Type m_type
the note type
Definition libstaroffice_internal.hxx:397
STOFFVariable::insert
void insert(STOFFVariable const &orig)
update the current value if orig is set
Definition libstaroffice_internal.hxx:533
STOFFVariable::m_data
T m_data
the value
Definition libstaroffice_internal.hxx:579
STOFFVariable::STOFFVariable
STOFFVariable()
constructor
Definition libstaroffice_internal.hxx:511
STOFFVariable::STOFFVariable
STOFFVariable(T const &def)
constructor with a default value
Definition libstaroffice_internal.hxx:513
STOFFVariable::STOFFVariable
STOFFVariable(STOFFVariable const &orig)
copy constructor
Definition libstaroffice_internal.hxx:515
STOFFVariable::operator=
STOFFVariable & operator=(STOFFVariable const &orig)
copy operator
Definition libstaroffice_internal.hxx:517
STOFFVariable::setSet
void setSet(bool newVal)
define if the variable is set
Definition libstaroffice_internal.hxx:573
STOFFVariable::operator=
STOFFVariable & operator=(T const &val)
set a value
Definition libstaroffice_internal.hxx:526
STOFFVariable::operator*
T & operator*()
operator*
Definition libstaroffice_internal.hxx:557
STOFFVariable::operator->
T const * operator->() const
operator*
Definition libstaroffice_internal.hxx:541
STOFFVariable::isSet
bool isSet() const
return true if the variable is set
Definition libstaroffice_internal.hxx:568
STOFFVariable::get
T const & get() const
return the current value
Definition libstaroffice_internal.hxx:563
STOFFVariable::operator*
T const & operator*() const
operator*
Definition libstaroffice_internal.hxx:552
STOFFVariable::operator->
T * operator->()
operator*
Definition libstaroffice_internal.hxx:546
STOFFVariable::m_set
bool m_set
a flag to know if the variable is set or not
Definition libstaroffice_internal.hxx:581
STOFFVec2::PosSizeLtX
internal struct used to create sorted map, sorted by X
Definition libstaroffice_internal.hxx:734
STOFFVec2::PosSizeLtX::operator()
bool operator()(STOFFVec2< T > const &s1, STOFFVec2< T > const &s2) const
comparaison function
Definition libstaroffice_internal.hxx:736
STOFFVec2::PosSizeLtY
internal struct used to create sorted map, sorted by Y
Definition libstaroffice_internal.hxx:749
STOFFVec2::PosSizeLtY::operator()
bool operator()(STOFFVec2< T > const &s1, STOFFVec2< T > const &s2) const
comparaison function
Definition libstaroffice_internal.hxx:751
STOFFVec3::PosSizeLt
internal struct used to create sorted map, sorted by X, Y, Z
Definition libstaroffice_internal.hxx:926
STOFFVec3::PosSizeLt::operator()
bool operator()(STOFFVec3< T > const &s1, STOFFVec3< T > const &s2) const
comparaison function
Definition libstaroffice_internal.hxx:928
STOFF_shared_ptr_noop_deleter
an noop deleter used to transform a libwpd pointer in a false std::shared_ptr
Definition libstaroffice_internal.hxx:100
STOFF_shared_ptr_noop_deleter::operator()
void operator()(T *)
Definition libstaroffice_internal.hxx:101