2000-07-31 12:30:10 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* =================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
* Copyright 1995 Matthias Ettrich.
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team.
|
2000-07-31 12:30:10 +00:00
|
|
|
*
|
|
|
|
* This file Copyright 2000 Baruch Even
|
|
|
|
* ================================================= */
|
|
|
|
|
|
|
|
#ifndef INSETGRAPHICSPARAMS_H
|
|
|
|
#define INSETGRAPHICSPARAMS_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
2000-08-14 09:44:53 +00:00
|
|
|
#endif
|
2000-08-08 09:18:39 +00:00
|
|
|
|
2000-07-31 12:30:10 +00:00
|
|
|
#include "LString.h"
|
|
|
|
|
|
|
|
#include "buffer.h"
|
|
|
|
#include "lyxlex.h"
|
|
|
|
|
|
|
|
using std::ostream;
|
|
|
|
|
|
|
|
/// This struct holds all the parameters needed by insetGraphics.
|
2000-08-14 09:44:53 +00:00
|
|
|
struct InsetGraphicsParams
|
|
|
|
{
|
|
|
|
/// Image filename.
|
|
|
|
string filename;
|
|
|
|
|
|
|
|
/// How do we display the image?
|
|
|
|
enum DisplayType {
|
|
|
|
/// In full color range (if it's not in color we show it as it is)
|
|
|
|
COLOR,
|
|
|
|
/// In Grayscale (256 shades of gray).
|
|
|
|
GRAYSCALE,
|
|
|
|
/// In black and white.
|
|
|
|
MONOCHROME,
|
|
|
|
/// Don't display it on screen, only keep a frame in place.
|
|
|
|
NONE
|
|
|
|
};
|
|
|
|
|
|
|
|
/// How to display the image
|
|
|
|
DisplayType display;
|
|
|
|
|
|
|
|
/// Is the figure inlined? (not in a paragraph of its own).
|
|
|
|
bool inlineFigure;
|
|
|
|
|
|
|
|
/// Do we have a subcaption?
|
|
|
|
bool subcaption;
|
|
|
|
|
|
|
|
/// The text of the subcaption.
|
|
|
|
string subcaptionText;
|
|
|
|
|
2000-07-31 12:30:10 +00:00
|
|
|
/// This is the different origins that the graphicx package support.
|
|
|
|
enum Origin {
|
2000-08-14 09:44:53 +00:00
|
|
|
DEFAULT,
|
|
|
|
LEFTTOP,
|
|
|
|
LEFTCENTER,
|
|
|
|
LEFTBASELINE,
|
|
|
|
LEFTBOTTOM,
|
|
|
|
CENTERTOP,
|
|
|
|
CENTER,
|
|
|
|
CENTERBASELINE,
|
|
|
|
CENTERBOTTOM,
|
|
|
|
RIGHTTOP,
|
|
|
|
RIGHTCENTER,
|
|
|
|
RIGHTBASELINE,
|
|
|
|
RIGHTBOTTOM,
|
|
|
|
REFERENCE_POINT = LEFTBASELINE
|
|
|
|
};
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
/** The resize of the image, is it the default size, in cm, inch or
|
|
|
|
percentage of the page/column width/height */
|
2000-08-14 09:44:53 +00:00
|
|
|
enum Resize {
|
|
|
|
DEFAULT_SIZE,
|
|
|
|
CM,
|
|
|
|
INCH,
|
|
|
|
PERCENT_PAGE,
|
|
|
|
PERCENT_COLUMN
|
2000-07-31 12:30:10 +00:00
|
|
|
};
|
|
|
|
|
2000-08-14 09:44:53 +00:00
|
|
|
|
|
|
|
/// Keep the ratio between height and width when resizing.
|
|
|
|
bool keepAspectRatio;
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
/// What width resize to do?
|
2000-08-14 09:44:53 +00:00
|
|
|
Resize widthResize;
|
2000-09-14 17:53:12 +00:00
|
|
|
/// Value of width resize
|
2000-08-14 09:44:53 +00:00
|
|
|
float widthSize;
|
2000-09-14 17:53:12 +00:00
|
|
|
/// What height resize to do?
|
2000-08-14 09:44:53 +00:00
|
|
|
Resize heightResize;
|
2000-09-14 17:53:12 +00:00
|
|
|
/// Value of height resize
|
2000-08-14 09:44:53 +00:00
|
|
|
float heightSize;
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
/// Origin point of rotation
|
2000-08-14 09:44:53 +00:00
|
|
|
Origin rotateOrigin;
|
2000-09-14 17:53:12 +00:00
|
|
|
/// Rotation angle.
|
2000-08-14 09:44:53 +00:00
|
|
|
int rotateAngle;
|
2000-09-14 17:53:12 +00:00
|
|
|
///
|
2000-08-14 09:44:53 +00:00
|
|
|
InsetGraphicsParams();
|
2000-09-14 17:53:12 +00:00
|
|
|
///
|
2000-08-14 09:44:53 +00:00
|
|
|
InsetGraphicsParams(InsetGraphicsParams const &);
|
2000-09-14 17:53:12 +00:00
|
|
|
///
|
|
|
|
InsetGraphicsParams & operator=(InsetGraphicsParams const &);
|
2000-08-14 09:44:53 +00:00
|
|
|
|
|
|
|
/// Save the parameters in the LyX format stream.
|
|
|
|
void Write(Buffer const * buf, ostream & os) const;
|
|
|
|
|
|
|
|
/// If the token belongs to our parameters, read it.
|
|
|
|
bool Read(Buffer const * buf, LyXLex & lex, string const & token);
|
|
|
|
|
|
|
|
/// Test the struct to make sure that all the options have legal values.
|
|
|
|
void testInvariant() const;
|
2000-07-31 12:30:10 +00:00
|
|
|
|
|
|
|
private:
|
2000-08-14 09:44:53 +00:00
|
|
|
/// Initialize the object to a default status.
|
|
|
|
void init();
|
2000-07-31 12:30:10 +00:00
|
|
|
|
2000-08-14 09:44:53 +00:00
|
|
|
/// Copy the other objects content to us, used in copy c-tor and assignment
|
|
|
|
void copy(InsetGraphicsParams const & params);
|
2000-07-31 12:30:10 +00:00
|
|
|
};
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
///
|
|
|
|
bool operator==(InsetGraphicsParams const &, InsetGraphicsParams const &);
|
2001-03-28 13:16:37 +00:00
|
|
|
///
|
|
|
|
bool operator!=(InsetGraphicsParams const &, InsetGraphicsParams const &);
|
2000-07-31 12:30:10 +00:00
|
|
|
|
2000-08-14 09:44:53 +00:00
|
|
|
#endif
|