NCBI C++ ToolKit
print_options.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_PRINT___PRINT_OPTIONS__HPP
2 #define GUI_PRINT___PRINT_OPTIONS__HPP
3 
4 /* $Id: print_options.hpp 42695 2019-04-03 19:45:15Z evgeniev $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Peter Meric
30  *
31  * File Description:
32  * CPrintOptions -- printing options
33  */
34 
35 
36 #include <corelib/ncbistd.hpp>
40 
42 
43 
44 class CMedia;
45 
46 
48 {
49 public:
51 
52 public:
54  ePortrait = 0,
55  eLandscape = 270,
56  eUpsideDown = 180,
57  eSeascape = 90
58  };
59  typedef enum EPageOrientation TPageOrientation;
60 
61  enum {
62  eVector = 0x10,
63  eRaster = 0x20
64  };
65 
67  eUnknown = 0,
68  ePostscript = eVector | 1,
69  ePdf = eVector | 2,
70  eSvg = eVector | 3,
71  eSvgz = eVector | 4,
72  ePng = eRaster | 5,
73  eJpeg = eRaster | 6,
74  eDefault = ePng
75  };
76  typedef enum EOutputFormat TOutputFormat;
77 
79  {
80  // horizontal
84  // vertical
87  eBottom
88  };
89  typedef enum EAlignment TAlignment;
90 
91  struct SText
92  {
93  string text;
95  unsigned int font_size;
96  };
97 
98  static TOutputFormat GetFormatFromName(const string& fmtname);
99 
100 
101  CPrintOptions();
102  virtual ~CPrintOptions();
103 
104  void SetGenerateIndex(bool generateIdx);
105  bool GetGenerateIndex(void) const;
106 
107  void SetGrayscale(bool greyscale);
108  bool GetGrayscale(void) const;
109 
110  void SetPageOrientation(TPageOrientation orient);
111  TPageOrientation GetPageOrientation(void) const;
112 
113  void SetFilename(const string& filename);
114  const string& GetFilename(void) const;
115 
116  void SetTitle(const string& title);
117  const string& GetTitle(void) const;
118 
119  void SetHeader(const string& header);
120  void SetHeader(const SText& header);
121  const string& GetHeader(void) const;
122  const SText& GetHeaderDetails(void) const;
123 
124  void SetFooter(const string& footer);
125  void SetFooter(const SText& footer);
126  const string& GetFooter(void) const;
127  const SText& GetFooterDetails(void) const;
128 
129  void SetOutputFormat(TOutputFormat fmt);
130  TOutputFormat GetOutputFormat(void) const;
131  static bool s_IsVectorFormat(TOutputFormat fmt);
132  static bool s_IsRasterFormat(TOutputFormat fmt);
133 
134  void SetPrintOutput(bool print_output);
135  bool GetPrintOutput(void) const;
136 
137  void SetPagesWide(unsigned int w);
138  unsigned int GetPagesWide(void) const;
139  void SetPagesTall(unsigned int w);
140  unsigned int GetPagesTall(void) const;
141  unsigned int GetNumPages(void) const;
142 
143  void SetMedia(const CMedia& media);
144  const CMedia& GetMedia(void) const;
145  TPdfUnit GetMediaHeight(void) const;
146  TPdfUnit GetMediaWidth(void) const;
147 
148  bool HasRasterDimensions(void) const;
149  void UnsetRasterDimensions(void);
150  void SetRasterWidth(unsigned int w);
151  unsigned int GetRasterWidth(void) const;
152  void SetRasterHeight(unsigned int h);
153  unsigned int GetRasterHeight(void) const;
154 
155  void SetHeaderOffset(TPdfUnit h);
156  TPdfUnit GetHeaderOffset(void) const;
157 
158  void SetFooterOffset(TPdfUnit h);
159  TPdfUnit GetFooterOffset(void) const;
160 
161  void SetMarginTop(TPdfUnit h);
162  TPdfUnit GetMarginTop(void) const;
163 
164  void SetMarginBottom(TPdfUnit w);
165  TPdfUnit GetMarginBottom(void) const;
166 
167  void SetMarginLeft(TPdfUnit h);
168  TPdfUnit GetMarginLeft(void) const;
169 
170  void SetMarginRight(TPdfUnit w);
171  TPdfUnit GetMarginRight(void) const;
172 
173  TPdfUnit GetPageTrimWidth(void) const;
174  TPdfUnit GetPageTrimHeight(void) const;
175 
176  void SetUserUnit(TPdfUnit userunit) { m_UserUnit = userunit; }
177  TPdfUnit GetUserUnit() const { return m_UserUnit; }
178 
179  // If true, all gouraud shaded tris (shadingtype 4) will be drawn
180  // as flat polygons (same color at each vertex)
181  void DisableGouraudShading(bool b) { m_GouraudDisabled = b;}
182  bool GetGouraudShadingDisabled() const { return m_GouraudDisabled; }
183 
184 public:
185  static const string& GetMimeType(EOutputFormat format);
186  static const string& GetFileExtension(EOutputFormat format);
187 
188 protected:
191 
192 private:
193  // general attributes
194  string m_Filename;
198 
199  // raster-output attributes
201  unsigned int m_RasterWidth;
202  unsigned int m_RasterHeight;
203 
204  // vector-output attributes
205  string m_Title;
211 
212  unsigned int m_PagesWide;
213  unsigned int m_PagesTall;
221 
222  // output scaler, defaults to 1.0
224 
225  // If true, gouraud tris rendered as flat polys
227 };
228 
229 
230 
232 
233 
234 #endif // GUI_PRINT___PRINT_OPTIONS__HPP
CUnit::TPdfUnit TPdfUnit
TPdfUnit x_GetPageHeight(void) const
unsigned int m_PagesWide
enum EPageOrientation TPageOrientation
void SetUserUnit(TPdfUnit userunit)
unsigned int m_PagesTall
enum EOutputFormat TOutputFormat
TPdfUnit m_MarginLeft
TPdfUnit x_GetPageWidth(void) const
void DisableGouraudShading(bool b)
unsigned int m_RasterHeight
TPdfUnit m_MarginRight
TPdfUnit m_UserUnit
TPdfUnit m_MarginBottom
TPageOrientation m_PageOrientation
TPdfUnit m_HeaderOffset
TPdfUnit GetUserUnit() const
unsigned int m_RasterWidth
TPdfUnit m_FooterOffset
bool GetGouraudShadingDisabled() const
TPdfUnit m_MarginTop
TOutputFormat m_Format
float TPdfUnit
Definition: print_utils.hpp:59
Include a standard set of the NCBI C++ Toolkit most basic headers.
EOutputFormat
Definition: grid_cli.hpp:276
@ ePdf
Definition: app_popup.hpp:73
NCBI_XOBJUTIL_EXPORT string GetTitle(const CBioseq_Handle &hnd, TGetTitleFlags flags=0)
Definition: seqtitle.cpp:106
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIPRINT_EXPORT
Definition: gui_export.h:516
string GetHeader()
Definition: file_names.hpp:62
static Format format
Definition: njn_ioutil.cpp:53
CGlBitmapFont::EFontFace font
unsigned int font_size
static void SetTitle(CRef< CSeq_entry > entry, string title)
Modified on Fri Sep 20 14:57:32 2024 by modify_doxy.py rev. 669887