diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-18 17:13:03 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-19 13:42:07 +0200 |
commit | 2b83e73fd7b059c4ad224e3163f9d57c6cc6e1c7 (patch) | |
tree | eb160ecdcaf9ba8c114eeef82261d9ad199d5b40 /rsc/source | |
parent | 31aac86f14d088628979c7809588f14bef643feb (diff) |
remove freshly unused menu support from src files
Change-Id: I038711a0c4d440d452d5b2ae1bfcba5c9305815b
Reviewed-on: https://gerrit.libreoffice.org/36646
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'rsc/source')
-rw-r--r-- | rsc/source/parser/rscdb.cxx | 11 | ||||
-rw-r--r-- | rsc/source/parser/rscibas.cxx | 1 | ||||
-rw-r--r-- | rsc/source/parser/rscicpx.cxx | 128 | ||||
-rw-r--r-- | rsc/source/parser/rscinit.cxx | 21 | ||||
-rw-r--r-- | rsc/source/parser/rscyacc.y | 1 | ||||
-rw-r--r-- | rsc/source/res/rscarray.cxx | 14 | ||||
-rw-r--r-- | rsc/source/res/rscclass.cxx | 18 | ||||
-rw-r--r-- | rsc/source/res/rscconst.cxx | 5 | ||||
-rw-r--r-- | rsc/source/res/rsccont.cxx | 5 | ||||
-rw-r--r-- | rsc/source/res/rscflag.cxx | 347 | ||||
-rw-r--r-- | rsc/source/res/rscrange.cxx | 276 | ||||
-rw-r--r-- | rsc/source/res/rscstr.cxx | 5 | ||||
-rw-r--r-- | rsc/source/res/rsctop.cxx | 6 |
13 files changed, 3 insertions, 835 deletions
diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx index 1b76102351e2..e61532613769 100644 --- a/rsc/source/parser/rscdb.cxx +++ b/rsc/source/parser/rscdb.cxx @@ -21,11 +21,11 @@ #include <stdio.h> #include <string.h> -#include <tools/rc.h> #include <i18nlangtag/languagetag.hxx> #include <rtl/strbuf.hxx> #include <sal/log.hxx> #include <sal/macros.h> +#include <tools/rcid.h> #include <rsctree.hxx> #include <rsctop.hxx> @@ -44,13 +44,8 @@ RscTypCont::RscTypCont( RscError * pErrHdl, , nUniqueId(256) , nFilePos( 0 ) , nPMId(RSC_VERSIONCONTROL + RESOURCE_TYPE(1)) // at least one more - , aBool( pHS->getID( "sal_Bool" ), RSC_NOTYPE ) - , aShort( pHS->getID( "short" ), RSC_NOTYPE ) - , aUShort( pHS->getID( "sal_uInt16" ), RSC_NOTYPE ) , aEnumLong( pHS->getID( "enum_long" ), RSC_NOTYPE ) - , aIdNoZeroUShort( pHS->getID( "IDUSHORT" ), RSC_NOTYPE ) , aString( pHS->getID( "Chars" ), RSC_NOTYPE ) - , aStringLiteral( pHS->getID( "Chars" ), RSC_NOTYPE ) , aLangType() , aLangString( pHS->getID( "Lang_Chars" ), RSC_NOTYPE, &aString, &aLangType ) , pEH(pErrHdl) @@ -171,10 +166,6 @@ RscTypCont::~RscTypCont() for (RscTop* pItem : aBaseLst) pItem->Pre_dtor(); - aBool.Pre_dtor(); - aShort.Pre_dtor(); - aUShort.Pre_dtor(); - aIdNoZeroUShort.Pre_dtor(); aString.Pre_dtor(); aVersion.pClass->Pre_dtor(); // sub-types diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx index 7b58d6885d77..8aea89f93937 100644 --- a/rsc/source/parser/rscibas.cxx +++ b/rsc/source/parser/rscibas.cxx @@ -29,7 +29,6 @@ #include <tools/fldunit.hxx> #include <tools/gen.hxx> #include <tools/mapunit.hxx> -#include <tools/rc.h> #include <tools/wintypes.hxx> #include <rsc/rsc-vcl-shared-types.hxx> diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx index 69651c7cdd49..929ed89be284 100644 --- a/rsc/source/parser/rscicpx.cxx +++ b/rsc/source/parser/rscicpx.cxx @@ -21,7 +21,7 @@ #include <stdlib.h> #include <stdio.h> -#include <tools/rc.h> +#include <tools/rcid.h> #include <tools/wintypes.hxx> #include <rsc/rsc-vcl-shared-types.hxx> @@ -88,130 +88,4 @@ RscTop * RscTypCont::InitClassBitmap( RscTop * pSuper ) return pClassBitmap; } -RscTop * RscTypCont::InitClassMenuItem( RscTop * pSuper ) -{ - Atom nId; - RscTop * pClassMenuItem; - - // initialize class - nId = pHS->getID( "MenuItem" ); - pClassMenuItem = new RscClass( nId, RSC_MENUITEM, pSuper ); - aNmTb.Put( nId, CLASSNAME, pClassMenuItem ); - - // initialize variables - nId = aNmTb.Put( "Separator", VARNAME ); - pClassMenuItem->SetVariable( nId, &aBool, nullptr, RSCVAR::NONE, - (sal_uInt32)RscMenuItem::Separator ); - nId = aNmTb.Put( "Identifier", VARNAME ); - pClassMenuItem->SetVariable( nId, &aIdNoZeroUShort, nullptr, RSCVAR::NONE, - (sal_uInt32)RscMenuItem::Id ); - { - RscFlag * pFlag; - RscClient * pClient; - Atom nVarId, nAutoCheckId, nRadioCheckId; - Atom nCheckableId, nAboutId, nHelpId; - - aBaseLst.push_back( pFlag = new RscFlag( pHS->getID( "FlagMenuState" ), RSC_NOTYPE ) ); - - // set constants in table - nCheckableId = pHS->getID( "MIB_CHECKABLE" ); - SETCONST( pFlag, nCheckableId, MenuItemBits::CHECKABLE ); - nAutoCheckId = pHS->getID( "MIB_AUTOCHECK" ); - SETCONST( pFlag, nAutoCheckId, MenuItemBits::AUTOCHECK ); - nRadioCheckId = pHS->getID( "MIB_RADIOCHECK" ); - SETCONST( pFlag, nRadioCheckId, MenuItemBits::RADIOCHECK ); - nAboutId = pHS->getID( "MIB_ABOUT" ); - SETCONST( pFlag, nAboutId, MenuItemBits::ABOUT ); - nHelpId = pHS->getID( "MIB_HELP" ); - SETCONST( pFlag, nHelpId, MenuItemBits::HELP ); - - // add variable - nVarId = aNmTb.Put( "_MenuItemFlags", VARNAME ); - pClassMenuItem->SetVariable( nVarId, pFlag, nullptr, - RSCVAR::Hidden | RSCVAR::NoEnum, - (sal_uInt32)RscMenuItem::Status ); - - // add client variables - aBaseLst.push_back( - pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nCheckableId ) - ); - nId = aNmTb.Put( "Checkable", VARNAME ); - pClassMenuItem->SetVariable( nId, pClient, nullptr, - RSCVAR::NoDataInst, 0, nVarId ); - - aBaseLst.push_back( - pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nAutoCheckId ) - ); - nId = aNmTb.Put( "AutoCheck", VARNAME ); - pClassMenuItem->SetVariable( nId, pClient, nullptr, - RSCVAR::NoDataInst, 0, nVarId ); - - aBaseLst.push_back( - pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nRadioCheckId ) - ); - nId = aNmTb.Put( "RadioCheck", VARNAME ); - pClassMenuItem->SetVariable( nId, pClient, nullptr, - RSCVAR::NoDataInst, 0, nVarId ); - - aBaseLst.push_back( - pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nAboutId ) - ); - nId = aNmTb.Put( "About", VARNAME ); - pClassMenuItem->SetVariable( nId, pClient, nullptr, - RSCVAR::NoDataInst, 0, nVarId ); - - aBaseLst.push_back( - pClient = new RscClient( pHS->getID( "sal_Bool" ), RSC_NOTYPE, pFlag, nHelpId ) - ); - nId = aNmTb.Put( "Help", VARNAME ); - pClassMenuItem->SetVariable( nId, pClient, nullptr, - RSCVAR::NoDataInst, 0, nVarId ); - - } - nId = aNmTb.Put( "Text", VARNAME ); - pClassMenuItem->SetVariable( nId, &aLangString, nullptr, RSCVAR::NONE, - (sal_uInt32)RscMenuItem::Text ); - nId = aNmTb.Put( "HelpText", VARNAME ); - pClassMenuItem->SetVariable( nId, &aLangString, nullptr, RSCVAR::NONE, - (sal_uInt32)RscMenuItem::HelpText ); - nId = aNmTb.Put( "HelpID", VARNAME ); - pClassMenuItem->SetVariable( nId, &aStringLiteral, nullptr, RSCVAR::NONE, - (sal_uInt32)RscMenuItem::HelpId ); - nId = aNmTb.Put( "Disable", VARNAME ); - pClassMenuItem->SetVariable( nId, &aBool, nullptr, RSCVAR::NONE, - (sal_uInt32)RscMenuItem::Disable ); - nId = aNmTb.Put( "Command", VARNAME ); - pClassMenuItem->SetVariable( nId, &aString, nullptr, RSCVAR::NONE, - (sal_uInt32)RscMenuItem::Command ); - - return pClassMenuItem; -} - -RscTop * RscTypCont::InitClassMenu( RscTop * pSuper, - RscTop * pClassMenuItem ) -{ - Atom nId; - RscTop * pClassMenu; - - // initialize class - nId = pHS->getID( "Menu" ); - pClassMenu = new RscClass( nId, RSC_MENU, pSuper ); - pClassMenu->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); - aNmTb.Put( nId, CLASSNAME, pClassMenu ); - - // initialize variables - { - RscCont * pCont; - - aBaseLst.push_back( pCont = new RscCont( pHS->getID( "ContMenuItem" ), RSC_NOTYPE ) ); - pCont->SetTypeClass( pClassMenuItem ); - nId = aNmTb.Put( "ItemList", VARNAME ); - pClassMenu->SetVariable( nId, pCont, nullptr, RSCVAR::NONE, (sal_uInt32)RscMenu::Items ); - } - nId = aNmTb.Put( "Text", VARNAME ); - pClassMenu->SetVariable( nId, &aLangString, nullptr, RSCVAR::NONE, (sal_uInt32)RscMenu::Text ); - - return pClassMenu; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx index 4ecf9f657fdd..a330f739fe2d 100644 --- a/rsc/source/parser/rscinit.cxx +++ b/rsc/source/parser/rscinit.cxx @@ -21,14 +21,13 @@ #include <stdlib.h> #include <stdio.h> -#include <tools/rc.h> +#include <tools/rcid.h> #include <tools/wintypes.hxx> #include <rsctree.hxx> #include <rsctop.hxx> #include <rscrange.hxx> #include <rscconst.hxx> -#include <rscflag.hxx> #include <rscstr.hxx> #include <rsccont.hxx> #include <rscmgr.hxx> @@ -67,13 +66,7 @@ void RscTypCont::Init() aNmTb.Put( "FALSE", BOOLEAN, (sal_IntPtr)false ); } { - aShort.SetRange( -32768, 32767 ); - - aUShort.SetRange( 0, 0xFFFF ); - aEnumLong.SetRange( SAL_MIN_INT32, SAL_MAX_INT32 ); - - aIdNoZeroUShort.SetRange( 1, 0xFFFF ); } { aLangType.Init( aNmTb ); @@ -111,18 +104,6 @@ void RscTypCont::Init() pRoot->Insert( pClassBitmap ); } -{ - RscTop* pClassMenuItem = InitClassMenuItem(pClassMgr); - pRoot->Insert( pClassMenuItem ); - - RscTop* pClassMenu = InitClassMenu( pClassMgr, pClassMenuItem ); - pRoot->Insert( pClassMenu ); - - // pClassMenu is only completely defined here - nId = aNmTb.Put( "SubMenu", VARNAME ); - pClassMenuItem->SetVariable( nId, pClassMenu, nullptr, RSCVAR::SvDynamic, - (sal_uInt32)RscMenuItem::Menu ); -} aNmTb.SetSort(); } diff --git a/rsc/source/parser/rscyacc.y b/rsc/source/parser/rscyacc.y index d4cad7f1103c..6fd4eda414ef 100644 --- a/rsc/source/parser/rscyacc.y +++ b/rsc/source/parser/rscyacc.y @@ -25,7 +25,6 @@ #include <string.h> #include <rtl/strbuf.hxx> -#include <tools/rc.h> #include <rscerror.h> #include <rsctools.hxx> #include <rscclass.hxx> diff --git a/rsc/source/res/rscarray.cxx b/rsc/source/res/rscarray.cxx index 0b86f75a73b3..3efd01a3dad0 100644 --- a/rsc/source/res/rscarray.cxx +++ b/rsc/source/res/rscarray.cxx @@ -56,11 +56,6 @@ RscArray::~RscArray() { } -RSCCLASS_TYPE RscArray::GetClassType() const -{ - return RSCCLASS_ENUMARRAY; -} - RscTop * RscArray::GetTypeClass() const { return pTypeClass; @@ -428,13 +423,4 @@ RscLangArray::RscLangArray( Atom nId, RESOURCE_TYPE nTypeId, RscTop * pSuper, { } -RSCCLASS_TYPE RscLangArray::GetClassType() const -{ - if( GetSuperClass() ) - return GetSuperClass()->GetClassType(); - else - return RscArray::GetClassType(); - -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/res/rscclass.cxx b/rsc/source/res/rscclass.cxx index 1bbac234094c..a6922310308f 100644 --- a/rsc/source/res/rscclass.cxx +++ b/rsc/source/res/rscclass.cxx @@ -26,7 +26,6 @@ #include <rscclass.hxx> #include <tools/rcid.h> -#include <tools/rc.h> RscClass::RscClass( Atom nId, RESOURCE_TYPE nTypeId, RscTop * pSuperCl ) : RscTop( nId, nTypeId, pSuperCl ) @@ -61,11 +60,6 @@ RscClass::~RscClass() rtl_freeMemory( static_cast<void *>(pVarTypeList) ); } -RSCCLASS_TYPE RscClass::GetClassType() const -{ - return RSCCLASS_COMPLEX; -} - RSCINST RscClass::GetInstData ( CLASS_DATA pData, @@ -262,18 +256,6 @@ ERRTYPE RscClass::SetVariable( Atom nVarName, return ERR_OK; } -void RscClass::EnumVariables( void * pData, VarEnumCallbackProc pProc ) -{ - sal_uInt32 i; - - RscTop::EnumVariables( pData, pProc ); - for( i = 0; i < nEntries; i ++ ) - { - if( !(pVarTypeList[ i ].nVarType & RSCVAR::NoEnum) ) - (*pProc)( pData, pVarTypeList[ i ].pClass->GetClassType(), pVarTypeList[ i ].nVarName ); - } -} - RSCINST RscClass::GetVariable( const RSCINST & rInst, Atom nVarName, const RSCINST & rInitInst, diff --git a/rsc/source/res/rscconst.cxx b/rsc/source/res/rscconst.cxx index 81c9010572df..281c8b02ad3b 100644 --- a/rsc/source/res/rscconst.cxx +++ b/rsc/source/res/rscconst.cxx @@ -38,11 +38,6 @@ RscConst::~RscConst() rtl_freeMemory( static_cast<void *>(pVarArray) ); } -RSCCLASS_TYPE RscConst::GetClassType() const -{ - return RSCCLASS_CONST; -} - void RscConst::SetConstant( Atom nVarName, sal_Int32 lValue ) { if( pVarArray ) diff --git a/rsc/source/res/rsccont.cxx b/rsc/source/res/rsccont.cxx index 636cbe4e4feb..dad3aa9db830 100644 --- a/rsc/source/res/rsccont.cxx +++ b/rsc/source/res/rsccont.cxx @@ -49,11 +49,6 @@ RscBaseCont::~RscBaseCont() { } -RSCCLASS_TYPE RscBaseCont::GetClassType() const -{ - return RSCCLASS_COMPLEX; -} - void RscBaseCont::DestroyElements( RscBaseContInst * pClassData ) { if( pClassData->nEntries ) diff --git a/rsc/source/res/rscflag.cxx b/rsc/source/res/rscflag.cxx deleted file mode 100644 index 10661816092f..000000000000 --- a/rsc/source/res/rscflag.cxx +++ /dev/null @@ -1,347 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include <rscflag.hxx> - -RscFlag::RscFlag( Atom nId, RESOURCE_TYPE nTypeId ) - : RscConst( nId, nTypeId ) -{ -} - -sal_uInt32 RscFlag::Size() const -{ - return ALIGNED_SIZE( sizeof( RscFlagInst ) * - ( 1 + (nEntries -1) / (sizeof( sal_uInt32 ) * 8) ) ); -} - -ERRTYPE RscFlag::SetNotConst( const RSCINST & rInst, Atom nConst ) -{ - sal_uInt32 i = 0; - - if( nEntries != (i = GetConstPos( nConst )) ) - { - sal_uInt32 nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); - - i = i / (sizeof( sal_uInt32 ) * 8); - reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nFlags &= ~nFlag; - reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nDfltFlags &= ~nFlag; - return ERR_OK; - } - - return ERR_RSCFLAG; -} - -ERRTYPE RscFlag::SetConst( const RSCINST & rInst, Atom nConst, sal_Int32 /*nVal*/ ) -{ - sal_uInt32 i = 0; - - if( nEntries != (i = GetConstPos( nConst )) ) - { - sal_uInt32 nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); - - i = i / (sizeof( sal_uInt32 ) * 8); - reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nFlags |= nFlag; - reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nDfltFlags &= ~nFlag; - return ERR_OK; - } - - return ERR_RSCFLAG; -} - -RSCINST RscFlag::CreateBasic( RSCINST * pInst ) -{ - RSCINST aInst; - - if( !pInst ) - { - aInst.pClass = this; - aInst.pData = static_cast<CLASS_DATA>(rtl_allocateMemory( Size() )); - } - else - aInst = *pInst; - - return aInst; -} - -RSCINST RscFlag::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass ) -{ - RSCINST aInst = CreateBasic( pInst ); - - if( !bOwnClass && rDflt.IsInst() ) - bOwnClass = rDflt.pClass->InHierarchy( this ); - - if( bOwnClass ) - memmove( aInst.pData, rDflt.pData, Size() ); - else - { - for( sal_uInt32 i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) - { - reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nFlags = 0; - reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nDfltFlags = 0xFFFFFFFF; - } - } - - return aInst; -} - -RSCINST RscFlag::CreateClient( RSCINST * pInst, const RSCINST & rDfltI, - bool bOwnClass, Atom nConstId ) -{ - RSCINST aInst = CreateBasic( pInst ); - sal_uInt32 i = 0; - - if( !bOwnClass && rDfltI.IsInst() ) - bOwnClass = rDfltI.pClass->InHierarchy( this ); - - if( nEntries != (i = GetConstPos( nConstId )) ) - { - sal_uInt32 nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); - i = i / (sizeof( sal_uInt32 ) * 8); - if( bOwnClass ) - { - reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nFlags &= - ~nFlag | reinterpret_cast<RscFlagInst *>(rDfltI.pData)[ i ].nFlags; - reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nDfltFlags &= - ~nFlag | reinterpret_cast<RscFlagInst *>(rDfltI.pData)[ i ].nDfltFlags; - } - else - { - reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nFlags &= ~nFlag; - reinterpret_cast<RscFlagInst *>(aInst.pData)[ i ].nDfltFlags |= nFlag; - } - } - - return aInst; -} - -void RscFlag::SetToDefault( const RSCINST & rInst ) -{ - sal_uInt32 i = 0; - - for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) - reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nDfltFlags = 0xFFFFFFFF; -} - -bool RscFlag::IsDefault( const RSCINST & rInst ) -{ - sal_uInt32 i = 0; - - for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) - { - if( reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nDfltFlags != 0xFFFFFFFF ) - return false; - } - return true; -} - -bool RscFlag::IsDefault( const RSCINST & rInst, Atom nConstId ) -{ - sal_uInt32 i = 0, nFlag = 0; - - if( nEntries != (i = GetConstPos( nConstId )) ) - { - nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); - i = i / (sizeof( sal_uInt32 ) * 8); - - if( reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nDfltFlags & nFlag ) - return true ; - else - return false; - } - return true; -} - -bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef, - Atom nConstId ) -{ - sal_uInt32 i = 0, nFlag = 0; - - if( nEntries != (i = GetConstPos( nConstId )) ) - { - nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); - i = i / (sizeof( sal_uInt32 ) * 8); - - if( pDef ) - { - if( (reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nFlags & nFlag) == - (reinterpret_cast<RscFlagInst *>(pDef)[ i ].nFlags & nFlag) ) - { - return true; - } - } - } - - return false; -} - -bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) -{ - if( pDef ) - { - sal_uInt32 Flag = 0, nIndex = 0; - - Flag = 1; - for( sal_uInt32 i = 0; i < nEntries; i++ ) - { - nIndex = i / (sizeof( sal_uInt32 ) * 8); - - if( (reinterpret_cast<RscFlagInst *>(rInst.pData)[ nIndex ].nFlags & Flag) != - (reinterpret_cast<RscFlagInst *>(pDef)[ nIndex ].nFlags & Flag) ) - { - return false; - } - Flag <<= 1; - if( !Flag ) - Flag = 1; - } - } - else - return false; - - return true; -} - -bool RscFlag::IsSet( const RSCINST & rInst, Atom nConstId ) -{ - sal_uInt32 i = 0, nFlag = 0; - - if( nEntries != (i = GetConstPos( nConstId )) ) - { - nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); - i = i / (sizeof( sal_uInt32 ) * 8); - - if( reinterpret_cast<RscFlagInst *>(rInst.pData)[ i ].nFlags & nFlag ) - return true; - else - return false; - } - return true; -} - -void RscFlag::WriteSrc( const RSCINST & rInst, FILE * fOutput, - RscTypCont *, sal_uInt32, const char * ) -{ - sal_uInt32 i = 0, Flag = 0, nIndex = 0; - bool bComma = false; - - Flag = 1; - for( i = 0; i < nEntries; i++ ) - { - nIndex = i / (sizeof( sal_uInt32 ) * 8); - if( !( reinterpret_cast<RscFlagInst *>(rInst.pData)[ nIndex ].nDfltFlags & Flag) ) - { - if( bComma ) - fprintf( fOutput, ", " ); - - if( reinterpret_cast<RscFlagInst *>(rInst.pData)[ nIndex ].nFlags & Flag ) - fprintf( fOutput, "%s", pHS->getString( pVarArray[ i ].nId ).getStr() ); - else - { - fprintf( fOutput, "not " ); - fprintf( fOutput, "%s", pHS->getString( pVarArray[ i ].nId ).getStr() ); - } - bComma = true; - } - Flag <<= 1; - if( !Flag ) - Flag = 1; - } -} - -ERRTYPE RscFlag::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont *, sal_uInt32 ) -{ - sal_Int32 lVal = 0; - sal_uInt32 i = 0, Flag = 0, nIndex = 0; - - Flag = 1; - for( i = 0; i < nEntries; i++ ) - { - nIndex = i / (sizeof( sal_uInt32 ) * 8); - - if( reinterpret_cast<RscFlagInst *>(rInst.pData)[ nIndex ].nFlags & Flag ) - lVal |= pVarArray[ i ].lValue; - - Flag <<= 1; - if( !Flag ) - Flag = 1; - } - - aMem.Put( lVal ); - return ERR_OK; -} - -RscClient::RscClient( Atom nId, RESOURCE_TYPE nTypeId, RscFlag * pClass, - Atom nConstantId ) - : RscTop(nId, nTypeId), pRefClass(pClass), nConstId(nConstantId) -{ -} - -RSCCLASS_TYPE RscClient::GetClassType() const -{ - return RSCCLASS_BOOL; -} - -void RscClient::WriteSrc( const RSCINST & rInst, FILE * fOutput, - RscTypCont *, sal_uInt32, const char * ) -{ - if( pRefClass->IsSet( rInst, nConstId ) ) - fprintf( fOutput, "TRUE" ); - else - fprintf( fOutput, "FALSE" ); -} - -RSCINST RscClient::Create( RSCINST * pInst, const RSCINST & rDflt, - bool bOwnClass ) -{ - RSCINST aTmpI, aDfltI; - - if( pInst ) - { - aTmpI.pClass = pRefClass; - aTmpI.pData = pInst->pData; - } - - if( !bOwnClass && rDflt.IsInst() ) - { - bOwnClass = rDflt.pClass->InHierarchy( this ); - if( bOwnClass ) - { - aDfltI.pClass = pRefClass; - aDfltI.pData = rDflt.pData; - } - } - - if( pInst ) - aTmpI = pRefClass->CreateClient( &aTmpI, aDfltI, - bOwnClass, nConstId ); - else - aTmpI = pRefClass->CreateClient( nullptr, aDfltI, - bOwnClass, nConstId ); - aTmpI.pClass = this; - - return aTmpI; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/res/rscrange.cxx b/rsc/source/res/rscrange.cxx index a5ef683b7ee0..db7957d07644 100644 --- a/rsc/source/res/rscrange.cxx +++ b/rsc/source/res/rscrange.cxx @@ -24,128 +24,12 @@ #include <rscrange.hxx> -RscRange::RscRange( Atom nId, RESOURCE_TYPE nTypeId ) - : RscTop( nId, nTypeId ) - , nMin(0), nMax(0) -{ -} - -RSCCLASS_TYPE RscRange::GetClassType() const -{ - return RSCCLASS_NUMBER; -} - -void RscRange::SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ) -{ - if( nMinimum > nMaximum ) - { - nMin = nMaximum; - nMax = nMinimum; - } - else - { - nMax = nMaximum; - nMin = nMinimum; - } -} - -bool RscRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) -{ - if( pDef ) - { - if( reinterpret_cast<RscRangeInst*>(rInst.pData)->nValue == - reinterpret_cast<RscRangeInst*>(pDef)->nValue ) - { - return true; - } - } - - return false; -} - -ERRTYPE RscRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ) -{ - if( nMax < nValue || nMin > nValue ) - return ERR_RSCRANGE_OUTDEFSET; - - reinterpret_cast<RscRangeInst *>(rInst.pData)->nValue = (sal_uInt16)( nValue - nMin ); - reinterpret_cast<RscRangeInst *>(rInst.pData)->bDflt = false; - return ERR_OK; -} - -ERRTYPE RscRange::GetNumber( const RSCINST & rInst, sal_Int32 * pN ) -{ - *pN = reinterpret_cast<RscRangeInst *>(rInst.pData)->nValue + nMin; - return ERR_OK; -} - -RSCINST RscRange::Create( RSCINST * pInst, const RSCINST & rDflt, - bool bOwnClass ) -{ - RSCINST aInst; - - if( !pInst ) - { - aInst.pClass = this; - aInst.pData = static_cast<CLASS_DATA>(rtl_allocateMemory( sizeof( RscRangeInst ) )); - } - else - aInst = *pInst; - - if( !bOwnClass && rDflt.IsInst() ) - bOwnClass = rDflt.pClass->InHierarchy( this ); - - if( bOwnClass ) - memmove( aInst.pData, rDflt.pData, sizeof( RscRangeInst ) ); - else - { - if( 0 >= nMin && 0 <= nMax ) - reinterpret_cast<RscRangeInst *>(aInst.pData)->nValue = (sal_uInt16)(0 - nMin); - else - reinterpret_cast<RscRangeInst *>(aInst.pData)->nValue = 0; - - reinterpret_cast<RscRangeInst *>(aInst.pData)->bDflt = true; - } - - return aInst; -} - -void RscRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, - RscTypCont *, sal_uInt32, const char * ) -{ - fprintf( fOutput, "%ld", long( reinterpret_cast<RscRangeInst *>(rInst.pData)->nValue + nMin ) ); -} - -ERRTYPE RscRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont *, sal_uInt32 ) -{ - if( nMin >= 0 ) - { - sal_uInt16 n; - n = (sal_uInt16)(reinterpret_cast<RscRangeInst *>(rInst.pData)->nValue + nMin); - aMem.Put( n ); - } - else - { - sal_Int16 n; - n = (sal_Int16)(reinterpret_cast<RscRangeInst *>(rInst.pData)->nValue + nMin); - aMem.Put( n ); - } - - return ERR_OK; -} - RscLongRange::RscLongRange( Atom nId, RESOURCE_TYPE nTypeId ) : RscTop( nId, nTypeId ) , nMin(0), nMax(0) { } -RSCCLASS_TYPE RscLongRange::GetClassType() const -{ - return RSCCLASS_NUMBER; -} - void RscLongRange::SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ) { if( nMinimum > nMaximum ) @@ -252,164 +136,4 @@ ERRTYPE RscLongEnumRange::SetConst( const RSCINST & rInst, Atom /*nConst*/, return SetNumber( rInst, nValue ); } -RscIdRange::RscIdRange( Atom nId, RESOURCE_TYPE nTypeId ) - : RscTop( nId, nTypeId ) - , nMin(0), nMax(0) -{ -} - -RSCCLASS_TYPE RscIdRange::GetClassType() const -{ - return RSCCLASS_NUMBER; -} - -RSCINST RscIdRange::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass ) -{ - RSCINST aInst; - RscId * pClassData; - - if( !pInst ) - { - aInst.pClass = this; - aInst.pData = static_cast<CLASS_DATA>(rtl_allocateMemory( sizeof( RscId ) )); - } - else - aInst = *pInst; - - - if( !bOwnClass && rDflt.IsInst() ) - bOwnClass = rDflt.pClass->InHierarchy( this ); - - pClassData = reinterpret_cast<RscId *>(aInst.pData); - - pClassData->Create(); - - if( bOwnClass ) - *pClassData = *reinterpret_cast<RscId *>(rDflt.pData); - else - { - *pClassData = RscId(); - if( 0 >= nMin && 0 <= nMax ) - *pClassData = RscId( (sal_Int32)0 ); - else - *pClassData = RscId( nMin ); - - //cUnusedi is used as default identifier - reinterpret_cast<RscId *>(aInst.pData)->aExp.cUnused = true; - } - - return aInst; -} - -void RscIdRange::Destroy( const RSCINST & rInst ) -{ - reinterpret_cast<RscId *>(rInst.pData)->Destroy(); -} - -bool RscIdRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) -{ - if( pDef ) - { - if( reinterpret_cast<RscId*>(rInst.pData)->aExp.IsNumber() && - reinterpret_cast<RscId*>(pDef)->aExp.IsNumber() ) - { - if( reinterpret_cast<RscId*>(rInst.pData)->GetNumber() == - reinterpret_cast<RscId*>(pDef)->GetNumber() ) - { - return true; - } - } - } - - return false; -} - -ERRTYPE RscIdRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ) -{ - if( nMax < nValue || nMin > nValue ) - return ERR_RSCRANGE_OUTDEFSET; - - *reinterpret_cast<RscId *>(rInst.pData) = RscId( nValue ); - reinterpret_cast<RscId *>(rInst.pData)->aExp.cUnused = false; - return ERR_OK; -} - -ERRTYPE RscIdRange::GetNumber( const RSCINST & rInst, sal_Int32 * plValue ) -{ - *plValue = reinterpret_cast<RscId *>(rInst.pData)->GetNumber(); - return ERR_OK; -} - -ERRTYPE RscIdRange::SetRef( const RSCINST & rInst, const RscId & rRscId ) -{ - ERRTYPE aError; - if( rRscId.IsId() ) - { - aError = SetNumber( rInst, rRscId.GetNumber() ); - if( aError.IsOk() ) - { - *reinterpret_cast<RscId *>(rInst.pData) = rRscId; - reinterpret_cast<RscId *>(rInst.pData)->aExp.cUnused = false; - } - } - else - aError = ERR_RSCRANGE_OUTDEFSET; - - return aError; -} - -ERRTYPE RscIdRange::GetRef( const RSCINST & rInst, RscId * pRscId ) -{ - *pRscId = *reinterpret_cast<RscId *>(rInst.pData); - - return ERR_OK; -} - -void RscIdRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, - RscTypCont *, sal_uInt32, const char * ) -{ - fprintf( fOutput, "%s", reinterpret_cast<RscId *>(rInst.pData)->GetName().getStr() ); -} - -ERRTYPE RscIdRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont *, sal_uInt32 ) -{ - sal_Int32 lVal = reinterpret_cast<RscId*>(rInst.pData)->GetNumber(); - - aMem.Put( lVal ); - - return ERR_OK; -} - -bool RscIdRange::IsConsistent( const RSCINST & rInst ) -{ - long nValue = reinterpret_cast<RscId *>(rInst.pData)->GetNumber(); - - return (nMax >= nValue) && (nMin <= nValue); - -} - -RscBool::RscBool( Atom nId, RESOURCE_TYPE nTypeId ) - : RscRange( nId, nTypeId ) -{ - RscRange::SetRange( 0, 1 ); -} - -RSCCLASS_TYPE RscBool::GetClassType() const -{ - return RSCCLASS_BOOL; -} - -void RscBool::WriteSrc( const RSCINST & rInst, FILE * fOutput, - RscTypCont *, sal_uInt32, const char * ) -{ - sal_Int32 l; - - GetNumber( rInst, &l ); - if( l ) - fprintf( fOutput, "TRUE" ); - else - fprintf( fOutput, "FALSE" ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/res/rscstr.cxx b/rsc/source/res/rscstr.cxx index 90213085743a..918fb5ab1afb 100644 --- a/rsc/source/res/rscstr.cxx +++ b/rsc/source/res/rscstr.cxx @@ -34,11 +34,6 @@ RscString::RscString( Atom nId, RESOURCE_TYPE nTypeId ) { } -RSCCLASS_TYPE RscString::GetClassType() const -{ - return RSCCLASS_STRING; -} - ERRTYPE RscString::SetString( const RSCINST & rInst, const char * pStr ) { char * pTmp; diff --git a/rsc/source/res/rsctop.cxx b/rsc/source/res/rsctop.cxx index 3d447796b89d..adc61de5a086 100644 --- a/rsc/source/res/rsctop.cxx +++ b/rsc/source/res/rsctop.cxx @@ -102,12 +102,6 @@ ERRTYPE RscTop::SetVariable( Atom nVarName, RscTop * pClass, return ERR_UNKNOWN_METHOD; } -void RscTop::EnumVariables( void * pData, VarEnumCallbackProc pProc ) -{ - if( pSuperClass ) - pSuperClass->EnumVariables( pData, pProc ); -} - RSCINST RscTop::GetVariable( const RSCINST & rInst, Atom nVarName, const RSCINST & rInitInst, |