Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #include <string.h>
21 : :
22 : : #include <tools/date.hxx>
23 : : #include <tools/time.hxx>
24 : : #include <tools/rc.hxx>
25 : : #include <tools/rcid.h>
26 : :
27 : 33276 : Resource::Resource( const ResId& rResId )
28 : : {
29 : 33276 : GetRes( rResId.SetRT( RSC_RESOURCE ) );
30 : 33276 : }
31 : :
32 : 56130 : void Resource::GetRes( const ResId& rResId )
33 : : {
34 [ + - ]: 56130 : if( rResId.GetResMgr() )
35 : 56130 : m_pResMgr = rResId.GetResMgr();
36 : 56130 : m_pResMgr->GetResource( rResId, this );
37 : 56130 : IncrementRes( sizeof( RSHEADER_TYPE ) );
38 : 56130 : }
39 : :
40 : 0 : Time::Time( const ResId& rResId )
41 : : {
42 : 0 : nTime = 0;
43 : 0 : rResId.SetRT( RSC_TIME );
44 : 0 : ResMgr* pResMgr = NULL;
45 : :
46 [ # # ]: 0 : ResMgr::GetResourceSkipHeader( rResId, &pResMgr );
47 : :
48 [ # # ]: 0 : sal_uIntPtr nObjMask = (sal_uInt16)pResMgr->ReadLong();
49 : :
50 [ # # ]: 0 : if ( 0x01 & nObjMask )
51 [ # # ][ # # ]: 0 : SetHour( (sal_uInt16)pResMgr->ReadShort() );
52 [ # # ]: 0 : if ( 0x02 & nObjMask )
53 [ # # ][ # # ]: 0 : SetMin( (sal_uInt16)pResMgr->ReadShort() );
54 [ # # ]: 0 : if ( 0x04 & nObjMask )
55 [ # # ][ # # ]: 0 : SetSec( (sal_uInt16)pResMgr->ReadShort() );
56 [ # # ]: 0 : if ( 0x08 & nObjMask )
57 [ # # ][ # # ]: 0 : Set100Sec( (sal_uInt16)pResMgr->ReadShort() );
58 : 0 : }
59 : :
60 : 0 : Date::Date( const ResId& rResId ) : nDate(0)
61 : : {
62 : 0 : rResId.SetRT( RSC_DATE );
63 : 0 : ResMgr* pResMgr = NULL;
64 : :
65 [ # # ]: 0 : ResMgr::GetResourceSkipHeader( rResId, &pResMgr );
66 : :
67 [ # # ]: 0 : sal_uIntPtr nObjMask = (sal_uInt16)pResMgr->ReadLong();
68 : :
69 [ # # ]: 0 : if ( 0x01 & nObjMask )
70 [ # # ][ # # ]: 0 : SetYear( (sal_uInt16)pResMgr->ReadShort() );
71 [ # # ]: 0 : if ( 0x02 & nObjMask )
72 [ # # ][ # # ]: 0 : SetMonth( (sal_uInt16)pResMgr->ReadShort() );
73 [ # # ]: 0 : if ( 0x04 & nObjMask )
74 [ # # ][ # # ]: 0 : SetDay( (sal_uInt16)pResMgr->ReadShort() );
75 : 0 : }
76 : :
77 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|