diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/rc.h | 1 | ||||
-rw-r--r-- | tools/inc/tools/rc.hxx | 3 | ||||
-rw-r--r-- | tools/inc/tools/resmgr.hxx | 11 | ||||
-rw-r--r-- | tools/inc/tools/urlobj.hxx | 4 | ||||
-rw-r--r-- | tools/source/fsys/urlobj.cxx | 9 | ||||
-rw-r--r-- | tools/source/rc/resmgr.cxx | 198 |
6 files changed, 144 insertions, 82 deletions
diff --git a/tools/inc/tools/rc.h b/tools/inc/tools/rc.h index bd499717a3a4..e11aed2937fd 100644 --- a/tools/inc/tools/rc.h +++ b/tools/inc/tools/rc.h @@ -50,6 +50,7 @@ typedef short RSWND_STYLE; #define WINDOW_EXTRALONG 0x0800 #define WINDOW_UNIQUEID 0x1000 #define WINDOW_BORDER_STYLE 0x2000 +#define WINDOW_HELPID 0x4000 // Definition der Struktur die alle "WorkWindow"-Resourcen haben #define WORKWIN_SHOWNORMAL 0 diff --git a/tools/inc/tools/rc.hxx b/tools/inc/tools/rc.hxx index 4bf1827a1ab6..15e077c3c62c 100644 --- a/tools/inc/tools/rc.hxx +++ b/tools/inc/tools/rc.hxx @@ -87,6 +87,9 @@ class TOOLS_DLLPUBLIC Resource // read a string from resource data and increment pointer UniString ReadStringRes() { return m_pResMgr->ReadString(); } + // read a byte string from resource data and increment pointer + rtl::OString ReadByteStringRes() + { return m_pResMgr->ReadByteString(); } // Gibt die Resource frei (this-Zeiger fuer Fehlerueberpruefung) // free the resource from m_pResMgr's stack (pass this ptr for validation) diff --git a/tools/inc/tools/resmgr.hxx b/tools/inc/tools/resmgr.hxx index b19524139078..4b79040921b3 100644 --- a/tools/inc/tools/resmgr.hxx +++ b/tools/inc/tools/resmgr.hxx @@ -181,13 +181,15 @@ public: static sal_uInt32 GetObjSize( RSHEADER_TYPE* pHT ) { return( pHT->GetGlobOff() ); } - // Liefert einen String aus der Resource + // returns a string and its length out of the resource static sal_uInt32 GetString( UniString& rStr, const BYTE* pStr ); + // returns a byte string and its length out of the resource + static sal_uInt32 GetByteString( rtl::OString& rStr, const BYTE* pStr ); // Groesse eines Strings in der Resource static sal_uInt32 GetStringSize( sal_uInt32 nLen ) { nLen++; return (nLen + nLen%2); } - static sal_uInt32 GetStringSize( const BYTE* pStr ); + static sal_uInt32 GetStringSize( const BYTE* pStr, sal_uInt32& nLen ); // return a int64 static sal_uInt64 GetUInt64( void* pDatum ); @@ -209,9 +211,10 @@ public: INT16 ReadShort(); INT32 ReadLong(); UniString ReadString(); + rtl::OString ReadByteString(); - // generate auto help id for current resource stack - ULONG GetAutoHelpId(); + // generate auto help id for current resource stack + rtl::OString GetAutoHelpId(); static void SetReadStringHook( ResHookProc pProc ); static ResHookProc GetReadStringHook(); diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx index 17d52432e206..cb9c7e407bcc 100644 --- a/tools/inc/tools/urlobj.hxx +++ b/tools/inc/tools/urlobj.hxx @@ -81,6 +81,7 @@ namespace com { namespace sun { namespace star { namespace util { #define INET_DB_SCHEME "db:" #define INET_BUGID_SCHEME "bugid:" #define INET_TELNET_SCHEME "telnet://" +#define INET_HID_SCHEME "hid:" #define URL_PREFIX_PRIV_SOFFICE "private:" enum @@ -139,7 +140,8 @@ enum INetProtocol INET_PROT_VND_SUN_STAR_TDOC = 29, INET_PROT_GENERIC = 30, INET_PROT_SMB = 31, - INET_PROT_END = 32 + INET_PROT_HID = 32, + INET_PROT_END = 33 }; //============================================================================ diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index a6d7bc6fd04e..56e6b8ef47cc 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -424,7 +424,9 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false, false, true, false }, { "", "", 0, false, false, false, false, true, true, true, false }, { "smb", "smb://", 139, true, true, false, true, true, true, true, - true } }; + true }, + { "hid", "hid:", 0, false, false, false, false, false, false, + false, true } }; // static inline INetURLObject::SchemeInfo const & @@ -2094,6 +2096,8 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin, { "db:", "staroffice.db:", INET_PROT_DB, PrefixInfo::INTERNAL }, { "file:", 0, INET_PROT_FILE, PrefixInfo::OFFICIAL }, { "ftp:", 0, INET_PROT_FTP, PrefixInfo::OFFICIAL }, + { "hid:", "staroffice.hid:", INET_PROT_HID, + PrefixInfo::INTERNAL }, { "http:", 0, INET_PROT_HTTP, PrefixInfo::OFFICIAL }, { "https:", 0, INET_PROT_HTTPS, PrefixInfo::OFFICIAL }, { "imap:", 0, INET_PROT_IMAP, PrefixInfo::OFFICIAL }, @@ -2129,6 +2133,8 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin, INET_PROT_PRIV_SOFFICE, PrefixInfo::EXTERNAL }, { "staroffice.helpid:", "private:helpid/", INET_PROT_PRIV_SOFFICE, PrefixInfo::EXTERNAL }, + { "staroffice.hid:", "hid:", INET_PROT_HID, + PrefixInfo::EXTERNAL }, { "staroffice.java:", "private:java/", INET_PROT_PRIV_SOFFICE, PrefixInfo::EXTERNAL }, { "staroffice.macro:", "macro:", INET_PROT_MACRO, @@ -3120,6 +3126,7 @@ bool INetURLObject::parsePath(INetProtocol eScheme, case INET_PROT_PRIV_SOFFICE: case INET_PROT_SLOT: + case INET_PROT_HID: case INET_PROT_MACRO: case INET_PROT_UNO: case INET_PROT_COMPONENT: diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index d05fcac331f2..2e6401f5a19f 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -46,6 +46,7 @@ #include <osl/file.hxx> #include <osl/mutex.hxx> #include <rtl/ustrbuf.hxx> +#include <rtl/strbuf.hxx> #include <tools/urlobj.hxx> #include <rtl/instance.hxx> #include <rtl/bootstrap.hxx> @@ -1351,7 +1352,8 @@ sal_uInt64 ResMgr::GetUInt64( void* pDatum ) // ----------------------------------------------------------------------- sal_uInt32 ResMgr::GetStringWithoutHook( UniString& rStr, const BYTE* pStr ) { - sal_uInt32 nRet = GetStringSize( pStr ); + sal_uInt32 nLen=0; + sal_uInt32 nRet = GetStringSize( pStr, nLen ); UniString aString( (sal_Char*)pStr, RTL_TEXTENCODING_UTF8, RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT | @@ -1370,11 +1372,20 @@ sal_uInt32 ResMgr::GetString( UniString& rStr, const BYTE* pStr ) return nRet; } +sal_uInt32 ResMgr::GetByteString( rtl::OString& rStr, const BYTE* pStr ) +{ + sal_uInt32 nLen=0; + sal_uInt32 nRet = GetStringSize( pStr, nLen ); + rStr = rtl::OString( (const sal_Char*)pStr, nLen ); + return nRet; +} + // ------------------------------------------------------------------ -sal_uInt32 ResMgr::GetStringSize( const BYTE* pStr ) +sal_uInt32 ResMgr::GetStringSize( const BYTE* pStr, sal_uInt32& nLen ) { - return GetStringSize( strlen( (const char*)pStr ) ); + nLen = static_cast< sal_uInt32 >( strlen( (const char*)pStr ) ); + return GetStringSize( nLen ); } // ----------------------------------------------------------------------- @@ -1765,90 +1776,125 @@ UniString ResMgr::ReadString() return aRet; } +rtl::OString ResMgr::ReadByteString() +{ + osl::Guard<osl::Mutex> aGuard( getResMgrMutex() ); + + if( pFallbackResMgr ) + return pFallbackResMgr->ReadByteString(); + + rtl::OString aRet; + + const ImpRCStack& rTop = aStack[nCurStack]; + if( (rTop.Flags & RC_NOTFOUND) ) + { + #if OSL_DEBUG_LEVEL > 0 + aRet = OString( "<resource not found>" ); + #endif + } + else + Increment( GetByteString( aRet, (const BYTE*)GetClass() ) ); + + return aRet; +} + // ----------------------------------------------------------------------- -ULONG ResMgr::GetAutoHelpId() +rtl::OString ResMgr::GetAutoHelpId() { osl::Guard<osl::Mutex> aGuard( getResMgrMutex() ); if( pFallbackResMgr ) return pFallbackResMgr->GetAutoHelpId(); - DBG_ASSERT( nCurStack, "resource stack empty in Auto help id generation" ); + OSL_ENSURE( nCurStack, "resource stack empty in Auto help id generation" ); if( nCurStack < 1 || nCurStack > 2 ) - return 0; - - const ImpRCStack *pRC = StackTop( nCurStack==1 ? 0 : 1 ); - - DBG_ASSERT( pRC->pResource, "MM hat gesagt, dass der immer einen hat" ); - ULONG nGID = pRC->pResource->GetId(); - - if( !nGID || nGID > 32767 ) - return 0; - - ULONG nHID = 0; - - // GGGg gggg::gggg gggg::ggLL LLLl::llll llll - switch( pRC->pResource->GetRT() ) { // maximal 7 - case RSC_DOCKINGWINDOW: - nHID += 0x20000000L; - case RSC_WORKWIN: - nHID += 0x20000000L; - case RSC_MODELESSDIALOG: - nHID += 0x20000000L; - case RSC_FLOATINGWINDOW: - nHID += 0x20000000L; - case RSC_MODALDIALOG: - nHID += 0x20000000L; - case RSC_TABPAGE: - nHID += 0x20000000L; - - if( nCurStack == 2 ) { - pRC = StackTop(); - ULONG nLID = pRC->pResource->GetId(); - - if( !nLID || nLID > 511 ) - return 0; - - switch( pRC->pResource->GetRT() ) { // maximal 32 - case RSC_TABCONTROL: nHID |= 0x0000; break; - case RSC_RADIOBUTTON: nHID |= 0x0200; break; - case RSC_CHECKBOX: nHID |= 0x0400; break; - case RSC_TRISTATEBOX: nHID |= 0x0600; break; - case RSC_EDIT: nHID |= 0x0800; break; - case RSC_MULTILINEEDIT: nHID |= 0x0A00; break; - case RSC_MULTILISTBOX: nHID |= 0x0C00; break; - case RSC_LISTBOX: nHID |= 0x0E00; break; - case RSC_COMBOBOX: nHID |= 0x1000; break; - case RSC_PUSHBUTTON: nHID |= 0x1200; break; - case RSC_SPINFIELD: nHID |= 0x1400; break; - case RSC_PATTERNFIELD: nHID |= 0x1600; break; - case RSC_NUMERICFIELD: nHID |= 0x1800; break; - case RSC_METRICFIELD: nHID |= 0x1A00; break; - case RSC_CURRENCYFIELD: nHID |= 0x1C00; break; - case RSC_DATEFIELD: nHID |= 0x1E00; break; - case RSC_TIMEFIELD: nHID |= 0x2000; break; - case RSC_IMAGERADIOBUTTON: nHID |= 0x2200; break; - case RSC_NUMERICBOX: nHID |= 0x2400; break; - case RSC_METRICBOX: nHID |= 0x2600; break; - case RSC_CURRENCYBOX: nHID |= 0x2800; break; - case RSC_DATEBOX: nHID |= 0x2A00; break; - case RSC_TIMEBOX: nHID |= 0x2C00; break; - case RSC_IMAGEBUTTON: nHID |= 0x2E00; break; - case RSC_MENUBUTTON: nHID |= 0x3000; break; - case RSC_MOREBUTTON: nHID |= 0x3200; break; + return rtl::OString(); + + // prepare HID, start with resource prefix + rtl::OStringBuffer aHID( 32 ); + aHID.append( rtl::OUStringToOString( pImpRes->aPrefix, RTL_TEXTENCODING_UTF8 ) ); + aHID.append( '.' ); + + // append type + const ImpRCStack *pRC = StackTop(); + OSL_ENSURE( pRC, "missing resource stack level" ); + + if ( nCurStack == 1 ) + { + // auto help ids for top level windows + switch( pRC->pResource->GetRT() ) { + case RSC_DOCKINGWINDOW: aHID.append( "DockingWindow" ); break; + case RSC_WORKWIN: aHID.append( "WorkWindow" ); break; + case RSC_MODELESSDIALOG: aHID.append( "ModelessDialog" ); break; + case RSC_FLOATINGWINDOW: aHID.append( "FloatingWindow" ); break; + case RSC_MODALDIALOG: aHID.append( "ModalDialog" ); break; + case RSC_TABPAGE: aHID.append( "TabPage" ); break; + default: return rtl::OString(); + } + } + else + { + // only controls with the following parents get auto help ids + const ImpRCStack *pRC1 = StackTop(1); + switch( pRC1->pResource->GetRT() ) { + case RSC_DOCKINGWINDOW: + case RSC_WORKWIN: + case RSC_MODELESSDIALOG: + case RSC_FLOATINGWINDOW: + case RSC_MODALDIALOG: + case RSC_TABPAGE: + // intentionally no breaks! + // auto help ids for controls + switch( pRC->pResource->GetRT() ) { + case RSC_TABCONTROL: aHID.append( "TabControl" ); break; + case RSC_RADIOBUTTON: aHID.append( "RadioButton" ); break; + case RSC_CHECKBOX: aHID.append( "CheckBox" ); break; + case RSC_TRISTATEBOX: aHID.append( "TriStateBox" ); break; + case RSC_EDIT: aHID.append( "Edit" ); break; + case RSC_MULTILINEEDIT: aHID.append( "MultiLineEdit" ); break; + case RSC_MULTILISTBOX: aHID.append( "MultiListBox" ); break; + case RSC_LISTBOX: aHID.append( "ListBox" ); break; + case RSC_COMBOBOX: aHID.append( "ComboBox" ); break; + case RSC_PUSHBUTTON: aHID.append( "PushButton" ); break; + case RSC_SPINFIELD: aHID.append( "SpinField" ); break; + case RSC_PATTERNFIELD: aHID.append( "PatternField" ); break; + case RSC_NUMERICFIELD: aHID.append( "NumericField" ); break; + case RSC_METRICFIELD: aHID.append( "MetricField" ); break; + case RSC_CURRENCYFIELD: aHID.append( "CurrencyField" ); break; + case RSC_DATEFIELD: aHID.append( "DateField" ); break; + case RSC_TIMEFIELD: aHID.append( "TimeField" ); break; + case RSC_IMAGERADIOBUTTON: aHID.append( "ImageRadioButton" ); break; + case RSC_NUMERICBOX: aHID.append( "NumericBox" ); break; + case RSC_METRICBOX: aHID.append( "MetricBox" ); break; + case RSC_CURRENCYBOX: aHID.append( "CurrencyBox" ); break; + case RSC_DATEBOX: aHID.append( "DateBox" ); break; + case RSC_TIMEBOX: aHID.append( "TimeBox" ); break; + case RSC_IMAGEBUTTON: aHID.append( "ImageButton" ); break; + case RSC_MENUBUTTON: aHID.append( "MenuButton" ); break; + case RSC_MOREBUTTON: aHID.append( "MoreButton" ); break; default: - return 0; - } // of switch - nHID |= nLID; - } // of if - break; - default: - return 0; - } // of switch - nHID |= nGID << 14; + // no type, no auto HID + return rtl::OString(); + } + break; + default: + return rtl::OString(); + } + } + + // append resource id hierarchy + for( int nOff = nCurStack-1; nOff >= 0; nOff-- ) + { + aHID.append( '.' ); + pRC = StackTop( nOff ); + + OSL_ENSURE( pRC->pResource, "missing resource in resource stack level !" ); + if( pRC->pResource ) + aHID.append( sal_Int32( pRC->pResource->GetId() ) ); + } - return nHID; + return aHID.makeStringAndClear(); } // ----------------------------------------------------------------------- |