2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 12:54:29 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:54:29 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:54:29 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:54:29 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:54:29 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:54:29 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 23:59:44 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_tools.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#define _TOOLS_RC_CXX
|
|
|
|
|
|
|
|
#include <string.h>
|
2007-06-27 21:16:55 +00:00
|
|
|
#include <tools/date.hxx>
|
|
|
|
#include <tools/time.hxx>
|
|
|
|
#include <tools/rc.hxx>
|
|
|
|
#include <tools/rcid.h>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
Resource::Resource( const ResId& rResId )
|
|
|
|
{
|
|
|
|
GetRes( rResId.SetRT( RSC_RESOURCE ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Resource::GetRes( const ResId& rResId )
|
|
|
|
{
|
2007-04-26 08:47:56 +00:00
|
|
|
if( rResId.GetResMgr() )
|
|
|
|
m_pResMgr = rResId.GetResMgr();
|
|
|
|
m_pResMgr->GetResource( rResId, this );
|
2000-09-18 16:07:07 +00:00
|
|
|
IncrementRes( sizeof( RSHEADER_TYPE ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
Time::Time( const ResId& rResId )
|
|
|
|
{
|
|
|
|
nTime = 0;
|
|
|
|
rResId.SetRT( RSC_TIME );
|
|
|
|
ResMgr* pResMgr = NULL;
|
|
|
|
|
|
|
|
ResMgr::GetResourceSkipHeader( rResId, &pResMgr );
|
|
|
|
|
2005-01-03 16:08:36 +00:00
|
|
|
ULONG nObjMask = (USHORT)pResMgr->ReadLong();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( 0x01 & nObjMask )
|
|
|
|
SetHour( (USHORT)pResMgr->ReadShort() );
|
|
|
|
if ( 0x02 & nObjMask )
|
|
|
|
SetMin( (USHORT)pResMgr->ReadShort() );
|
|
|
|
if ( 0x04 & nObjMask )
|
|
|
|
SetSec( (USHORT)pResMgr->ReadShort() );
|
|
|
|
if ( 0x08 & nObjMask )
|
|
|
|
Set100Sec( (USHORT)pResMgr->ReadShort() );
|
|
|
|
}
|
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
2008-02-27 09:19:44 +00:00
|
|
|
Date::Date( const ResId& rResId ) : nDate(0)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
rResId.SetRT( RSC_DATE );
|
|
|
|
ResMgr* pResMgr = NULL;
|
|
|
|
|
|
|
|
ResMgr::GetResourceSkipHeader( rResId, &pResMgr );
|
|
|
|
|
2005-01-03 16:08:36 +00:00
|
|
|
ULONG nObjMask = (USHORT)pResMgr->ReadLong();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( 0x01 & nObjMask )
|
|
|
|
SetYear( (USHORT)pResMgr->ReadShort() );
|
|
|
|
if ( 0x02 & nObjMask )
|
|
|
|
SetMonth( (USHORT)pResMgr->ReadShort() );
|
|
|
|
if ( 0x04 & nObjMask )
|
|
|
|
SetDay( (USHORT)pResMgr->ReadShort() );
|
|
|
|
}
|