diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2011-02-23 16:37:27 +0100 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2011-02-23 16:37:27 +0100 |
commit | 3bcb29437f1d91476e759f0a6d3b72d7da3ce37f (patch) | |
tree | 5f58d1540b1a94f05ed44e20108479917d5a0856 /vcl/source/gdi/print.cxx | |
parent | c7908996ac968e0c10e6b60590d8d54748fe4e69 (diff) | |
parent | e2a3d487efb2bd5e582eb10e4150530c3f7377c5 (diff) |
vcl119: rebase to DEV300_m101
Diffstat (limited to 'vcl/source/gdi/print.cxx')
-rw-r--r-- | vcl/source/gdi/print.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index c00dfd7635ae..e5e19dff3771 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -41,6 +41,7 @@ #include <vcl/unohelp.hxx> #include <tools/debug.hxx> +#include <tools/resary.hxx> #include <tools/stream.hxx> #include <tools/vcompat.hxx> #include <vcl/svdata.hxx> @@ -54,6 +55,7 @@ #include <vcl/gdimtf.hxx> #include <vcl/metaact.hxx> #include <vcl/print.hxx> +#include <vcl/svids.hrc> #include <comphelper/processfactory.hxx> @@ -1280,6 +1282,48 @@ int Printer::GetPaperInfoCount() const // ----------------------------------------------------------------------- +rtl::OUString Printer::GetPaperName( Paper ePaper ) +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->mpPaperNames ) + { + pSVData->mpPaperNames = new std::hash_map< int, rtl::OUString >(); + if( ImplGetResMgr() ) + { + ResStringArray aPaperStrings( VclResId( RID_STR_PAPERNAMES ) ); + static const int PaperIndex[] = + { + PAPER_A0, PAPER_A1, PAPER_A2, PAPER_A3, PAPER_A4, PAPER_A5, + PAPER_B4_ISO, PAPER_B5_ISO, PAPER_LETTER, PAPER_LEGAL, PAPER_TABLOID, + PAPER_USER, PAPER_B6_ISO, PAPER_ENV_C4, PAPER_ENV_C5, PAPER_ENV_C6, PAPER_ENV_C65, + PAPER_ENV_DL, PAPER_SLIDE_DIA, PAPER_SCREEN, PAPER_C, PAPER_D, PAPER_E, + PAPER_EXECUTIVE, PAPER_FANFOLD_LEGAL_DE, PAPER_ENV_MONARCH, PAPER_ENV_PERSONAL, + PAPER_ENV_9, PAPER_ENV_10, PAPER_ENV_11, PAPER_ENV_12, PAPER_KAI16, + PAPER_KAI32, PAPER_KAI32BIG, PAPER_B4_JIS, PAPER_B5_JIS, PAPER_B6_JIS + }; + OSL_ENSURE( sal_uInt32(sizeof(PaperIndex)/sizeof(PaperIndex[0])) == aPaperStrings.Count(), "localized paper name count wrong" ); + for( int i = 0; i < int(sizeof(PaperIndex)/sizeof(PaperIndex[0])); i++ ) + (*pSVData->mpPaperNames)[PaperIndex[i]] = aPaperStrings.GetString(i); + } + } + + std::hash_map<int,rtl::OUString>::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper ); + return (it != pSVData->mpPaperNames->end()) ? it->second : rtl::OUString(); +} + +// ----------------------------------------------------------------------- + +rtl::OUString Printer::GetPaperName( bool i_bPaperUser ) const +{ + Size aPageSize = PixelToLogic( GetPaperSizePixel(), MAP_100TH_MM ); + Paper ePaper = ImplGetPaperFormat( aPageSize.Width(), aPageSize.Height() ); + if( ePaper == PAPER_USER ) + ePaper = ImplGetPaperFormat( aPageSize.Height(), aPageSize.Width() ); + return (ePaper != PAPER_USER || i_bPaperUser ) ? GetPaperName( ePaper ) : rtl::OUString(); +} + +// ----------------------------------------------------------------------- + const PaperInfo& Printer::GetPaperInfo( int nPaper ) const { if( ! mpInfoPrinter ) |