Update ooo320-m1
[ooovba.git] / vcl / unx / source / printergfx / psputil.hxx
blob36f9b2cc6660021bf2e79d2dacce629efe2b2d1f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: psputil.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _PSPRINT_PRINTERUTIL_HXX_
32 #define _PSPRINT_PRINTERUTIL_HXX_
34 #include "osl/file.hxx"
36 #include "rtl/ustring.hxx"
37 #include "rtl/string.hxx"
38 #include "rtl/tencinfo.h"
39 #include "rtl/textcvt.h"
41 #include <map>
43 namespace psp {
45 /*
46 * string convenience routines
47 * sizeof(pBuffer) must be at least 2 Bytes, 0x00 <= nValue <= 0xFF,
48 * effective buffer of get*ValueOf() is NOT NULL-terminated
50 sal_Int32 getHexValueOf (sal_Int32 nValue, sal_Char* pBuffer);
51 sal_Int32 getAlignedHexValueOf (sal_Int32 nValue, sal_Char* pBuffer);
52 sal_Int32 getValueOf (sal_Int32 nValue, sal_Char* pBuffer);
53 sal_Int32 appendStr (const sal_Char* pSrc, sal_Char* pDst);
54 sal_Int32 appendStr (const sal_Char* pSrc, sal_Char* pDst, sal_Int32 nBytes);
56 sal_Bool WritePS (osl::File* pFile, const sal_Char* pString);
57 sal_Bool WritePS (osl::File* pFile, const sal_Char* pString, sal_uInt64 nInLength);
58 sal_Bool WritePS (osl::File* pFile, const rtl::OString &rString);
59 sal_Bool WritePS (osl::File* pFile, const rtl::OUString &rString);
61 class ConverterFactory
64 public:
65 ConverterFactory();
66 ~ConverterFactory();
67 rtl_UnicodeToTextConverter Get (rtl_TextEncoding nEncoding);
68 sal_Size Convert (const sal_Unicode *pText, int nTextLen,
69 sal_uChar *pBuffer, sal_Size nBufferSize,
70 rtl_TextEncoding nEncoding);
71 private:
73 std::map< rtl_TextEncoding, rtl_UnicodeToTextConverter > m_aConverters;
76 ConverterFactory* GetConverterFactory ();
78 } /* namespace psp */
80 #endif /* _PSPRINT_PRINTERUTIL_HXX_ */