1ebfcd9afSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3ebfcd9afSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4ebfcd9afSAndrew Rist * or more contributor license agreements. See the NOTICE file
5ebfcd9afSAndrew Rist * distributed with this work for additional information
6ebfcd9afSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7ebfcd9afSAndrew Rist * to you under the Apache License, Version 2.0 (the
8ebfcd9afSAndrew Rist * "License"); you may not use this file except in compliance
9ebfcd9afSAndrew Rist * with the License. You may obtain a copy of the License at
10ebfcd9afSAndrew Rist *
11ebfcd9afSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12ebfcd9afSAndrew Rist *
13ebfcd9afSAndrew Rist * Unless required by applicable law or agreed to in writing,
14ebfcd9afSAndrew Rist * software distributed under the License is distributed on an
15ebfcd9afSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ebfcd9afSAndrew Rist * KIND, either express or implied. See the License for the
17ebfcd9afSAndrew Rist * specific language governing permissions and limitations
18ebfcd9afSAndrew Rist * under the License.
19ebfcd9afSAndrew Rist *
20ebfcd9afSAndrew Rist *************************************************************/
21ebfcd9afSAndrew Rist
22ebfcd9afSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #ifndef _PSPRINT_PRINTERUTIL_HXX_
25cdf0e10cSrcweir #define _PSPRINT_PRINTERUTIL_HXX_
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "osl/file.hxx"
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include "rtl/ustring.hxx"
30cdf0e10cSrcweir #include "rtl/string.hxx"
31cdf0e10cSrcweir #include "rtl/tencinfo.h"
32cdf0e10cSrcweir #include "rtl/textcvt.h"
33cdf0e10cSrcweir
34cdf0e10cSrcweir #include <map>
35cdf0e10cSrcweir
36cdf0e10cSrcweir namespace psp {
37cdf0e10cSrcweir
38cdf0e10cSrcweir /*
39cdf0e10cSrcweir * string convenience routines
40cdf0e10cSrcweir * sizeof(pBuffer) must be at least 2 Bytes, 0x00 <= nValue <= 0xFF,
41cdf0e10cSrcweir * effective buffer of get*ValueOf() is NOT NULL-terminated
42cdf0e10cSrcweir */
43cdf0e10cSrcweir sal_Int32 getHexValueOf (sal_Int32 nValue, sal_Char* pBuffer);
44cdf0e10cSrcweir sal_Int32 getAlignedHexValueOf (sal_Int32 nValue, sal_Char* pBuffer);
45cdf0e10cSrcweir sal_Int32 getValueOf (sal_Int32 nValue, sal_Char* pBuffer);
46cdf0e10cSrcweir sal_Int32 appendStr (const sal_Char* pSrc, sal_Char* pDst);
47cdf0e10cSrcweir sal_Int32 appendStr (const sal_Char* pSrc, sal_Char* pDst, sal_Int32 nBytes);
appendStr(const::rtl::OString & rSrc,sal_Char * pDst)48*24c56ab9SHerbert Dürr inline sal_Int32 appendStr( const ::rtl::OString& rSrc, sal_Char* pDst) { return appendStr( rSrc.getStr(), pDst);}
49cdf0e10cSrcweir
50cdf0e10cSrcweir sal_Bool WritePS (osl::File* pFile, const sal_Char* pString);
51cdf0e10cSrcweir sal_Bool WritePS (osl::File* pFile, const sal_Char* pString, sal_uInt64 nInLength);
52cdf0e10cSrcweir sal_Bool WritePS (osl::File* pFile, const rtl::OString &rString);
53cdf0e10cSrcweir sal_Bool WritePS (osl::File* pFile, const rtl::OUString &rString);
54cdf0e10cSrcweir
55cdf0e10cSrcweir class ConverterFactory
56cdf0e10cSrcweir {
57cdf0e10cSrcweir
58cdf0e10cSrcweir public:
59cdf0e10cSrcweir ConverterFactory();
60cdf0e10cSrcweir ~ConverterFactory();
61cdf0e10cSrcweir rtl_UnicodeToTextConverter Get (rtl_TextEncoding nEncoding);
62cdf0e10cSrcweir sal_Size Convert (const sal_Unicode *pText, int nTextLen,
63cdf0e10cSrcweir sal_uChar *pBuffer, sal_Size nBufferSize,
64cdf0e10cSrcweir rtl_TextEncoding nEncoding);
65cdf0e10cSrcweir private:
66cdf0e10cSrcweir
67cdf0e10cSrcweir std::map< rtl_TextEncoding, rtl_UnicodeToTextConverter > m_aConverters;
68cdf0e10cSrcweir };
69cdf0e10cSrcweir
70cdf0e10cSrcweir ConverterFactory* GetConverterFactory ();
71cdf0e10cSrcweir
72cdf0e10cSrcweir } /* namespace psp */
73cdf0e10cSrcweir
74cdf0e10cSrcweir #endif /* _PSPRINT_PRINTERUTIL_HXX_ */
75cdf0e10cSrcweir
76