fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / tools / source / rc / rc.cxx
blobee7470c91d513059927373bc07ed7a35a1284433
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <string.h>
21 #include <rtl/ustrbuf.hxx>
22 #include <tools/date.hxx>
23 #include <tools/time.hxx>
24 #include <tools/rc.hxx>
25 #include <tools/rcid.h>
27 Resource::Resource( const ResId& rResId )
28 : m_pResMgr(NULL)
30 GetRes( rResId.SetRT( RSC_RESOURCE ) );
33 void Resource::GetRes( const ResId& rResId )
35 if( rResId.GetResMgr() )
36 m_pResMgr = rResId.GetResMgr();
37 assert(m_pResMgr);
38 m_pResMgr->GetResource( rResId, this );
39 IncrementRes( sizeof( RSHEADER_TYPE ) );
42 OUString ResId::toString() const
44 SetRT( RSC_STRING );
45 ResMgr* pResMgr = GetResMgr();
47 if ( !pResMgr || !pResMgr->GetResource( *this ) )
49 OUString sRet;
51 #if OSL_DEBUG_LEVEL > 0
52 sRet = OUStringBuffer().
53 append("<resource id ").
54 append(static_cast<sal_Int32>(GetId())).
55 append(" not found>").
56 makeStringAndClear();
57 #endif
59 if( pResMgr )
60 pResMgr->PopContext();
62 return sRet;
65 // String loading
66 RSHEADER_TYPE * pResHdr = static_cast<RSHEADER_TYPE*>(pResMgr->GetClass());
68 sal_Int32 nStringLen = rtl_str_getLength( reinterpret_cast<char*>(pResHdr+1) );
69 OUString sRet(reinterpret_cast<char*>(pResHdr+1), nStringLen, RTL_TEXTENCODING_UTF8);
71 sal_uInt32 nSize = sizeof( RSHEADER_TYPE )
72 + sal::static_int_cast< sal_uInt32 >(nStringLen) + 1;
73 nSize += nSize % 2;
74 pResMgr->Increment( nSize );
76 ResHookProc pImplResHookProc = ResMgr::GetReadStringHook();
77 if ( pImplResHookProc )
78 sRet = pImplResHookProc(sRet);
79 return sRet;
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */