print_options.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:8k
- /*
- * ===========================================================================
- * PRODUCTION $Log: print_options.hpp,v $
- * PRODUCTION Revision 1000.0 2003/10/31 20:36:13 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.13
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef PRINT_TEST__OPTIONS_HPP
- #define PRINT_TEST__OPTIONS_HPP
- /* $Id: print_options.hpp,v 1000.0 2003/10/31 20:36:13 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Peter Meric
- *
- * File Description:
- * CPrintOptions -- printing options
- */
- #include <corelib/ncbistd.hpp>
- #include <gui/print/print_utils.hpp>
- BEGIN_NCBI_SCOPE
- class CMedia;
- class NCBI_GUIUTILS_EXPORT CPrintOptions
- {
- private:
- typedef CUnit::TPdfUnit TPdfUnit;
- public:
- enum EPageOrientation {
- ePortrait = 0,
- eLandscape = 270,
- eUpsideDown = 180,
- eSeascape = 90
- };
- typedef enum EPageOrientation TPageOrientation;
- enum {
- eVector = 1 << 4,
- eRaster = 1 << 5
- };
- enum EOutputFormat {
- eUnknown = 0,
- ePostscript = eVector | 1,
- ePdf = eVector | 2,
- eSvg = eVector | 3,
- ePng = eRaster | 4,
- eJpeg = eRaster | 5
- };
- typedef enum EOutputFormat TOutputFormat;
- enum EAlignment
- {
- // horizontal
- eLeft,
- eCenter,
- eRight,
- // vertical
- eTop,
- eMiddle,
- eBottom
- };
- typedef enum EAlignment TAlignment;
- static TOutputFormat GetFormatFromName(const string& fmtname);
- CPrintOptions();
- virtual ~CPrintOptions();
- void SetGenerateIndex(bool generateIdx);
- bool GetGenerateIndex(void) const;
- void SetGrayscale(bool greyscale);
- bool GetGrayscale(void) const;
- void SetPageOrientation(TPageOrientation orient);
- TPageOrientation GetPageOrientation(void) const;
- void SetFilename(const string& filename);
- const string& GetFilename(void) const;
- void SetTitle(const string& title);
- const string& GetTitle(void) const;
- void SetHeader(const string& header);
- const string& GetHeader(void) const;
- void SetFooter(const string& footer);
- const string& GetFooter(void) const;
- void SetOutputFormat(TOutputFormat fmt);
- TOutputFormat GetOutputFormat(void) const;
- static bool s_IsVectorFormat(TOutputFormat fmt);
- static bool s_IsRasterFormat(TOutputFormat fmt);
- void SetPrintOutput(bool print_output);
- bool GetPrintOutput(void) const;
- void SetPagesWide(unsigned int w);
- unsigned int GetPagesWide(void) const;
- void SetPagesTall(unsigned int w);
- unsigned int GetPagesTall(void) const;
- unsigned int GetNumPages(void) const;
- void SetMedia(const CMedia& media);
- const CMedia& GetMedia(void) const;
- TPdfUnit GetMediaHeight(void) const;
- TPdfUnit GetMediaWidth(void) const;
- bool HasRasterDimensions(void) const;
- void UnsetRasterDimensions(void);
- void SetRasterWidth(unsigned int w);
- unsigned int GetRasterWidth(void) const;
- void SetRasterHeight(unsigned int h);
- unsigned int GetRasterHeight(void) const;
- void SetHeaderOffset(TPdfUnit h);
- TPdfUnit GetHeaderOffset(void) const;
- void SetFooterOffset(TPdfUnit h);
- TPdfUnit GetFooterOffset(void) const;
- void SetMarginTop(TPdfUnit h);
- TPdfUnit GetMarginTop(void) const;
- void SetMarginBottom(TPdfUnit w);
- TPdfUnit GetMarginBottom(void) const;
- void SetMarginLeft(TPdfUnit h);
- TPdfUnit GetMarginLeft(void) const;
- void SetMarginRight(TPdfUnit w);
- TPdfUnit GetMarginRight(void) const;
- TPdfUnit GetPageTrimWidth(void) const;
- TPdfUnit GetPageTrimHeight(void) const;
- protected:
- TPdfUnit x_GetPageWidth(void) const;
- TPdfUnit x_GetPageHeight(void) const;
- private:
- // general attributes
- string m_Filename;
- string m_TempFilename;
- bool m_Grayscale;
- TOutputFormat m_Format;
- // raster-output attributes
- bool m_HasRasterDims;
- unsigned int m_RasterWidth;
- unsigned int m_RasterHeight;
- // vector-output attributes
- string m_Title;
- string m_Header;
- string m_Footer;
- TPageOrientation m_PageOrientation;
- bool m_PrintOutput;
- bool m_GenerateIndex;
- unsigned int m_PagesWide;
- unsigned int m_PagesTall;
- const CMedia* m_Media;
- TPdfUnit m_HeaderOffset;
- TPdfUnit m_FooterOffset;
- TPdfUnit m_MarginTop;
- TPdfUnit m_MarginBottom;
- TPdfUnit m_MarginLeft;
- TPdfUnit m_MarginRight;
- };
- END_NCBI_SCOPE
- #endif // PRINT_TEST__OPTIONS_HPP
- /*
- * ===========================================================================
- * $Log: print_options.hpp,v $
- * Revision 1000.0 2003/10/31 20:36:13 gouriano
- * PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.13
- *
- * Revision 1.13 2003/08/15 17:02:41 meric
- * Updates include paths for print-related files from gui/utils to gui/print
- *
- * Revision 1.12 2003/08/15 14:56:12 meric
- * Added predicate HasRasterDimensions() and function UnsetRasterDimensions()
- *
- * Revision 1.11 2003/07/15 18:34:20 meric
- * Add predicates s_IsVectorFormat() and s_IsRasterFormat()
- * Add eJpeg enumeration for JPEG format
- *
- * Revision 1.10 2003/07/15 16:45:13 meric
- * Add raster width/height
- *
- * Revision 1.9 2003/06/25 16:24:24 meric
- * Add vector/raster modifier to format type enumerations
- *
- * Revision 1.8 2003/06/24 17:25:54 meric
- * Use TPdfUnit
- *
- * Revision 1.7 2003/06/24 15:46:25 meric
- * Removed GetPageScaling() and GetPanelOffset()
- *
- * Revision 1.6 2003/06/19 00:52:43 dicuccio
- * Changed to return string by const reference rather than by value
- *
- * Revision 1.5 2003/06/17 19:49:32 meric
- * Added support for printing (PDF output to temp file)
- *
- * Revision 1.4 2003/06/16 21:44:27 meric
- * Added GetNumPages() member function
- *
- * Revision 1.3 2003/06/16 21:24:44 meric
- * Allow for negative offsets (TOffset)
- *
- * Revision 1.2 2003/06/16 21:22:16 meric
- * Fixed GetPageOffset(); added misc member functions
- *
- * Revision 1.1 2003/06/16 15:55:58 dicuccio
- * Work-in-progress: everything compiles, still much reorganization to be done.
- * Moved generic functionality out of opengl/print/ and into gui/utils (print
- * options, print dialogs, etc.). Removed interactive state from CGlCanvas.
- * Added hook in CView for opening standard print dialog, and for generic print
- * handling.
- *
- * Revision 1.2 2003/06/16 12:46:21 dicuccio
- * Clean-up after initial commit
- *
- * Revision 1.1 2003/06/13 19:00:30 meric
- * Initial version
- *
- *
- * ===========================================================================
- */