code_device/hgdriver/hgdev/PaperSize.h

49 lines
933 B
C++

#ifndef PAPER_SIZE_H
#define PAPER_SIZE_H
#include <map>
#ifdef WIN32
#include <Windows.h>
#endif
#include "common_setting.h"
#ifdef __linux__
typedef CSSIZE Size;
typedef CSSIZE SIZE;
typedef unsigned long DWORD;
typedef long LONG;
#endif
typedef struct Paper_Status {
unsigned int Paper;
unsigned int Orentate;
friend bool operator<(const struct Paper_Status& a, const struct Paper_Status& b) {
if (a.Paper < b.Paper ||
(a.Paper == b.Paper && a.Orentate < b.Orentate)) {
return true;
}
return false;
}
}PaperStatus;
namespace Device {
class PaperSize
{
public:
PaperSize();
~PaperSize();
private:
void InitPaperMap();
std::map<TwSS, SIZE> papersize;
std::map<std::pair<TwSS, float>, SIZE> dpiDct;
std::map<TwSS, SIZE> dpiDct_100;
std::map<TwSS, SIZE> dpiDct_400;
std::map<TwSS, SIZE> dpiDct_300;
public:
SIZE GetPaperSize(DWORD paperType, float dpi, int orentation);
};
}
#endif