diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:51:11 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:51:11 +0200 |
commit | 200bc6c582d6cf2365001f27928c1e3d1f9c9845 (patch) | |
tree | 0f27abe75bc3603341aef715372676aee8d86835 /framework | |
parent | 01ea92166c12fe080575f8faba4162779fb46c28 (diff) | |
parent | 1b465fcc0f5f699308c6ee5113dde6b82842c3dd (diff) |
resyncing to master
Diffstat (limited to 'framework')
47 files changed, 424 insertions, 8641 deletions
diff --git a/framework/Library_fwe.mk b/framework/Library_fwe.mk index 51179c4523a8..9a71be9ef554 100644 --- a/framework/Library_fwe.mk +++ b/framework/Library_fwe.mk @@ -34,13 +34,17 @@ $(eval $(call gb_Library_set_include,fwe,\ -I$(WORKDIR)/inc/framework/ \ $$(INCLUDE) \ -I$(OUTDIR)/inc/framework \ - -I$(OUTDIR)/inc/offuh \ )) $(eval $(call gb_Library_add_defs,fwe,\ -DFWE_DLLIMPLEMENTATION\ )) +$(eval $(call gb_Library_add_api,fwe,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,fwe,\ comphelper \ cppu \ diff --git a/framework/Library_fwi.mk b/framework/Library_fwi.mk index 748bee52c022..105d5a265784 100644 --- a/framework/Library_fwi.mk +++ b/framework/Library_fwi.mk @@ -33,6 +33,11 @@ $(eval $(call gb_Library_add_defs,fwi,\ -DFWI_DLLIMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,fwi,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_set_include,fwi,\ -I$(realpath $(SRCDIR)/framework/inc/pch) \ -I$(realpath $(SRCDIR)/framework/source/inc) \ @@ -40,7 +45,6 @@ $(eval $(call gb_Library_set_include,fwi,\ -I$(WORKDIR)/inc/framework/ \ $$(INCLUDE) \ -I$(OUTDIR)/inc/framework \ - -I$(OUTDIR)/inc/offuh \ )) $(eval $(call gb_Library_add_linked_libs,fwi,\ diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk index f999b751b43b..804048c16d1d 100644 --- a/framework/Library_fwk.mk +++ b/framework/Library_fwk.mk @@ -38,7 +38,11 @@ $(eval $(call gb_Library_set_include,fwk,\ -I$(WORKDIR)/inc/framework/ \ $$(INCLUDE) \ -I$(OUTDIR)/inc/framework \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_api,fwk,\ + udkapi \ + offapi \ )) $(eval $(call gb_Library_add_linked_libs,fwk,\ diff --git a/framework/Library_fwl.mk b/framework/Library_fwl.mk index 8c925653dc63..dd1d79eccc64 100644 --- a/framework/Library_fwl.mk +++ b/framework/Library_fwl.mk @@ -36,7 +36,11 @@ $(eval $(call gb_Library_set_include,fwl,\ -I$(WORKDIR)/inc/framework/ \ $$(INCLUDE) \ -I$(OUTDIR)/inc/framework \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_api,fwl,\ + udkapi \ + offapi \ )) $(eval $(call gb_Library_add_linked_libs,fwl,\ diff --git a/framework/Library_fwm.mk b/framework/Library_fwm.mk index d540079c0f51..063c78e8fa00 100644 --- a/framework/Library_fwm.mk +++ b/framework/Library_fwm.mk @@ -36,7 +36,11 @@ $(eval $(call gb_Library_set_include,fwm,\ -I$(WORKDIR)/inc/framework/ \ $$(INCLUDE) \ -I$(OUTDIR)/inc/framework \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_api,fwm,\ + udkapi \ + offapi \ )) $(eval $(call gb_Library_add_linked_libs,fwm,\ diff --git a/framework/Library_lomenubar.mk b/framework/Library_lomenubar.mk index e8fe7c6ffb28..dd3848ef3fb8 100644 --- a/framework/Library_lomenubar.mk +++ b/framework/Library_lomenubar.mk @@ -33,10 +33,14 @@ $(eval $(call gb_Library_set_componentfile,lomenubar,framework/util/lomenubar)) $(eval $(call gb_Library_set_include,lomenubar,\ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ $(shell pkg-config --cflags-only-I dbusmenu-gtk-0.4) \ )) +$(eval $(call gb_Library_add_api,lomenubar,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_set_ldflags,lomenubar,\ $$(LDFLAGS) \ $(shell pkg-config --libs dbusmenu-gtk-0.4) \ diff --git a/framework/inc/macros/generic.hxx b/framework/inc/macros/generic.hxx index b74225603b41..01169a32adaa 100644 --- a/framework/inc/macros/generic.hxx +++ b/framework/inc/macros/generic.hxx @@ -53,11 +53,9 @@ ________________________________________________________________________________ /*_________________________________________________________________________________________________________________ U2B( SUNICODEVALUE ) B2U( SASCIIVALUE ) - U2B_ENC( SUNICODEVALUE, AENCODING ) - B2U_ENC( SASCIIVALUE, AENCODING ) Use it to convert unicode strings to ascii values and reverse ... - We use UTF8 as default textencoding. If you will change this use U2B_ENC and B2U_ENC! + We use UTF8 as default textencoding. _________________________________________________________________________________________________________________*/ #define U2B( SUNICODEVALUE ) \ @@ -66,16 +64,6 @@ ________________________________________________________________________________ #define B2U( SASCIIVALUE ) \ ::rtl::OStringToOUString( SASCIIVALUE, RTL_TEXTENCODING_UTF8 ) -#define U2B_ENC( SUNICODEVALUE, AENCODING ) \ - ::rtl::OUStringToOString( SUNICODEVALUE, AENCODING ) - -#define B2U_ENC( SASCIIVALUE, AENCODING ) \ - ::rtl::OStringToOUString( SASCIIVALUE, AENCODING ) - -//***************************************************************************************************************** -// end of file -//***************************************************************************************************************** - #endif // #ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/macros/registration.hxx b/framework/inc/macros/registration.hxx index 74ab29d2c4bf..94815f726b75 100644 --- a/framework/inc/macros/registration.hxx +++ b/framework/inc/macros/registration.hxx @@ -57,7 +57,6 @@ Please use follow public macros only! IFFACTORY( CLASS ) => use it as parameter for COMPONENT_GETFACTORY( IFFACTORIES ) - COMPONENTGETIMPLEMENTATIONENVIRONMENT => use it to define exported function component_getImplementationEnvironment() COMPONENTGETFACTORY( IFFACTORIES ) => use it to define exported function component_getFactory() _________________________________________________________________________________________________________________*/ @@ -79,17 +78,6 @@ ________________________________________________________________________________ //***************************************************************************************************************** // public -// define helper to get information about service environment -//***************************************************************************************************************** -#define COMPONENTGETIMPLEMENTATIONENVIRONMENT \ - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvironmentTypeName , \ - uno_Environment** ) \ - { \ - *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; \ - } - -//***************************************************************************************************************** -// public // define method to instanciate new services //***************************************************************************************************************** #define COMPONENTGETFACTORY( IFFACTORIES ) \ diff --git a/framework/inc/uielement/uielement.hxx b/framework/inc/uielement/uielement.hxx index ab8ba13fc970..501189ea91be 100644 --- a/framework/inc/uielement/uielement.hxx +++ b/framework/inc/uielement/uielement.hxx @@ -42,6 +42,8 @@ #include <com/sun/star/ui/XUIElement.hpp> #include <com/sun/star/ui/DockingArea.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> //_________________________________________________________________________________________________________________ // other includes @@ -59,24 +61,24 @@ namespace framework struct DockedData { - DockedData() : m_aPos( LONG_MAX, LONG_MAX ), + DockedData() : m_aPos( SAL_MAX_INT32, SAL_MAX_INT32 ), m_nDockedArea( ::com::sun::star::ui::DockingArea_DOCKINGAREA_TOP ), m_bLocked( false ) {} - Point m_aPos; - Size m_aSize; + com::sun::star::awt::Point m_aPos; + com::sun::star::awt::Size m_aSize; sal_Int16 m_nDockedArea; bool m_bLocked; }; struct FloatingData { - FloatingData() : m_aPos( LONG_MAX, LONG_MAX ), + FloatingData() : m_aPos( SAL_MAX_INT32, SAL_MAX_INT32 ), m_nLines( 1 ), m_bIsHorizontal( true ) {} - Point m_aPos; - Size m_aSize; + com::sun::star::awt::Point m_aPos; + com::sun::star::awt::Size m_aSize; sal_Int16 m_nLines; bool m_bIsHorizontal; }; diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx index baaf086e4702..bae9efb23419 100644 --- a/framework/source/fwe/classes/addonmenu.cxx +++ b/framework/source/fwe/classes/addonmenu.cxx @@ -66,7 +66,6 @@ using namespace ::com::sun::star::beans; // Please look at sfx2/inc/sfxsids.hrc the values are defined there. Due to build dependencies // we cannot include the header file. const sal_uInt16 SID_HELPMENU = (SID_SFX_START + 410); -const sal_uInt16 SID_ONLINE_REGISTRATION = (SID_SFX_START + 1537); namespace framework { @@ -213,40 +212,21 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me if ( pHelpMenu ) { - static const char REFERENCECOMMAND_AFTER[] = ".uno:OnlineRegistrationDlg"; static const char REFERENCECOMMAND_BEFORE[] = ".uno:About"; // Add-Ons help menu items should be inserted after the "registration" menu item - bool bAddAfter = true; sal_uInt16 nItemCount = pHelpMenu->GetItemCount(); - sal_uInt16 nRegPos = pHelpMenu->GetItemPos( SID_ONLINE_REGISTRATION ); - sal_uInt16 nInsPos = nRegPos; sal_uInt16 nInsSepAfterPos = MENU_APPEND; sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START; AddonsOptions aOptions; - if ( nRegPos == USHRT_MAX ) - { - // try to detect the online registration dialog menu item with the command URL - sal_uInt16 nId = FindMenuId( pHelpMenu, String::CreateFromAscii( REFERENCECOMMAND_AFTER )); - nRegPos = pHelpMenu->GetItemPos( nId ); - nInsPos = nRegPos; - } - - if ( nRegPos == USHRT_MAX ) - { - // second try: - // try to detect the about menu item with the command URL - sal_uInt16 nId = FindMenuId( pHelpMenu, String::CreateFromAscii( REFERENCECOMMAND_BEFORE )); - nRegPos = pHelpMenu->GetItemPos( nId ); - nInsPos = nRegPos; - bAddAfter = false; - } + // try to detect the about menu item with the command URL + sal_uInt16 nId = FindMenuId( pHelpMenu, String::CreateFromAscii( REFERENCECOMMAND_BEFORE )); + sal_uInt16 nInsPos = pHelpMenu->GetItemPos( nId ); Sequence< Sequence< PropertyValue > > aAddonSubMenu; const Sequence< Sequence< PropertyValue > >& rAddonHelpMenuEntries = aOptions.GetAddonsHelpMenu(); - nInsPos = bAddAfter ? AddonMenuManager::GetNextPos( nInsPos ) : nInsPos; if ( nInsPos < nItemCount && pHelpMenu->GetItemType( nInsPos ) != MENUITEM_SEPARATOR ) nInsSepAfterPos = nInsPos; @@ -261,10 +241,7 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me if ( pHelpMenu->GetItemType( nInsSepAfterPos ) != MENUITEM_SEPARATOR ) pHelpMenu->InsertSeparator( nInsSepAfterPos ); } - if ( nRegPos < MENU_APPEND ) - pHelpMenu->InsertSeparator( nRegPos+1 ); - else - pHelpMenu->InsertSeparator( nItemCount ); + pHelpMenu->InsertSeparator( nItemCount ); } } } diff --git a/framework/source/fwe/classes/framelistanalyzer.cxx b/framework/source/fwe/classes/framelistanalyzer.cxx index fadd3cae0545..25c7f921bbd9 100644 --- a/framework/source/fwe/classes/framelistanalyzer.cxx +++ b/framework/source/fwe/classes/framelistanalyzer.cxx @@ -163,8 +163,9 @@ void FrameListAnalyzer::impl_analyze() ::rtl::OUString sModule = xModuleMgr->identify(m_xReferenceFrame); m_bReferenceIsBacking = (sModule.equals(SERVICENAME_STARTMODULE)); } - catch(const css::uno::Exception&) - {} + catch (const css::uno::Exception&) + { + } } // check, if the reference frame includes the help module. @@ -237,8 +238,9 @@ void FrameListAnalyzer::impl_analyze() continue; } } - catch(const css::uno::Exception&) - {} + catch (const css::uno::Exception&) + { + } } // ------------------------------------------------- @@ -285,7 +287,7 @@ void FrameListAnalyzer::impl_analyze() } } } - catch(css::lang::IndexOutOfBoundsException) + catch (const css::lang::IndexOutOfBoundsException&) { // stop copying if index seams to be wrong. // This interface can't realy guarantee its count for multithreaded diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx index 44518a3458b9..9ce2884da366 100644 --- a/framework/source/fwe/helper/actiontriggerhelper.cxx +++ b/framework/source/fwe/helper/actiontriggerhelper.cxx @@ -67,7 +67,7 @@ sal_Bool IsSeparator( Reference< XPropertySet > xPropertySet ) { return xServiceInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_ACTIONTRIGGERSEPARATOR )) ); } - catch ( Exception& ) + catch (const Exception&) { } @@ -95,7 +95,7 @@ void GetMenuItemAttributes( Reference< XPropertySet > xActionTriggerPropertySet, a = xActionTriggerPropertySet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "SubContainer" )) ); a >>= xSubContainer; } - catch ( Exception& ) + catch (const Exception&) { } @@ -105,7 +105,7 @@ void GetMenuItemAttributes( Reference< XPropertySet > xActionTriggerPropertySet, a = xActionTriggerPropertySet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" )) ); a >>= aHelpURL; } - catch ( Exception& ) + catch (const Exception&) { } } @@ -234,15 +234,15 @@ void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, Reference< XIndexC } } } - catch ( IndexOutOfBoundsException ) + catch (const IndexOutOfBoundsException&) { return; } - catch ( WrappedTargetException ) + catch (const WrappedTargetException&) { return; } - catch ( RuntimeException ) + catch (const RuntimeException&) { return; } @@ -295,7 +295,7 @@ Reference< XPropertySet > CreateActionTrigger( sal_uInt16 nItemId, const Menu* p xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Image" )), a ); } } - catch ( Exception& ) + catch (const Exception&) { } } @@ -369,7 +369,7 @@ void FillActionTriggerContainerWithMenu( const Menu* pMenu, Reference< XIndexCon } } } - catch ( Exception& ) + catch (const Exception&) { } } diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index a1db0de3ec5d..23d18b82a544 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -609,12 +609,11 @@ void TitleHelper::impl_appendModuleName (::rtl::OUStringBuffer& sTitle) #ifdef DBG_UTIL void TitleHelper::impl_appendDebugVersion (::rtl::OUStringBuffer& sTitle) { - ::rtl::OUString sDefault ; - ::rtl::OUString sVersion = ::utl::Bootstrap::getBuildIdData( sDefault ); - - sTitle.appendAscii (" [" ); - sTitle.append (sVersion); - sTitle.appendAscii ("]" ); + ::rtl::OUString sDefault(RTL_CONSTASCII_USTRINGPARAM("development")); + ::rtl::OUString sVersion = ::utl::Bootstrap::getProductSource(sDefault); + sTitle.appendAscii(RTL_CONSTASCII_STRINGPARAM(" [")); + sTitle.append(sVersion); + sTitle.appendAscii(RTL_CONSTASCII_STRINGPARAM("]")); } #else void TitleHelper::impl_appendDebugVersion (::rtl::OUStringBuffer&) diff --git a/framework/source/fwi/helper/networkdomain.cxx b/framework/source/fwi/helper/networkdomain.cxx index fb4bc20f5077..132241212d62 100644 --- a/framework/source/fwi/helper/networkdomain.cxx +++ b/framework/source/fwi/helper/networkdomain.cxx @@ -47,84 +47,17 @@ namespace framework #pragma warning(pop) #endif -//_________________________________________________________________________________________________________________ -// Win NT, Win 2000, Win XP -//_________________________________________________________________________________________________________________ - static DWORD WINAPI GetUserDomainW_NT( LPWSTR lpBuffer, DWORD nSize ) { return GetEnvironmentVariable( TEXT("USERDOMAIN"), lpBuffer, nSize ); } -//_________________________________________________________________________________________________________________ -// Win 9x,Win ME -//_________________________________________________________________________________________________________________ - -static DWORD WINAPI GetUserDomainW_WINDOWS( LPWSTR lpBuffer, DWORD nSize ) -{ - HKEY hkeyLogon; - HKEY hkeyWorkgroup; - DWORD dwResult = 0; - - - if ( ERROR_SUCCESS == RegOpenKeyEx( - HKEY_LOCAL_MACHINE, - TEXT("Network\\Logon"), - 0, KEY_READ, &hkeyLogon ) ) - { - DWORD dwLogon = 0; - DWORD dwLogonSize = sizeof(dwLogon); - RegQueryValueEx( hkeyLogon, TEXT("LMLogon"), 0, NULL, (LPBYTE)&dwLogon, &dwLogonSize ); - RegCloseKey( hkeyLogon ); - - if ( dwLogon ) - { - HKEY hkeyNetworkProvider; - - if ( ERROR_SUCCESS == RegOpenKeyEx( - HKEY_LOCAL_MACHINE, - TEXT("SYSTEM\\CurrentControlSet\\Services\\MSNP32\\NetworkProvider"), - 0, KEY_READ, &hkeyNetworkProvider ) ) - { - DWORD dwBufferSize = nSize; - LONG lResult = RegQueryValueEx( hkeyNetworkProvider, TEXT("AuthenticatingAgent"), 0, NULL, (LPBYTE)lpBuffer, &dwBufferSize ); - - if ( ERROR_SUCCESS == lResult || ERROR_MORE_DATA == lResult ) - dwResult = dwBufferSize / sizeof(TCHAR); - - RegCloseKey( hkeyNetworkProvider ); - } - } - } - else if ( ERROR_SUCCESS == RegOpenKeyEx( - HKEY_LOCAL_MACHINE, - TEXT("SYSTEM\\CurrentControlSet\\Services\\VxD\\VNETSUP"), - 0, KEY_READ, &hkeyWorkgroup ) ) - { - DWORD dwBufferSize = nSize; - LONG lResult = RegQueryValueEx( hkeyWorkgroup, TEXT("Workgroup"), 0, NULL, (LPBYTE)lpBuffer, &dwBufferSize ); - - if ( ERROR_SUCCESS == lResult || ERROR_MORE_DATA == lResult ) - dwResult = dwBufferSize / sizeof(TCHAR); - - RegCloseKey( hkeyWorkgroup ); - } - - - return dwResult; -} - static rtl::OUString GetUserDomain() { sal_Unicode aBuffer[256]; - - long nVersion = GetVersion(); DWORD nResult; - if ( nVersion < 0 ) - nResult = GetUserDomainW_WINDOWS( reinterpret_cast<LPWSTR>(aBuffer), sizeof( aBuffer ) ); - else - nResult = GetUserDomainW_NT( reinterpret_cast<LPWSTR>(aBuffer), sizeof( aBuffer ) ); + nResult = GetUserDomainW_NT( reinterpret_cast<LPWSTR>(aBuffer), sizeof( aBuffer ) ); if ( nResult > 0 ) return rtl::OUString( aBuffer ); diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx index 7deeaa09168f..d85e00375adb 100644 --- a/framework/source/helper/persistentwindowstate.cxx +++ b/framework/source/helper/persistentwindowstate.cxx @@ -297,7 +297,7 @@ void PersistentWindowState::implst_setWindowStateOnConfig(const css::uno::Refere { sal_uLong nMask = WINDOWSTATE_MASK_ALL; nMask &= ~(WINDOWSTATE_MASK_MINIMIZED); - sWindowState = B2U_ENC( + sWindowState = rtl::OStringToOUString( ((SystemWindow*)pWindow)->GetWindowState(nMask), RTL_TEXTENCODING_UTF8); } @@ -341,7 +341,7 @@ void PersistentWindowState::implst_setWindowStateOnWindow(const css::uno::Refere ::rtl::OUString sOldWindowState = ::rtl::OStringToOUString( pSystemWindow->GetWindowState(), RTL_TEXTENCODING_ASCII_US ); if ( sOldWindowState != sWindowState ) - pSystemWindow->SetWindowState(U2B_ENC(sWindowState,RTL_TEXTENCODING_UTF8)); + pSystemWindow->SetWindowState(rtl::OUStringToOString(sWindowState,RTL_TEXTENCODING_UTF8)); // <- SOLAR SAFE ------------------------ } diff --git a/framework/source/inc/pattern/window.hxx b/framework/source/inc/pattern/window.hxx index faecdaea9105..752f5fe898b4 100644 --- a/framework/source/inc/pattern/window.hxx +++ b/framework/source/inc/pattern/window.hxx @@ -72,7 +72,7 @@ static ::rtl::OUString getWindowState(const css::uno::Reference< css::awt::XWind if (!xWindow.is()) return ::rtl::OUString(); - ByteString sWindowState; + rtl::OString sWindowState; // SOLAR SAFE -> ---------------------------- { SolarMutexGuard aSolarGuard; @@ -88,7 +88,7 @@ static ::rtl::OUString getWindowState(const css::uno::Reference< css::awt::XWind } // <- SOLAR SAFE ---------------------------- - return B2U_ENC(sWindowState,RTL_TEXTENCODING_UTF8); + return rtl::OStringToOUString(sWindowState,RTL_TEXTENCODING_UTF8); } //----------------------------------------------- @@ -116,7 +116,7 @@ static void setWindowState(const css::uno::Reference< css::awt::XWindow >& xWind ) ) { - ((SystemWindow*)pWindow)->SetWindowState(U2B_ENC(sWindowState,RTL_TEXTENCODING_UTF8)); + ((SystemWindow*)pWindow)->SetWindowState(OUStringToOString(sWindowState,RTL_TEXTENCODING_UTF8)); } // <- SOLAR SAFE ---------------------------- diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index 1f00f77d2e55..9cf6a202d9ad 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -57,24 +57,19 @@ using namespace com::sun::star; namespace framework { -bool hasEmptySize( const:: Size& aSize ) +bool hasEmptySize( const ::com::sun::star::awt::Size& rSize ) { - return ( aSize.Width() == 0 ) && ( aSize.Height() == 0 ); + return ( rSize.Width == 0 ) && ( rSize.Height == 0 ); } -bool hasDefaultPosValue( const ::Point& aPos ) +bool hasDefaultPosValue( const ::com::sun::star::awt::Point& rPos ) { - return (( aPos.X() == SAL_MAX_INT32 ) || ( aPos.Y() == SAL_MAX_INT32 )); + return (( rPos.X == SAL_MAX_INT32 ) || ( rPos.Y == SAL_MAX_INT32 )); } -bool isDefaultPos( const ::com::sun::star::awt::Point& aPos ) +bool isDefaultPos( const ::com::sun::star::awt::Point& rPos ) { - return (( aPos.X == SAL_MAX_INT32 ) && ( aPos.Y == SAL_MAX_INT32 )); -} - -bool isDefaultPos( const ::Point& aPos ) -{ - return (( aPos.X() == SAL_MAX_INT32 ) && ( aPos.Y() == SAL_MAX_INT32 )); + return (( rPos.X == SAL_MAX_INT32 ) && ( rPos.Y == SAL_MAX_INT32 )); } bool isReverseOrderDockingArea( const sal_Int32 nDockArea ) diff --git a/framework/source/layoutmanager/helpers.hxx b/framework/source/layoutmanager/helpers.hxx index 704fb7ac4d8d..bfa4b045fcca 100644 --- a/framework/source/layoutmanager/helpers.hxx +++ b/framework/source/layoutmanager/helpers.hxx @@ -61,10 +61,9 @@ namespace framework { -bool hasEmptySize( const:: Size& aSize ); -bool hasDefaultPosValue( const ::Point& aPos ); -bool isDefaultPos( const ::com::sun::star::awt::Point& aPos ); -bool isDefaultPos( const ::Point& aPos ); +bool hasEmptySize( const ::com::sun::star::awt::Size& rSize ); +bool hasDefaultPosValue( const ::com::sun::star::awt::Point& rPos ); +bool isDefaultPos( const ::com::sun::star::awt::Point& rPos ); bool isToolboxHorizontalAligned( ToolBox* pToolBox ); bool isReverseOrderDockingArea( const sal_Int32 nDockArea ); bool isHorizontalDockingArea( const sal_Int32 nDockArea ); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index a7bc56cbd954..c69ae4187dcf 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -93,6 +93,8 @@ #include <rtl/instance.hxx> #include <unotools/cmdoptions.hxx> +#include <rtl/strbuf.hxx> + #include <algorithm> #include <boost/bind.hpp> @@ -221,8 +223,12 @@ void LayoutManager::impl_clearUpMenuBar() { xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMenuBar" ))) >>= xMenuBar; } - catch ( beans::UnknownPropertyException ) {} - catch ( lang::WrappedTargetException ) {} + catch (const beans::UnknownPropertyException&) + { + } + catch (const lang::WrappedTargetException&) + { + } } VCLXMenu* pAwtMenuBar = VCLXMenu::GetImplementation( xMenuBar ); @@ -310,7 +316,9 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) // Remove listener to old module ui configuration manager xModuleCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) {} + catch (const Exception&) + { + } } try @@ -320,7 +328,9 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) if ( xModuleCfgMgr.is() ) xModuleCfgMgr->addConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) {} + catch (const Exception&) + { + } try { @@ -328,8 +338,12 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) if ( xPersistentWindowStateSupplier.is() ) xPersistentWindowStateSupplier->getByName( aModuleIdentifier ) >>= xPersistentWindowState; } - catch ( NoSuchElementException& ) {} - catch ( WrappedTargetException& ) {} + catch (const NoSuchElementException&) + { + } + catch (const WrappedTargetException&) + { + } } xModel = impl_getModelFromFrame( xFrame ); @@ -345,7 +359,9 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) // Remove listener to old ui configuration manager xDocCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) {} + catch (const Exception&) + { + } } try @@ -354,7 +370,9 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) if ( xDocCfgMgr.is() ) xDocCfgMgr->addConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) {} + catch (const Exception&) + { + } } } } @@ -368,7 +386,9 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) xModuleCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) {} + catch (const Exception&) + { + } } if ( xDocCfgMgr.is() ) @@ -378,7 +398,9 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) xDocCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) {} + catch (const Exception&) + { + } } // Release references to our configuration managers as we currently don't have @@ -550,28 +572,19 @@ sal_Bool LayoutManager::implts_readWindowStateData( const rtl::OUString& aName, { awt::Point aPoint; if ( aWindowState[n].Value >>= aPoint ) - { - rElementData.m_aDockedData.m_aPos.X() = aPoint.X; - rElementData.m_aDockedData.m_aPos.Y() = aPoint.Y; - } + rElementData.m_aDockedData.m_aPos = aPoint; } else if ( aWindowState[n].Name == m_aPropPos ) { awt::Point aPoint; if ( aWindowState[n].Value >>= aPoint ) - { - rElementData.m_aFloatingData.m_aPos.X() = aPoint.X; - rElementData.m_aFloatingData.m_aPos.Y() = aPoint.Y; - } + rElementData.m_aFloatingData.m_aPos = aPoint; } else if ( aWindowState[n].Name == m_aPropSize ) { awt::Size aSize; if ( aWindowState[n].Value >>= aSize ) - { - rElementData.m_aFloatingData.m_aSize.Width() = aSize.Width; - rElementData.m_aFloatingData.m_aSize.Height() = aSize.Height; - } + rElementData.m_aFloatingData.m_aSize = aSize; } else if ( aWindowState[n].Name == m_aPropUIName ) aWindowState[n].Value >>= rElementData.m_aUIName; @@ -636,7 +649,9 @@ sal_Bool LayoutManager::implts_readWindowStateData( const rtl::OUString& aName, return sal_True; } - catch ( NoSuchElementException& ) {} + catch (const NoSuchElementException&) + { + } } return sal_False; @@ -660,12 +675,14 @@ void LayoutManager::implts_writeWindowStateData( const rtl::OUString& aName, con // Check persistent flag of the user interface element xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Persistent" ))) >>= bPersistent; } - catch ( beans::UnknownPropertyException ) + catch (const beans::UnknownPropertyException&) { // Non-configurable elements should at least store their dimension/position bPersistent = sal_True; } - catch ( lang::WrappedTargetException ) {} + catch (const lang::WrappedTargetException&) + { + } } if ( bPersistent && xPersistentWindowState.is() ) @@ -682,22 +699,14 @@ void LayoutManager::implts_writeWindowStateData( const rtl::OUString& aName, con aWindowState[2].Name = m_aPropDockingArea; aWindowState[2].Value = makeAny( static_cast< DockingArea >( rElementData.m_aDockedData.m_nDockedArea ) ); - awt::Point aPos; - aPos.X = rElementData.m_aDockedData.m_aPos.X(); - aPos.Y = rElementData.m_aDockedData.m_aPos.Y(); aWindowState[3].Name = m_aPropDockPos; - aWindowState[3].Value <<= aPos; + aWindowState[3].Value <<= rElementData.m_aDockedData.m_aPos; - aPos.X = rElementData.m_aFloatingData.m_aPos.X(); - aPos.Y = rElementData.m_aFloatingData.m_aPos.Y(); aWindowState[4].Name = m_aPropPos; - aWindowState[4].Value <<= aPos; + aWindowState[4].Value <<= rElementData.m_aFloatingData.m_aPos; - awt::Size aSize; - aSize.Width = rElementData.m_aFloatingData.m_aSize.Width(); - aSize.Height = rElementData.m_aFloatingData.m_aSize.Height(); aWindowState[5].Name = m_aPropSize; - aWindowState[5].Value <<= aSize; + aWindowState[5].Value <<= rElementData.m_aFloatingData.m_aSize; aWindowState[6].Name = m_aPropUIName; aWindowState[6].Value = makeAny( rElementData.m_aUIName ); aWindowState[7].Name = m_aPropLocked; @@ -714,7 +723,9 @@ void LayoutManager::implts_writeWindowStateData( const rtl::OUString& aName, con xInsert->insertByName( aName, makeAny( aWindowState )); } } - catch ( Exception& ) {} + catch (const Exception&) + { + } } // Reset flag @@ -752,8 +763,12 @@ Reference< XUIElement > LayoutManager::implts_createElement( const rtl::OUString { xUIElement = m_xUIElementFactoryManager->createUIElement( aName, aPropSeq ); } - catch ( NoSuchElementException& ) {} - catch ( IllegalArgumentException& ) {} + catch (const NoSuchElementException&) + { + } + catch (const IllegalArgumentException&) + { + } return xUIElement; } @@ -1412,8 +1427,13 @@ void LayoutManager::implts_reparentChildWindows() { xStatusBarWindow = Reference< awt::XWindow >( aStatusBarElement.m_xUIElement->getRealInterface(), UNO_QUERY ); } - catch ( RuntimeException& ) { throw; } - catch ( Exception& ) {} + catch (const RuntimeException&) + { + throw; + } + catch (const Exception&) + { + } } if ( xStatusBarWindow.is() ) @@ -1499,7 +1519,7 @@ throw (RuntimeException) } else if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) { - // PB 2004-12-15 #i38743# don't create a menubar if frame isn't top + // #i38743# don't create a menubar if frame isn't top if ( !bInPlaceMenu && !m_xMenuBar.is() && implts_isFrameOrWindowTop( xFrame )) { m_xMenuBar = implts_createElement( aName ); @@ -1519,8 +1539,12 @@ throw (RuntimeException) { xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMenuBar" ))) >>= xMenuBar; } - catch ( beans::UnknownPropertyException ) {} - catch ( lang::WrappedTargetException ) {} + catch (const beans::UnknownPropertyException&) + { + } + catch (const lang::WrappedTargetException&) + { + } } if ( xMenuBar.is() ) @@ -2274,11 +2298,11 @@ throw (RuntimeException) RTL_LOGFILE_TRACE1( "framework (cd100003) ::LayoutManager::lock lockCount=%d", nLockCount ); #ifdef DBG_UTIL - ByteString aStr("LayoutManager::lock "); - aStr += ByteString::CreateFromInt32((long)this); - aStr += " - "; - aStr += ByteString::CreateFromInt32(nLockCount); - OSL_TRACE( aStr.GetBuffer() ); + rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("LayoutManager::lock ")); + aStr.append(reinterpret_cast<sal_Int64>(this)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(" - ")); + aStr.append(nLockCount); + OSL_TRACE(aStr.getStr()); #endif Any a( nLockCount ); @@ -2296,11 +2320,11 @@ throw (RuntimeException) RTL_LOGFILE_TRACE1( "framework (cd100003) ::LayoutManager::unlock lockCount=%d", nLockCount ); #ifdef DBG_UTIL - ByteString aStr("LayoutManager::unlock "); - aStr += ByteString::CreateFromInt32((long)this); - aStr += " - "; - aStr += ByteString::CreateFromInt32(nLockCount); - OSL_TRACE( aStr.GetBuffer() ); + rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("LayoutManager::unlock ")); + aStr.append(reinterpret_cast<sal_Int64>(this)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(" - ")); + aStr.append(nLockCount); + OSL_TRACE(aStr.getStr()); #endif // conform to documentation: unlock with lock count == 0 means force a layout @@ -2917,7 +2941,9 @@ throw( RuntimeException ) xModuleCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) {} + catch (const Exception&) + { + } } if ( m_xDocCfgMgr.is() ) @@ -2928,7 +2954,9 @@ throw( RuntimeException ) xDocCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) {} + catch (const Exception&) + { + } } m_xDocCfgMgr.clear(); diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index dafaa415ed37..2b8625834f65 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -324,10 +324,10 @@ Rectangle ToolbarLayoutManager::implts_calcDockingArea() { if ( isHorizontalDockingArea( pConstIter->m_aDockedData.m_nDockedArea )) { - if ( pConstIter->m_aDockedData.m_aPos.Y() > nCurrPos ) + if ( pConstIter->m_aDockedData.m_aPos.Y > nCurrPos ) { ++nCurrRowColumn; - nCurrPos = pConstIter->m_aDockedData.m_aPos.Y(); + nCurrPos = pConstIter->m_aDockedData.m_aPos.Y; aRowColumnSizes[nCurrDockingArea].push_back( 0 ); } @@ -336,10 +336,10 @@ Rectangle ToolbarLayoutManager::implts_calcDockingArea() } else { - if ( pConstIter->m_aDockedData.m_aPos.X() > nCurrPos ) + if ( pConstIter->m_aDockedData.m_aPos.X > nCurrPos ) { ++nCurrRowColumn; - nCurrPos = pConstIter->m_aDockedData.m_aPos.X(); + nCurrPos = pConstIter->m_aDockedData.m_aPos.X; aRowColumnSizes[nCurrDockingArea].push_back( 0 ); } @@ -506,7 +506,9 @@ bool ToolbarLayoutManager::destroyToolbar( const ::rtl::OUString& rResourceURL ) xWindow->removeWindowListener( uno::Reference< awt::XWindowListener >( static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); } - catch( uno::Exception& ) {} + catch (const uno::Exception&) + { + } try { @@ -514,7 +516,9 @@ bool ToolbarLayoutManager::destroyToolbar( const ::rtl::OUString& rResourceURL ) xDockWindow->removeDockableWindowListener( uno::Reference< awt::XDockableWindowListener >( static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); } - catch ( uno::Exception& ) {} + catch (const uno::Exception&) + { + } } else { @@ -708,7 +712,7 @@ bool ToolbarLayoutManager::dockToolbar( const ::rtl::OUString& rResourceURL, ui: aUIElement.m_aDockedData.m_nDockedArea = sal_Int16( eDockingArea ); if ( !isDefaultPos( aPos )) - aUIElement.m_aDockedData.m_aPos = ::Point( aPos.X, aPos.Y ); + aUIElement.m_aDockedData.m_aPos = aPos; if ( !xDockWindow->isFloating() ) { @@ -743,7 +747,7 @@ bool ToolbarLayoutManager::dockToolbar( const ::rtl::OUString& rResourceURL, ui: } ::Point aPixelPos; - ::Point aDockPos; + awt::Point aDockPos; implts_findNextDockingPos((ui::DockingArea)aUIElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos ); aUIElement.m_aDockedData.m_aPos = aDockPos; } @@ -768,7 +772,9 @@ bool ToolbarLayoutManager::dockToolbar( const ::rtl::OUString& rResourceURL, ui: return true; } } - catch ( lang::DisposedException& ) {} + catch (const lang::DisposedException&) + { + } } return false; @@ -844,9 +850,17 @@ long ToolbarLayoutManager::childWindowEvent( VclSimpleEvent* pEvent ) const sal_uInt32 nCount = aListenerArray.size(); for ( sal_uInt32 i = 0; i < nCount; ++i ) { - try { aListenerArray[i]->functionExecute( aToolbarName, aCommand ); } - catch ( uno::RuntimeException& ) { throw; } - catch ( uno::Exception& ) {} + try + { + aListenerArray[i]->functionExecute( aToolbarName, aCommand ); + } + catch (const uno::RuntimeException&) + { + throw; + } + catch (const uno::Exception&) + { + } } } } @@ -1012,7 +1026,9 @@ void ToolbarLayoutManager::implts_createAddonsToolBars() if ( xWindow.is() ) xWindow->addWindowListener( uno::Reference< awt::XWindowListener >( static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); } - catch ( uno::Exception& ) {} + catch (const uno::Exception&) + { + } } ::rtl::OUString aGenericAddonTitle = implts_generateGenericAddonToolbarTitle( i+1 ); @@ -1060,8 +1076,12 @@ void ToolbarLayoutManager::implts_createAddonsToolBars() } } } - catch ( container::NoSuchElementException& ) {} - catch ( lang::IllegalArgumentException& ) {} + catch (const container::NoSuchElementException&) + { + } + catch (const lang::IllegalArgumentException&) + { + } } } @@ -1158,8 +1178,13 @@ void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars() /* SAFE AREA ----------------------------------------------------------------------------------------------- */ } } - catch ( uno::RuntimeException& ) { throw; } - catch ( uno::Exception& ) {} + catch (const uno::RuntimeException&) + { + throw; + } + catch (const uno::Exception&) + { + } if ( !aMakeVisibleToolbars.empty() ) ::std::for_each( aMakeVisibleToolbars.begin(), aMakeVisibleToolbars.end(),::boost::bind( &ToolbarLayoutManager::requestToolbar, this,_1 )); @@ -1233,8 +1258,13 @@ void ToolbarLayoutManager::implts_reparentToolbars() // possible that all elements have been disposed! xWindow = uno::Reference< awt::XWindow >( xUIElement->getRealInterface(), uno::UNO_QUERY ); } - catch ( uno::RuntimeException& ) { throw; } - catch ( uno::Exception& ) {} + catch (const uno::RuntimeException&) + { + throw; + } + catch (const uno::Exception&) + { + } Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow ) @@ -1306,7 +1336,9 @@ void ToolbarLayoutManager::implts_createToolBar( const ::rtl::OUString& aName, b static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); xDockWindow->enableDocking( sal_True ); } - catch ( uno::Exception& ) {} + catch (const uno::Exception&) + { + } } /* SAFE AREA ----------------------------------------------------------------------------------------------- */ @@ -1378,8 +1410,12 @@ uno::Reference< ui::XUIElement > ToolbarLayoutManager::implts_createElement( con if ( xUIElementFactory.is() ) xUIElement = xUIElementFactory->createUIElement( aName, aPropSeq ); } - catch ( container::NoSuchElementException& ) {} - catch ( lang::IllegalArgumentException& ) {} + catch (const container::NoSuchElementException&) + { + } + catch (const lang::IllegalArgumentException&) + { + } implts_setToolbarCreation( false ); return xUIElement; @@ -1432,12 +1468,11 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno pWindow->SetText( rElement.m_aUIName ); } - ::Point aPos( rElement.m_aFloatingData.m_aPos.X(), - rElement.m_aFloatingData.m_aPos.Y() ); + awt::Point aPos(rElement.m_aFloatingData.m_aPos); bool bWriteData( false ); bool bUndefPos = hasDefaultPosValue( rElement.m_aFloatingData.m_aPos ); - bool bSetSize = ( rElement.m_aFloatingData.m_aSize.Width() != 0 && - rElement.m_aFloatingData.m_aSize.Height() != 0 ); + bool bSetSize = ( rElement.m_aFloatingData.m_aSize.Width != 0 && + rElement.m_aFloatingData.m_aSize.Height != 0 ); xDockWindow->setFloatingMode( sal_True ); if ( bUndefPos ) { @@ -1447,7 +1482,7 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno } if( bSetSize ) - xWindow->setOutputSize( AWTSize( rElement.m_aFloatingData.m_aSize ) ); + xWindow->setOutputSize(rElement.m_aFloatingData.m_aSize); else { if( pToolBox ) @@ -1467,7 +1502,7 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno // we resize the toolbar with the new (wrong) position. // To fix this problem we have to set the size BEFORE the // position. - xWindow->setPosSize( aPos.X(), aPos.Y(), 0, 0, awt::PosSize::POS ); + xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, awt::PosSize::POS ); if ( bWriteData ) implts_writeWindowStateData( rElement ); @@ -1480,7 +1515,7 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno else { bool bSetSize( false ); - ::Point aDockPos; + awt::Point aDockPos; ::Point aPixelPos; ::Size aSize; @@ -1588,28 +1623,19 @@ sal_Bool ToolbarLayoutManager::implts_readWindowStateData( const rtl::OUString& { awt::Point aPoint; if ( aWindowState[n].Value >>= aPoint ) - { - rElementData.m_aDockedData.m_aPos.X() = aPoint.X; - rElementData.m_aDockedData.m_aPos.Y() = aPoint.Y; - } + rElementData.m_aDockedData.m_aPos = aPoint; } else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_POS )) { awt::Point aPoint; if ( aWindowState[n].Value >>= aPoint ) - { - rElementData.m_aFloatingData.m_aPos.X() = aPoint.X; - rElementData.m_aFloatingData.m_aPos.Y() = aPoint.Y; - } + rElementData.m_aFloatingData.m_aPos = aPoint; } else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_SIZE )) { awt::Size aSize; if ( aWindowState[n].Value >>= aSize ) - { - rElementData.m_aFloatingData.m_aSize.Width() = aSize.Width; - rElementData.m_aFloatingData.m_aSize.Height() = aSize.Height; - } + rElementData.m_aFloatingData.m_aSize = aSize; } else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_UINAME )) aWindowState[n].Value >>= rElementData.m_aUIName; @@ -1674,7 +1700,9 @@ sal_Bool ToolbarLayoutManager::implts_readWindowStateData( const rtl::OUString& return sal_True; } - catch ( container::NoSuchElementException& ) {} + catch (const container::NoSuchElementException&) + { + } } return sal_False; @@ -1696,11 +1724,13 @@ void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElemen // Check persistent flag of the user interface element xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Persistent" ))) >>= bPersistent; } - catch ( beans::UnknownPropertyException ) + catch (const beans::UnknownPropertyException&) { bPersistent = true; // Non-configurable elements should at least store their dimension/position } - catch ( lang::WrappedTargetException ) {} + catch (const lang::WrappedTargetException&) + { + } } if ( bPersistent && xPersistentWindowState.is() ) @@ -1716,22 +1746,16 @@ void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElemen aWindowState[2].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_DOCKINGAREA ); aWindowState[2].Value = uno::makeAny( static_cast< ui::DockingArea >( rElementData.m_aDockedData.m_nDockedArea ) ); - awt::Point aPos; - aPos.X = rElementData.m_aDockedData.m_aPos.X(); - aPos.Y = rElementData.m_aDockedData.m_aPos.Y(); + awt::Point aPos = rElementData.m_aDockedData.m_aPos; aWindowState[3].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_DOCKPOS ); aWindowState[3].Value <<= aPos; - aPos.X = rElementData.m_aFloatingData.m_aPos.X(); - aPos.Y = rElementData.m_aFloatingData.m_aPos.Y(); + aPos = rElementData.m_aFloatingData.m_aPos; aWindowState[4].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_POS ); aWindowState[4].Value <<= aPos; - awt::Size aSize; - aSize.Width = rElementData.m_aFloatingData.m_aSize.Width(); - aSize.Height = rElementData.m_aFloatingData.m_aSize.Height(); aWindowState[5].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_SIZE ); - aWindowState[5].Value <<= aSize; + aWindowState[5].Value <<= rElementData.m_aFloatingData.m_aSize; aWindowState[6].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_UINAME ); aWindowState[6].Value = uno::makeAny( rElementData.m_aUIName ); aWindowState[7].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_LOCKED ); @@ -1749,7 +1773,9 @@ void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElemen xInsert->insertByName( aName, uno::makeAny( aWindowState )); } } - catch ( uno::Exception& ) {} + catch (const uno::Exception&) + { + } } // Reset flag @@ -1787,8 +1813,8 @@ void ToolbarLayoutManager::implts_writeNewWindowStateData( const rtl::OUString a rUIElement.m_bFloating = bFloating; if ( bFloating ) { - rUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y ); - rUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height ); + rUIElement.m_aFloatingData.m_aPos = awt::Point(aPos.X, aPos.Y); + rUIElement.m_aFloatingData.m_aSize = aSize; } } implts_writeWindowStateData( rUIElement ); @@ -1906,7 +1932,7 @@ void ToolbarLayoutManager::implts_setToolbar( const UIElement& rUIElement ) LAYOUT CODE PART FOR TOOLBARS ******************************************************************************/ -::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos() +awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos() { const sal_Int32 nHotZoneX = 50; const sal_Int32 nHotZoneY = 50; @@ -1919,8 +1945,8 @@ void ToolbarLayoutManager::implts_setToolbar( const UIElement& rUIElement ) uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); aReadLock.unlock(); - ::Point aStartPos( nCascadeIndentX, nCascadeIndentY ); - ::Point aCurrPos( aStartPos ); + awt::Point aStartPos( nCascadeIndentX, nCascadeIndentY ); + awt::Point aCurrPos( aStartPos ); awt::Rectangle aRect; Window* pContainerWindow( 0 ); @@ -1929,15 +1955,15 @@ void ToolbarLayoutManager::implts_setToolbar( const UIElement& rUIElement ) SolarMutexGuard aGuard; pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); if ( pContainerWindow ) - aStartPos = pContainerWindow->OutputToScreenPixel( aStartPos ); + aStartPos = AWTPoint(pContainerWindow->OutputToScreenPixel(VCLPoint(aStartPos))); } // Determine size of top and left docking area awt::Rectangle aTopRect( xTopDockingWindow->getPosSize() ); awt::Rectangle aLeftRect( xLeftDockingWindow->getPosSize() ); - aStartPos.X() += aLeftRect.Width + nCascadeIndentX; - aStartPos.Y() += aTopRect.Height + nCascadeIndentY; + aStartPos.X += aLeftRect.Width + nCascadeIndentX; + aStartPos.Y += aTopRect.Height + nCascadeIndentY; aCurrPos = aStartPos; // Try to find a cascaded position for the new floating window @@ -1955,13 +1981,13 @@ void ToolbarLayoutManager::implts_setToolbar( const UIElement& rUIElement ) if ( pWindow && pWindow->IsVisible() ) { awt::Rectangle aFloatRect = xWindow->getPosSize(); - if ((( aFloatRect.X - nHotZoneX ) <= aCurrPos.X() ) && - ( aFloatRect.X >= aCurrPos.X() ) && - (( aFloatRect.Y - nHotZoneY ) <= aCurrPos.Y() ) && - ( aFloatRect.Y >= aCurrPos.Y() )) + if ((( aFloatRect.X - nHotZoneX ) <= aCurrPos.X ) && + ( aFloatRect.X >= aCurrPos.X ) && + (( aFloatRect.Y - nHotZoneY ) <= aCurrPos.Y ) && + ( aFloatRect.Y >= aCurrPos.Y )) { - aCurrPos.X() = aFloatRect.X + nCascadeIndentX; - aCurrPos.Y() = aFloatRect.Y + nCascadeIndentY; + aCurrPos.X = aFloatRect.X + nCascadeIndentX; + aCurrPos.Y = aFloatRect.Y + nCascadeIndentY; } } } @@ -2081,7 +2107,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD { if ( nCurrPos == -1 ) { - nCurrPos = rElement.m_aDockedData.m_aPos.Y(); + nCurrPos = rElement.m_aDockedData.m_aPos.Y; nLastPos = 0; SingleRowColumnWindowData aRowColumnWindowData; @@ -2090,7 +2116,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD } sal_Int32 nSpace( 0 ); - if ( rElement.m_aDockedData.m_aPos.Y() != nCurrPos ) + if ( rElement.m_aDockedData.m_aPos.Y != nCurrPos ) { if ( eDockingArea == ui::DockingArea_DOCKINGAREA_TOP ) nLastRowColPixelPos += rRowColumnsWindowData[nIndex].nStaticSize; @@ -2098,18 +2124,18 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD nLastRowColPixelPos -= rRowColumnsWindowData[nIndex].nStaticSize; ++nIndex; nLastPos = 0; - nCurrPos = rElement.m_aDockedData.m_aPos.Y(); + nCurrPos = rElement.m_aDockedData.m_aPos.Y; SingleRowColumnWindowData aRowColumnWindowData; aRowColumnWindowData.nRowColumn = nCurrPos; rRowColumnsWindowData.push_back( aRowColumnWindowData ); } // Calc space before an element and store it - nSpace = ( rElement.m_aDockedData.m_aPos.X() - nLastPos ); - if ( rElement.m_aDockedData.m_aPos.X() >= nLastPos ) + nSpace = ( rElement.m_aDockedData.m_aPos.X - nLastPos ); + if ( rElement.m_aDockedData.m_aPos.X >= nLastPos ) { rRowColumnsWindowData[nIndex].nSpace += nSpace; - nLastPos = rElement.m_aDockedData.m_aPos.X() + aPosSize.Width; + nLastPos = rElement.m_aDockedData.m_aPos.X + aPosSize.Width; } else { @@ -2121,8 +2147,8 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD rRowColumnsWindowData[nIndex].aRowColumnWindows.push_back( xWindow ); rRowColumnsWindowData[nIndex].aUIElementNames.push_back( rElement.m_aName ); rRowColumnsWindowData[nIndex].aRowColumnWindowSizes.push_back( - awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), - rElement.m_aDockedData.m_aPos.Y(), + awt::Rectangle( rElement.m_aDockedData.m_aPos.X, + rElement.m_aDockedData.m_aPos.Y, aPosSize.Width, aPosSize.Height )); if ( rRowColumnsWindowData[nIndex].nStaticSize < aPosSize.Height ) @@ -2139,7 +2165,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD { if ( nCurrPos == -1 ) { - nCurrPos = rElement.m_aDockedData.m_aPos.X(); + nCurrPos = rElement.m_aDockedData.m_aPos.X; nLastPos = 0; SingleRowColumnWindowData aRowColumnWindowData; @@ -2148,7 +2174,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD } sal_Int32 nSpace( 0 ); - if ( rElement.m_aDockedData.m_aPos.X() != nCurrPos ) + if ( rElement.m_aDockedData.m_aPos.X != nCurrPos ) { if ( eDockingArea == ui::DockingArea_DOCKINGAREA_LEFT ) nLastRowColPixelPos += rRowColumnsWindowData[nIndex].nStaticSize; @@ -2156,18 +2182,18 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD nLastRowColPixelPos -= rRowColumnsWindowData[nIndex].nStaticSize; ++nIndex; nLastPos = 0; - nCurrPos = rElement.m_aDockedData.m_aPos.X(); + nCurrPos = rElement.m_aDockedData.m_aPos.X; SingleRowColumnWindowData aRowColumnWindowData; aRowColumnWindowData.nRowColumn = nCurrPos; rRowColumnsWindowData.push_back( aRowColumnWindowData ); } // Calc space before an element and store it - nSpace = ( rElement.m_aDockedData.m_aPos.Y() - nLastPos ); - if ( rElement.m_aDockedData.m_aPos.Y() > nLastPos ) + nSpace = ( rElement.m_aDockedData.m_aPos.Y - nLastPos ); + if ( rElement.m_aDockedData.m_aPos.Y > nLastPos ) { rRowColumnsWindowData[nIndex].nSpace += nSpace; - nLastPos = rElement.m_aDockedData.m_aPos.Y() + aPosSize.Height; + nLastPos = rElement.m_aDockedData.m_aPos.Y + aPosSize.Height; } else { @@ -2179,8 +2205,8 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD rRowColumnsWindowData[nIndex].aRowColumnWindows.push_back( xWindow ); rRowColumnsWindowData[nIndex].aUIElementNames.push_back( rElement.m_aName ); rRowColumnsWindowData[nIndex].aRowColumnWindowSizes.push_back( - awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), - rElement.m_aDockedData.m_aPos.Y(), + awt::Rectangle( rElement.m_aDockedData.m_aPos.X, + rElement.m_aDockedData.m_aPos.Y, aPosSize.Width, aPosSize.Height )); if ( rRowColumnsWindowData[nIndex].nStaticSize < aPosSize.Width ) @@ -2213,7 +2239,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D { if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea ) { - bool bSameRowCol = bHorzDockArea ? ( pIter->m_aDockedData.m_aPos.Y() == nRowCol ) : ( pIter->m_aDockedData.m_aPos.X() == nRowCol ); + bool bSameRowCol = bHorzDockArea ? ( pIter->m_aDockedData.m_aPos.Y == nRowCol ) : ( pIter->m_aDockedData.m_aPos.X == nRowCol ); uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement ); if ( bSameRowCol && xUIElement.is() ) @@ -2260,19 +2286,19 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D sal_Int32 nSpace; if ( isHorizontalDockingArea( eDockingArea )) { - nSpace = ( rElement.m_aDockedData.m_aPos.X() - nLastPos ); + nSpace = ( rElement.m_aDockedData.m_aPos.X - nLastPos ); // Calc space before an element and store it - if ( rElement.m_aDockedData.m_aPos.X() > nLastPos ) + if ( rElement.m_aDockedData.m_aPos.X > nLastPos ) rRowColumnWindowData.nSpace += nSpace; else nSpace = 0; - nLastPos = rElement.m_aDockedData.m_aPos.X() + aPosSize.Width; + nLastPos = rElement.m_aDockedData.m_aPos.X + aPosSize.Width; rRowColumnWindowData.aRowColumnWindowSizes.push_back( - awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), rElement.m_aDockedData.m_aPos.Y(), + awt::Rectangle( rElement.m_aDockedData.m_aPos.X, rElement.m_aDockedData.m_aPos.Y, aPosSize.Width, aPosSize.Height )); if ( rRowColumnWindowData.nStaticSize < aPosSize.Height ) rRowColumnWindowData.nStaticSize = aPosSize.Height; @@ -2281,16 +2307,16 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D else { // Calc space before an element and store it - nSpace = ( rElement.m_aDockedData.m_aPos.Y() - nLastPos ); - if ( rElement.m_aDockedData.m_aPos.Y() > nLastPos ) + nSpace = ( rElement.m_aDockedData.m_aPos.Y - nLastPos ); + if ( rElement.m_aDockedData.m_aPos.Y > nLastPos ) rRowColumnWindowData.nSpace += nSpace; else nSpace = 0; - nLastPos = rElement.m_aDockedData.m_aPos.Y() + aPosSize.Height; + nLastPos = rElement.m_aDockedData.m_aPos.Y + aPosSize.Height; rRowColumnWindowData.aRowColumnWindowSizes.push_back( - awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), rElement.m_aDockedData.m_aPos.Y(), + awt::Rectangle( rElement.m_aDockedData.m_aPos.X, rElement.m_aDockedData.m_aPos.Y, aPosSize.Width, aPosSize.Height )); if ( rRowColumnWindowData.nStaticSize < aPosSize.Width ) rRowColumnWindowData.nStaticSize = aPosSize.Width; @@ -2413,7 +2439,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D } } -void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingArea, const ::Size& aUIElementSize, ::Point& rVirtualPos, ::Point& rPixelPos ) +void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingArea, const ::Size& aUIElementSize, awt::Point& rVirtualPos, ::Point& rPixelPos ) { ReadGuard aReadLock( m_aLock ); uno::Reference< awt::XWindow > xDockingWindow( m_xDockAreaWindows[DockingArea] ); @@ -2476,7 +2502,7 @@ void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingAre { if ( rSpace >= nNeededSpace ) { - rVirtualPos = ::Point( nCurrPos, rRowColumnWindowData.nRowColumn ); + rVirtualPos = awt::Point( nCurrPos, rRowColumnWindowData.nRowColumn ); if ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) rPixelPos = ::Point( nCurrPos, nPixelPos ); else @@ -2489,7 +2515,7 @@ void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingAre { if ( rSpace >= nNeededSpace ) { - rVirtualPos = ::Point( rRowColumnWindowData.nRowColumn, nCurrPos ); + rVirtualPos = awt::Point( rRowColumnWindowData.nRowColumn, nCurrPos ); if ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT ) rPixelPos = ::Point( nPixelPos, nTopDockingAreaSize + nCurrPos ); else @@ -2504,7 +2530,7 @@ void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingAre { if ( isHorizontalDockingArea( DockingArea )) { - rVirtualPos = ::Point( nCurrPos, rRowColumnWindowData.nRowColumn ); + rVirtualPos = awt::Point( nCurrPos, rRowColumnWindowData.nRowColumn ); if ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) rPixelPos = ::Point( nCurrPos, nPixelPos ); else @@ -2513,7 +2539,7 @@ void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingAre } else { - rVirtualPos = ::Point( rRowColumnWindowData.nRowColumn, nCurrPos ); + rVirtualPos = awt::Point( rRowColumnWindowData.nRowColumn, nCurrPos ); if ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT ) rPixelPos = ::Point( nPixelPos, nTopDockingAreaSize + nCurrPos ); else @@ -2544,7 +2570,7 @@ void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingAre if ( isHorizontalDockingArea( DockingArea )) { - rVirtualPos = ::Point( 0, nNextFreeRowCol ); + rVirtualPos = awt::Point( 0, nNextFreeRowCol ); if ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) rPixelPos = ::Point( 0, nFreeRowColPixelPos ); else @@ -2552,7 +2578,7 @@ void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingAre } else { - rVirtualPos = ::Point( nNextFreeRowCol, 0 ); + rVirtualPos = awt::Point( nNextFreeRowCol, 0 ); rPixelPos = ::Point( aDockingWinSize.Width() - nFreeRowColPixelPos, 0 ); } } @@ -2822,6 +2848,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( // default docking operation, dock on the given row/column bool bOpOutsideOfDockingArea( !aDockingAreaRect.IsInside( rMousePos )); + std::vector< SingleRowColumnWindowData > aRowColumnsWindowData; rDockingOperation = DOCKOP_ON_COLROW; @@ -2900,8 +2927,8 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( aWindowRect = implts_determineFrontDockingRect( eDockedArea, nRowCol, aWindowRect,rUIElement.m_aName, aUIElementRect ); // Set virtual position - rUIElement.m_aDockedData.m_aPos.X() = aWindowRect.Left(); - rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; + rUIElement.m_aDockedData.m_aPos.X = aWindowRect.Left(); + rUIElement.m_aDockedData.m_aPos.Y = nRowCol; } else { @@ -2917,8 +2944,8 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( // Set virtual position sal_Int32 nPosY = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( aWindowRect.TopLeft() )).Y(); - rUIElement.m_aDockedData.m_aPos.X() = nRowCol; - rUIElement.m_aDockedData.m_aPos.Y() = nPosY; + rUIElement.m_aDockedData.m_aPos.X = nRowCol; + rUIElement.m_aDockedData.m_aPos.Y = nPosY; } rTrackingRect = aWindowRect; @@ -2934,17 +2961,18 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( { aUIElementRect.SetPos( ::Point( aContainerWinSize.Width() - aTrackingRect.getWidth(), aWindowRect.Top() )); aUIElementRect.SetSize( ::Size( aTrackingRect.getWidth(), aWindowRect.getHeight() )); - rUIElement.m_aDockedData.m_aPos.X() = aUIElementRect.Left(); + rUIElement.m_aDockedData.m_aPos.X = aUIElementRect.Left(); + } else { aUIElementRect.SetPos( ::Point( aWindowRect.Right(), aWindowRect.Top() )); aUIElementRect.SetSize( ::Size( nSize, aWindowRect.getHeight() )); - rUIElement.m_aDockedData.m_aPos.X() = aWindowRect.Right(); + rUIElement.m_aDockedData.m_aPos.X = aWindowRect.Right(); } // Set virtual position - rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; + rUIElement.m_aDockedData.m_aPos.Y = nRowCol; } else { @@ -2960,8 +2988,8 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( nPosY = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( aWindowRect.BottomRight() )).Y(); } - rUIElement.m_aDockedData.m_aPos.X() = nRowCol; - rUIElement.m_aDockedData.m_aPos.Y() = nPosY; + rUIElement.m_aDockedData.m_aPos.X = nRowCol; + rUIElement.m_aDockedData.m_aPos.Y = nPosY; } rTrackingRect = aUIElementRect; @@ -3022,9 +3050,9 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( } if ( bHorizontalDockArea ) - rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; + rUIElement.m_aDockedData.m_aPos.Y = nRowCol; else - rUIElement.m_aDockedData.m_aPos.X() = nRowCol; + rUIElement.m_aDockedData.m_aPos.X = nRowCol; rTrackingRect.Move( nOffsetX, nOffsetY ); rTrackingRect.SetSize( aTrackingRect.GetSize() ); @@ -3057,24 +3085,24 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( if ( eDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) nPosY -= rTrackingRect.getHeight(); rTrackingRect.SetPos( Point( nPosX, nPosY )); - rUIElement.m_aDockedData.m_aPos.Y() = 0; + rUIElement.m_aDockedData.m_aPos.Y = 0; } else if ( rMousePos.Y() < ( aDockingAreaRect.Top() + ( nDockHeight / 2 ))) { rTrackingRect.SetPos( Point( nPosX, aDockingAreaRect.Top() - rTrackingRect.getHeight() )); if ( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP ) - rUIElement.m_aDockedData.m_aPos.Y() = 0; + rUIElement.m_aDockedData.m_aPos.Y = 0; else - rUIElement.m_aDockedData.m_aPos.Y() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; + rUIElement.m_aDockedData.m_aPos.Y = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; rDockingOperation = DOCKOP_BEFORE_COLROW; } else { rTrackingRect.SetPos( Point( nPosX, aDockingAreaRect.Bottom() )); if ( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP ) - rUIElement.m_aDockedData.m_aPos.Y() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; + rUIElement.m_aDockedData.m_aPos.Y = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; else - rUIElement.m_aDockedData.m_aPos.Y() = 0; + rUIElement.m_aDockedData.m_aPos.Y = 0; rDockingOperation = DOCKOP_AFTER_COLROW; } rTrackingRect.setWidth( nSize ); @@ -3084,7 +3112,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( nPosX = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( rTrackingRect.TopLeft() )).X(); } - rUIElement.m_aDockedData.m_aPos.X() = nPosX; + rUIElement.m_aDockedData.m_aPos.X = nPosX; } else { @@ -3103,24 +3131,24 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( if ( eDockedArea == ui::DockingArea_DOCKINGAREA_RIGHT ) nPosX -= rTrackingRect.getWidth(); rTrackingRect.SetPos( Point( nPosX, nPosY )); - rUIElement.m_aDockedData.m_aPos.X() = 0; + rUIElement.m_aDockedData.m_aPos.X = 0; } else if ( rMousePos.X() < ( aDockingAreaRect.Left() + ( nDockWidth / 2 ))) { rTrackingRect.SetPos( Point( aDockingAreaRect.Left() - rTrackingRect.getWidth(), nPosY )); if ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT ) - rUIElement.m_aDockedData.m_aPos.X() = 0; + rUIElement.m_aDockedData.m_aPos.X = 0; else - rUIElement.m_aDockedData.m_aPos.X() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; + rUIElement.m_aDockedData.m_aPos.X = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; rDockingOperation = DOCKOP_BEFORE_COLROW; } else { rTrackingRect.SetPos( Point( aDockingAreaRect.Right(), nPosY )); if ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT ) - rUIElement.m_aDockedData.m_aPos.X() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; + rUIElement.m_aDockedData.m_aPos.X = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; else - rUIElement.m_aDockedData.m_aPos.X() = 0; + rUIElement.m_aDockedData.m_aPos.X = 0; rDockingOperation = DOCKOP_AFTER_COLROW; } rTrackingRect.setHeight( nSize ); @@ -3130,7 +3158,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( nPosY = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( rTrackingRect.TopLeft() )).Y(); } - rUIElement.m_aDockedData.m_aPos.Y() = nPosY; + rUIElement.m_aDockedData.m_aPos.Y = nPosY; } } } @@ -3187,6 +3215,7 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d aReadGuard.unlock(); bool bHorizontalDockArea( isHorizontalDockingArea( eDockingArea )); + sal_Int32 nTopDockingAreaSize( implts_getTopBottomDockingAreaSizes().Width() ); sal_Int32 nBottomDockingAreaSize( implts_getTopBottomDockingAreaSizes().Height() ); @@ -3212,8 +3241,8 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d aTrackingRect.setHeight( rRowColumnRect.getHeight() ); // Set virtual position - rUIElement.m_aDockedData.m_aPos.X() = nPosX; - rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; + rUIElement.m_aDockedData.m_aPos.X = nPosX; + rUIElement.m_aDockedData.m_aPos.Y = nRowCol; } else { @@ -3248,8 +3277,8 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d } // Set virtual position - rUIElement.m_aDockedData.m_aPos.X() = nRowCol; - rUIElement.m_aDockedData.m_aPos.Y() = nDockPosY; + rUIElement.m_aDockedData.m_aPos.X = nRowCol; + rUIElement.m_aDockedData.m_aPos.Y = nDockPosY; } return aTrackingRect; @@ -3275,7 +3304,7 @@ void ToolbarLayoutManager::implts_renumberRowColumnData( aReadLock.unlock(); bool bHorzDockingArea( isHorizontalDockingArea( eDockingArea )); - sal_Int32 nRowCol( bHorzDockingArea ? rUIElement.m_aDockedData.m_aPos.Y() : rUIElement.m_aDockedData.m_aPos.X() ); + sal_Int32 nRowCol( bHorzDockingArea ? rUIElement.m_aDockedData.m_aPos.Y : rUIElement.m_aDockedData.m_aPos.X ); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); @@ -3288,13 +3317,13 @@ void ToolbarLayoutManager::implts_renumberRowColumnData( if ( isDefaultPos( pIter->m_aDockedData.m_aPos )) continue; - sal_Int32 nWindowRowCol = ( bHorzDockingArea ) ? pIter->m_aDockedData.m_aPos.Y() : pIter->m_aDockedData.m_aPos.X(); + sal_Int32 nWindowRowCol = ( bHorzDockingArea ) ? pIter->m_aDockedData.m_aPos.Y : pIter->m_aDockedData.m_aPos.X; if ( nWindowRowCol >= nRowCol ) { if ( bHorzDockingArea ) - pIter->m_aDockedData.m_aPos.Y() += 1; + pIter->m_aDockedData.m_aPos.Y += 1; else - pIter->m_aDockedData.m_aPos.X() += 1; + pIter->m_aDockedData.m_aPos.X += 1; } } } @@ -3342,11 +3371,15 @@ void ToolbarLayoutManager::implts_renumberRowColumnData( xReplace->replaceByName( aWindowElements[i], makeAny( aPropValueSeq )); } } - catch ( uno::Exception& ) {} + catch (const uno::Exception&) + { + } } } } - catch ( uno::Exception& ) {} + catch (const uno::Exception&) + { + } } } @@ -3384,8 +3417,8 @@ throw( uno::RuntimeException ) bool bVisible = xWindow2->isVisible(); // update element data - aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y ); - aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height ); + aUIElement.m_aFloatingData.m_aPos = awt::Point(aPos.X, aPos.Y); + aUIElement.m_aFloatingData.m_aSize = aSize; aUIElement.m_bVisible = bVisible; } @@ -3453,8 +3486,8 @@ throw (uno::RuntimeException) awt::Rectangle aPos = xWindow->getPosSize(); awt::Size aSize = xWindow->getOutputSize(); - aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y ); - aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height ); + aUIElement.m_aFloatingData.m_aPos = awt::Point(aPos.X, aPos.Y); + aUIElement.m_aFloatingData.m_aSize = aSize; SolarMutexGuard aGuard; @@ -3492,6 +3525,8 @@ throw (uno::RuntimeException) uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); UIElement aUIDockingElement( m_aDockUIElement ); + + DockingOperation eDockingOperation( DOCKOP_ON_COLROW ); bool bDockingInProgress( m_bDockingInProgress ); aReadLock.unlock(); @@ -3583,6 +3618,8 @@ throw (uno::RuntimeException) aTrackingRect.SetPos( aOutputPos ); ::Rectangle aNewDockingRect( aTrackingRect ); + + implts_calcDockingPosSize( aUIDockingElement, eDockingOperation, aNewDockingRect, aMousePos ); ::Point aScreenPos = pContainerWindow->OutputToScreenPixel( aNewDockingRect.TopLeft() ); @@ -3593,33 +3630,32 @@ throw (uno::RuntimeException) else if ( pToolBox && bDockingInProgress ) { bool bIsHorizontal = isToolboxHorizontalAligned( pToolBox ); - ::Size aFloatSize = aUIDockingElement.m_aFloatingData.m_aSize; - if ( aFloatSize.Width() > 0 && aFloatSize.Height() > 0 ) + awt::Size aFloatSize = aUIDockingElement.m_aFloatingData.m_aSize; + if ( aFloatSize.Width > 0 && aFloatSize.Height > 0 ) { - aUIDockingElement.m_aFloatingData.m_aPos = pContainerWindow->ScreenToOutputPixel( - ::Point( e.MousePos.X, e.MousePos.Y )); - aDockingData.TrackingRectangle.Height = aFloatSize.Height(); - aDockingData.TrackingRectangle.Width = aFloatSize.Width(); + aUIDockingElement.m_aFloatingData.m_aPos = AWTPoint(pContainerWindow->ScreenToOutputPixel(VCLPoint(e.MousePos))); + aDockingData.TrackingRectangle.Height = aFloatSize.Height; + aDockingData.TrackingRectangle.Width = aFloatSize.Width; } else { - aFloatSize = pToolBox->CalcWindowSizePixel(); + aFloatSize = AWTSize(pToolBox->CalcWindowSizePixel()); if ( !bIsHorizontal ) { // Floating toolbars are always horizontal aligned! We have to swap // width/height if we have a vertical aligned toolbar. - sal_Int32 nTemp = aFloatSize.Height(); - aFloatSize.Height() = aFloatSize.Width(); - aFloatSize.Width() = nTemp; + sal_Int32 nTemp = aFloatSize.Height; + aFloatSize.Height = aFloatSize.Width; + aFloatSize.Width = nTemp; } - aDockingData.TrackingRectangle.Height = aFloatSize.Height(); - aDockingData.TrackingRectangle.Width = aFloatSize.Width(); + aDockingData.TrackingRectangle.Height = aFloatSize.Height; + aDockingData.TrackingRectangle.Width = aFloatSize.Width; // For the first time we don't have any data about the floating size of a toolbar. // We calculate it and store it for later use. - aUIDockingElement.m_aFloatingData.m_aPos = pContainerWindow->ScreenToOutputPixel(::Point( e.MousePos.X, e.MousePos.Y )); - aUIDockingElement.m_aFloatingData.m_aSize = aFloatSize; + aUIDockingElement.m_aFloatingData.m_aPos = AWTPoint(pContainerWindow->ScreenToOutputPixel(VCLPoint(e.MousePos))); + aUIDockingElement.m_aFloatingData.m_aSize = aFloatSize; aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); aUIDockingElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox ); } @@ -3635,13 +3671,17 @@ throw (uno::RuntimeException) if ( !aDockingData.bFloating ) { m_aDockUIElement.m_aDockedData = aUIDockingElement.m_aDockedData; + + m_eDockOperation = eDockingOperation; } else m_aDockUIElement.m_aFloatingData = aUIDockingElement.m_aFloatingData; aWriteLock.unlock(); } - catch ( uno::Exception& ) {} + catch (const uno::Exception&) + { + } } return aDockingData; @@ -3670,7 +3710,7 @@ throw (uno::RuntimeException) uno::Reference< awt::XWindow > xWindow( aUIDockingElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY ); rUIElement.m_aFloatingData = aUIDockingElement.m_aFloatingData; awt::Rectangle aTmpRect = xWindow->getPosSize(); - rUIElement.m_aFloatingData.m_aPos = ::Point( aTmpRect.X, aTmpRect.Y ); + rUIElement.m_aFloatingData.m_aPos = awt::Point(aTmpRect.X, aTmpRect.Y); // make changes also for our local data as we use it to make data persistent aUIDockingElement.m_aFloatingData = rUIElement.m_aFloatingData; } @@ -3768,8 +3808,8 @@ throw (uno::RuntimeException) if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) { ToolBox* pToolBox = static_cast< ToolBox *>( pWindow ); - aUIDockingElement.m_aFloatingData.m_aPos = pToolBox->GetPosPixel(); - aUIDockingElement.m_aFloatingData.m_aSize = pToolBox->GetOutputSizePixel(); + aUIDockingElement.m_aFloatingData.m_aPos = AWTPoint(pToolBox->GetPosPixel()); + aUIDockingElement.m_aFloatingData.m_aSize = AWTSize(pToolBox->GetOutputSizePixel()); aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); aUIDockingElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox ); } @@ -3841,15 +3881,15 @@ throw (uno::RuntimeException) if ( !bSetSize ) { if ( pToolBox ) - aUIDockingElement.m_aFloatingData.m_aSize = pToolBox->CalcFloatingWindowSizePixel(); + aUIDockingElement.m_aFloatingData.m_aSize = AWTSize(pToolBox->CalcFloatingWindowSizePixel()); else - aUIDockingElement.m_aFloatingData.m_aSize = pWindow->GetOutputSizePixel(); + aUIDockingElement.m_aFloatingData.m_aSize = AWTSize(pWindow->GetOutputSizePixel()); } - xWindow->setPosSize( aUIDockingElement.m_aFloatingData.m_aPos.X(), - aUIDockingElement.m_aFloatingData.m_aPos.Y(), + xWindow->setPosSize( aUIDockingElement.m_aFloatingData.m_aPos.X, + aUIDockingElement.m_aFloatingData.m_aPos.Y, 0, 0, awt::PosSize::POS ); - xWindow->setOutputSize( AWTSize( aUIDockingElement.m_aFloatingData.m_aSize ) ); + xWindow->setOutputSize(aUIDockingElement.m_aFloatingData.m_aSize); } else { @@ -3858,7 +3898,7 @@ throw (uno::RuntimeException) // Docking on its default position without a preset position - // we have to find a good place for it. ::Point aPixelPos; - ::Point aDockPos; + awt::Point aDockPos; ::Size aSize; { @@ -4004,9 +4044,15 @@ throw (uno::RuntimeException) if ( xPropSet.is() ) xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))) >>= aUIName; } - catch ( container::NoSuchElementException& ) {} - catch ( beans::UnknownPropertyException& ) {} - catch ( lang::WrappedTargetException& ) {} + catch (const container::NoSuchElementException&) + { + } + catch (const beans::UnknownPropertyException&) + { + } + catch (const lang::WrappedTargetException&) + { + } { SolarMutexGuard aGuard; @@ -4151,7 +4197,9 @@ bool ToolbarLayoutManager::floatToolbar( const ::rtl::OUString& rResourceURL ) return true; } } - catch ( lang::DisposedException& ) {} + catch (const lang::DisposedException&) + { + } } return false; @@ -4176,7 +4224,9 @@ bool ToolbarLayoutManager::lockToolbar( const ::rtl::OUString& rResourceURL ) return true; } } - catch ( lang::DisposedException& ) {} + catch (const lang::DisposedException&) + { + } } return false; @@ -4201,7 +4251,9 @@ bool ToolbarLayoutManager::unlockToolbar( const ::rtl::OUString& rResourceURL ) return true; } } - catch ( lang::DisposedException& ) {} + catch (const lang::DisposedException&) + { + } } return false; @@ -4262,11 +4314,7 @@ awt::Point ToolbarLayoutManager::getToolbarPos( const ::rtl::OUString& rResource aPos.Y = aRect.Y; } else - { - ::Point aVirtualPos = aUIElement.m_aDockedData.m_aPos; - aPos.X = aVirtualPos.X(); - aPos.Y = aVirtualPos.Y(); - } + aPos = aUIElement.m_aDockedData.m_aPos; } return aPos; @@ -4281,7 +4329,7 @@ void ToolbarLayoutManager::setToolbarSize( const ::rtl::OUString& rResourceURL, if ( xWindow.is() && xDockWindow.is() && xDockWindow->isFloating() ) { xWindow->setOutputSize( aSize ); - aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height ); + aUIElement.m_aFloatingData.m_aSize = aSize; implts_setToolbar( aUIElement ); implts_writeWindowStateData( aUIElement ); implts_sortUIElements(); @@ -4297,7 +4345,7 @@ void ToolbarLayoutManager::setToolbarPos( const ::rtl::OUString& rResourceURL, c if ( xWindow.is() && xDockWindow.is() && xDockWindow->isFloating() ) { xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, awt::PosSize::POS ); - aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y ); + aUIElement.m_aFloatingData.m_aPos = aPos; implts_setToolbar( aUIElement ); implts_writeWindowStateData( aUIElement ); implts_sortUIElements(); diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx index 440b333f4f34..0667d2e6592a 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx @@ -232,7 +232,7 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a // layout methods //--------------------------------------------------------------------------------------------------------- void implts_setDockingAreaWindowSizes( const ::com::sun::star::awt::Rectangle& rBorderSpace ); - ::Point implts_findNextCascadeFloatingPos(); + ::com::sun::star::awt::Point implts_findNextCascadeFloatingPos(); void implts_renumberRowColumnData( ::com::sun::star::ui::DockingArea eDockingArea, DockingOperation eDockingOperation, const UIElement& rUIElement ); void implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockingArea, sal_Int32 nOffset, @@ -276,7 +276,7 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a void implts_getDockingAreaElementInfos( ::com::sun::star::ui::DockingArea DockingArea, std::vector< SingleRowColumnWindowData >& rRowColumnsWindowData ); void implts_getDockingAreaElementInfoOnSingleRowCol( ::com::sun::star::ui::DockingArea, sal_Int32 nRowCol, SingleRowColumnWindowData& rRowColumnWindowData ); - void implts_findNextDockingPos( ::com::sun::star::ui::DockingArea DockingArea, const ::Size& aUIElementSize, ::Point& rVirtualPos, ::Point& rPixelPos ); + void implts_findNextDockingPos( ::com::sun::star::ui::DockingArea DockingArea, const ::Size& aUIElementSize, ::com::sun::star::awt::Point& rVirtualPos, ::Point& rPixelPos ); void implts_setTrackingRect( ::com::sun::star::ui::DockingArea eDockingArea, const ::Point& rMousePos, ::Rectangle& rTrackingRect ); //--------------------------------------------------------------------------------------------------------- diff --git a/framework/source/layoutmanager/uielement.cxx b/framework/source/layoutmanager/uielement.cxx index ac3dd6bf1ac0..54833b9e0235 100644 --- a/framework/source/layoutmanager/uielement.cxx +++ b/framework/source/layoutmanager/uielement.cxx @@ -71,11 +71,11 @@ namespace framework { if ( m_bFloating ) { - bool bEqual = ( m_aFloatingData.m_aPos.Y() == aUIElement.m_aFloatingData.m_aPos.Y() ); + bool bEqual = ( m_aFloatingData.m_aPos.Y == aUIElement.m_aFloatingData.m_aPos.Y ); if ( bEqual ) - return ( m_aFloatingData.m_aPos.X() < aUIElement.m_aFloatingData.m_aPos.X() ); + return ( m_aFloatingData.m_aPos.X < aUIElement.m_aFloatingData.m_aPos.X ); else - return ( m_aFloatingData.m_aPos.Y() < aUIElement.m_aFloatingData.m_aPos.Y() ); + return ( m_aFloatingData.m_aPos.Y < aUIElement.m_aFloatingData.m_aPos.Y ); } else { @@ -88,11 +88,11 @@ namespace framework if ( m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP || m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) { - if ( !( m_aDockedData.m_aPos.Y() == aUIElement.m_aDockedData.m_aPos.Y() ) ) - return ( m_aDockedData.m_aPos.Y() < aUIElement.m_aDockedData.m_aPos.Y() ); + if ( !( m_aDockedData.m_aPos.Y == aUIElement.m_aDockedData.m_aPos.Y ) ) + return ( m_aDockedData.m_aPos.Y < aUIElement.m_aDockedData.m_aPos.Y ); else { - bool bEqual = ( m_aDockedData.m_aPos.X() == aUIElement.m_aDockedData.m_aPos.X() ); + bool bEqual = ( m_aDockedData.m_aPos.X == aUIElement.m_aDockedData.m_aPos.X ); if ( bEqual ) { if ( m_bUserActive && !aUIElement.m_bUserActive ) @@ -103,16 +103,16 @@ namespace framework return sal_False; } else - return ( m_aDockedData.m_aPos.X() <= aUIElement.m_aDockedData.m_aPos.X() ); + return ( m_aDockedData.m_aPos.X <= aUIElement.m_aDockedData.m_aPos.X ); } } else { - if ( !( m_aDockedData.m_aPos.X() == aUIElement.m_aDockedData.m_aPos.X() ) ) - return ( m_aDockedData.m_aPos.X() < aUIElement.m_aDockedData.m_aPos.X() ); + if ( !( m_aDockedData.m_aPos.X == aUIElement.m_aDockedData.m_aPos.X ) ) + return ( m_aDockedData.m_aPos.X < aUIElement.m_aDockedData.m_aPos.X ); else { - bool bEqual = ( m_aDockedData.m_aPos.Y() == aUIElement.m_aDockedData.m_aPos.Y() ); + bool bEqual = ( m_aDockedData.m_aPos.Y == aUIElement.m_aDockedData.m_aPos.Y ); if ( bEqual ) { if ( m_bUserActive && !aUIElement.m_bUserActive ) @@ -123,7 +123,7 @@ namespace framework return sal_False; } else - return ( m_aDockedData.m_aPos.Y() <= aUIElement.m_aDockedData.m_aPos.Y() ); + return ( m_aDockedData.m_aPos.Y <= aUIElement.m_aDockedData.m_aPos.Y ); } } } diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index e4f73e58c16f..784f6f765d27 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -1794,7 +1794,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw return; SystemWindow* pSystemWindow = (SystemWindow*)pWindowCheck; - pSystemWindow->SetWindowState(U2B_ENC(sWindowState,RTL_TEXTENCODING_UTF8)); + pSystemWindow->SetWindowState(rtl::OUStringToOString(sWindowState,RTL_TEXTENCODING_UTF8)); // <- SOLAR SAFE } } diff --git a/framework/source/lomenubar/FrameHelper.cxx b/framework/source/lomenubar/FrameHelper.cxx index 8153ad6fa9df..b31335102fc7 100644 --- a/framework/source/lomenubar/FrameHelper.cxx +++ b/framework/source/lomenubar/FrameHelper.cxx @@ -647,7 +647,7 @@ FrameHelper::getLabelFromCommandURL (OUString commandURL) { m_xUICommands->getByName (commandURL) >>= commandProps; } - catch (com::sun::star::container::NoSuchElementException e) + catch (const com::sun::star::container::NoSuchElementException&) { return label; } diff --git a/framework/source/lomenubar/exports.cxx b/framework/source/lomenubar/exports.cxx index bb4804e68fe5..db3e07bfff04 100644 --- a/framework/source/lomenubar/exports.cxx +++ b/framework/source/lomenubar/exports.cxx @@ -40,27 +40,9 @@ namespace css = ::com::sun::star; -static void writeInfo(const css::uno::Reference< css::registry::XRegistryKey >& xRegistryKey , - const char* pImplementationName, - const char* pServiceName ) -{ - ::rtl::OUStringBuffer sKey(256); - sKey.append (::rtl::OUString::createFromAscii(pImplementationName)); - sKey.appendAscii("/UNO/SERVICES/"); - sKey.append (::rtl::OUString::createFromAscii(pServiceName)); - - xRegistryKey->createKey(sKey.makeStringAndClear()); -} - extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char** ppEnvTypeName, - uno_Environment** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplName , +SAL_DLLPUBLIC_EXPORT void* SAL_CALL lomenubar_component_getFactory(const sal_Char* pImplName , void* pServiceManager, void* /*pRegistryKey*/ ) { diff --git a/framework/source/register/register3rdcomponents.cxx b/framework/source/register/register3rdcomponents.cxx index c4fa80798507..a045ea7cba0f 100644 --- a/framework/source/register/register3rdcomponents.cxx +++ b/framework/source/register/register3rdcomponents.cxx @@ -46,8 +46,6 @@ #include <service2.hxx> #endif - COMPONENTGETIMPLEMENTATIONENVIRONMENT - COMPONENTGETFACTORY ( IFFACTORIE( Service1 ) else IFFACTORIE( Service2 ) @@ -58,8 +56,6 @@ #include <dispatch/systemexec.hxx> #include <jobs/shelljob.hxx> -COMPONENTGETIMPLEMENTATIONENVIRONMENT - COMPONENTGETFACTORY ( IFFACTORY( ::framework::HelpOnStartup ) else IFFACTORY( ::framework::TabWinFactory ) else IFFACTORY( ::framework::SystemExec ) else diff --git a/framework/source/register/registerlogindialog.cxx b/framework/source/register/registerlogindialog.cxx index c0f54947e8e3..f9d7e0091960 100644 --- a/framework/source/register/registerlogindialog.cxx +++ b/framework/source/register/registerlogindialog.cxx @@ -47,8 +47,6 @@ #include <service2.hxx> #endif - COMPONENTGETIMPLEMENTATIONENVIRONMENT - COMPONENTGETFACTORY ( IFFACTORIE( Service1 ) else IFFACTORIE( Service2 ) @@ -57,8 +55,6 @@ #include <services/logindialog.hxx> -COMPONENTGETIMPLEMENTATIONENVIRONMENT - COMPONENTGETFACTORY ( IFFACTORY( ::framework::LoginDialog ) ) diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx index a69f44a03f2d..54695d733e0c 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -44,8 +44,6 @@ #include <service2.hxx> #endif - COMPONENTGETIMPLEMENTATIONENVIRONMENT - COMPONENTGETFACTORY ( IFFACTORIE( Service1 ) else IFFACTORIE( Service2 ) @@ -91,8 +89,6 @@ #include <services/substitutepathvars.hxx> #include <services/pathsettings.hxx> -COMPONENTGETIMPLEMENTATIONENVIRONMENT - COMPONENTGETFACTORY ( IFFACTORY( ::framework::URLTransformer ) else IFFACTORY( ::framework::Desktop ) else IFFACTORY( ::framework::Frame ) else diff --git a/framework/source/register/registertemp.cxx b/framework/source/register/registertemp.cxx index 9680c2c288ff..b420fdfe02cd 100644 --- a/framework/source/register/registertemp.cxx +++ b/framework/source/register/registertemp.cxx @@ -46,8 +46,6 @@ #include <service2.hxx> #endif - COMPONENTGETIMPLEMENTATIONENVIRONMENT - COMPONENTGETFACTORY ( IFFACTORIE( Service1 ) else IFFACTORIE( Service2 ) @@ -76,8 +74,6 @@ #include <uielement/toolbarsmenucontroller.hxx> #include <uielement/popupmenucontroller.hxx> -COMPONENTGETIMPLEMENTATIONENVIRONMENT - COMPONENTGETFACTORY ( IFFACTORY( ::framework::MediaTypeDetectionHelper ) IFFACTORY( ::framework::MailToDispatcher ) else IFFACTORY( ::framework::ServiceHandler ) else diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 2f8819c7685c..3455daf1c787 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -2661,7 +2661,10 @@ void AutoRecovery::implts_openOneDoc(const ::rtl::OUString& sURL // put the filter name into the descriptor - we're not going to involve any type detection, so // the document might be lost without the FilterName property - lDescriptor[ ::comphelper::MediaDescriptor::PROP_FILTERNAME() ] <<= rInfo.RealFilter; + if ( (rInfo.DocumentState & AutoRecovery::E_TRY_LOAD_ORIGINAL) == AutoRecovery::E_TRY_LOAD_ORIGINAL) + lDescriptor[ ::comphelper::MediaDescriptor::PROP_FILTERNAME() ] <<= rInfo.RealFilter; + else + lDescriptor[ ::comphelper::MediaDescriptor::PROP_FILTERNAME() ] <<= rInfo.DefaultFilter; if ( sURL == rInfo.FactoryURL ) { diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index 14f6dc954588..a475abd93ae3 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -185,7 +185,7 @@ BackingWindow::BackingWindow( Window* i_pParent ) : } } } - catch (Exception& ) + catch (const Exception&) { } @@ -905,25 +905,6 @@ IMPL_LINK( BackingWindow, ToolboxHdl, void*, EMPTYARG ) pNodePath = "/org.openoffice.Office.Common/Help/StartCenter"; pNode = "AddFeatureURL"; break; - case nItemId_Reg: - try - { - // create the Desktop component which can load components - Reference < lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - if( xFactory.is() ) - { - Reference< task::XJobExecutor > xProductRegistration( - xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.setup.ProductRegistration" ) ) ), - UNO_QUERY_THROW ); - - // tell it that the user wants to register - xProductRegistration->trigger( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RegistrationRequired" ) ) ); - } - } - catch( const Exception& ) - { - } - break; case nItemId_Info: pNodePath = "/org.openoffice.Office.Common/Help/StartCenter"; pNode = "InfoURL"; @@ -967,7 +948,7 @@ IMPL_LINK( BackingWindow, ToolboxHdl, void*, EMPTYARG ) } } } - catch (Exception& ) + catch (const Exception&) { } } @@ -1060,7 +1041,7 @@ static long implDispatchDelayed( void*, void* pArg ) { pDispatch->xDispatch->dispatch( pDispatch->aDispatchURL, pDispatch->aArgs ); } - catch( Exception ) + catch (const Exception&) { } @@ -1108,11 +1089,11 @@ void BackingWindow::dispatchURL( const rtl::OUString& i_rURL, delete pDisp; // event could not be posted for unknown reason, at least don't leak } } - catch ( com::sun::star::uno::RuntimeException& ) + catch (const com::sun::star::uno::RuntimeException&) { throw; } - catch ( com::sun::star::uno::Exception& ) + catch (const com::sun::star::uno::Exception&) { } } diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx index 5eebccb80c5f..410862f51aaa 100644 --- a/framework/source/services/backingwindow.hxx +++ b/framework/source/services/backingwindow.hxx @@ -135,7 +135,6 @@ namespace framework std::vector< LoadRecentFile > maRecentFiles; static const int nItemId_Extensions = 1; - static const int nItemId_Reg = 2; static const int nItemId_Info = 3; static const int nItemId_TplRep = 4; static const int nShadowTop = 32; diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx index 59cb3b531e2b..efa4dfb901ae 100644 --- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx +++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx @@ -122,12 +122,18 @@ ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier( cons , m_aListenerContainer( m_aLock.getShareableOslMutex() ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier" ); - // Retrieve known modules and insert them into our boost::unordered_map to speed-up access time. - Reference< XNameAccess > xNameAccess( m_xModuleMgr, UNO_QUERY ); - const Sequence< ::rtl::OUString > aNameSeq = xNameAccess->getElementNames(); - const ::rtl::OUString* pNameSeq = aNameSeq.getConstArray(); - for ( sal_Int32 n = 0; n < aNameSeq.getLength(); n++ ) - m_aModuleToModuleUICfgMgrMap.insert( ModuleToModuleCfgMgr::value_type( pNameSeq[n], Reference< XUIConfigurationManager >() )); + try + { + // Retrieve known modules and insert them into our boost::unordered_map to speed-up access time. + Reference< XNameAccess > xNameAccess( m_xModuleMgr, UNO_QUERY_THROW ); + const Sequence< ::rtl::OUString > aNameSeq = xNameAccess->getElementNames(); + const ::rtl::OUString* pNameSeq = aNameSeq.getConstArray(); + for ( sal_Int32 n = 0; n < aNameSeq.getLength(); n++ ) + m_aModuleToModuleUICfgMgrMap.insert( ModuleToModuleCfgMgr::value_type( pNameSeq[n], Reference< XUIConfigurationManager >() )); + } + catch(...) + { + } } ModuleUIConfigurationManagerSupplier::~ModuleUIConfigurationManagerSupplier() diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 3284067a5804..62ddc7338a68 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -782,7 +782,6 @@ void SAL_CALL MenuBarManager::disposing( const EventObject& Source ) throw ( Run void MenuBarManager::CheckAndAddMenuExtension( Menu* pMenu ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::CheckAndAddMenuExtension" ); - static const char REFERENCECOMMAND_AFTER[] = ".uno:OnlineRegistrationDlg"; static const char REFERENCECOMMAND_BEFORE[] = ".uno:About"; // retrieve menu extension item @@ -793,24 +792,18 @@ void MenuBarManager::CheckAndAddMenuExtension( Menu* pMenu ) // remove all old window list entries from menu sal_uInt16 nNewItemId( 0 ); sal_uInt16 nInsertPos( MENU_APPEND ); - sal_uInt16 nAfterPos( MENU_APPEND ); sal_uInt16 nBeforePos( MENU_APPEND ); - String aCommandAfter( String::CreateFromAscii ( REFERENCECOMMAND_AFTER )); String aCommandBefore( String::CreateFromAscii ( REFERENCECOMMAND_BEFORE )); for ( sal_uInt16 n = 0; n < pMenu->GetItemCount(); n++ ) { sal_uInt16 nItemId = pMenu->GetItemId( n ); nNewItemId = std::max( nItemId, nNewItemId ); - if ( pMenu->GetItemCommand( nItemId ) == aCommandAfter ) - nAfterPos = n+1; - else if ( pMenu->GetItemCommand( nItemId ) == aCommandBefore ) + if ( pMenu->GetItemCommand( nItemId ) == aCommandBefore ) nBeforePos = n; } ++nNewItemId; - if ( nAfterPos != MENU_APPEND ) - nInsertPos = nAfterPos; - else if ( nBeforePos != MENU_APPEND ) + if ( nBeforePos != MENU_APPEND ) nInsertPos = nBeforePos; pMenu->InsertItem( nNewItemId, aMenuItem.aLabel, 0, nInsertPos ); diff --git a/framework/test/test.cxx b/framework/test/test.cxx deleted file mode 100644 index 08ace331836a..000000000000 --- a/framework/test/test.cxx +++ /dev/null @@ -1,1262 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include <classes/servicemanager.hxx> -#include <classes/filtercache.hxx> -#include <macros/generic.hxx> -#include <macros/debug.hxx> -#include <services.h> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ -#include <com/sun/star/frame/XDesktop.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/frame/XFrameLoader.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/frame/XLoadEventListener.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/util/URL.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/frame/XFrames.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> -#include <com/sun/star/frame/XTasksSupplier.hpp> -#include <com/sun/star/task/XStatusIndicatorFactory.hpp> -#include <com/sun/star/beans/XMultiPropertySet.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/mozilla/XPluginInstancePeer.hpp> -#include <com/sun/star/bridge/XInstanceProvider.hpp> -#include <com/sun/star/document/XTypeDetection.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/container/XElementAccess.hpp> -#include <com/sun/star/frame/XConfigManager.hpp> - -//_________________________________________________________________________________________________________________ -// other includes -//_________________________________________________________________________________________________________________ -#include <comphelper/processfactory.hxx> -#include <com/sun/star/uno/Reference.h> -#include <rtl/ustring.hxx> -#include <rtl/ustrbuf.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <svtools/unoiface.hxx> -#include <tools/urlobj.hxx> - -#include <vcl/event.hxx> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> -#include <stdio.h> - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define APPLICATIONNAME "FrameWork - Testapplication" - -//_________________________________________________________________________________________________________________ -// namespace -//_________________________________________________________________________________________________________________ - -using namespace ::rtl ; -using namespace ::comphelper ; -using namespace ::framework ; -using namespace ::cppu ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::frame ; -using namespace ::com::sun::star::awt ; -using namespace ::com::sun::star::beans ; -using namespace ::com::sun::star::util ; -using namespace ::com::sun::star::task ; -using namespace ::com::sun::star::mozilla ; -using namespace ::com::sun::star::bridge ; -using namespace ::com::sun::star::document ; -using namespace ::com::sun::star::container ; - -//_________________________________________________________________________________________________________________ -// defines -//_________________________________________________________________________________________________________________ - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-***************************************************************************************************************/ -class TestApplication : public Application -{ - //************************************************************************************************************* - public: - - void Main(); - - //************************************************************************************************************* - private: - - #ifdef TEST_DESKTOP - void impl_testDesktop ( const Reference< XDesktop >& xDesktop ); - void impl_buildTree ( const Reference< XDesktop >& xDesktop ); - void impl_logTree ( const Reference< XDesktop >& xDesktop ); - - #endif - - #ifdef TEST_PLUGIN - void impl_testPlugIn ( const Reference< XDesktop >& xDesktop, const Reference< XMultiServiceFactory >& xFactory ); - #endif - - #ifdef TEST_LOGINDIALOG - void impl_testLoginDialog(); - #endif - - #ifdef TEST_FILTERCACHE - void impl_testFilterCache(); - #endif - - #ifdef TEST_TYPEDETECTION - void impl_testTypeDetection(); - #endif - - #ifdef TEST_FILTERREGISTRATION - void impl_testFilterRegistration(); - #endif - - #ifdef TEST_TREESEARCH - sal_Bool impl_testTreeSearch(); - #endif - - //************************************************************************************************************* - private: - - //************************************************************************************************************* - private: - - Reference< XMultiServiceFactory > m_xFactory; - -}; // class TestApplication - -//_________________________________________________________________________________________________________________ -// global variables -//_________________________________________________________________________________________________________________ - -TestApplication aTestApplication ; - -//_________________________________________________________________________________________________________________ -// main -//_________________________________________________________________________________________________________________ - -void TestApplication::Main() -{ - - /**-*********************************************************************************************************** - initialize program - **************************************************************************************************************/ - - // Init global servicemanager and set it. - ServiceManager aManager; - m_xFactory = aManager.getGlobalUNOServiceManager(); - setProcessServiceFactory( m_xFactory ); - - // Control sucess of operation. - LOG_ASSERT( !(m_xFactory.is() ==sal_False ), "TestApplication::Main()\nCan't create global service manager.\n\n" ) - LOG_ASSERT( !(getProcessServiceFactory()!=m_xFactory), "TestApplication::Main()\nGlobal servicemanager not set in UNOTOOLS.\n\n" ) - - /**-*********************************************************************************************************** - test area - **************************************************************************************************************/ - - sal_Bool bState = sal_True; - - //------------------------------------------------------------------------------------------------------------- - #ifdef TEST_FILTERCACHE - impl_testFilterCache(); - #endif - - //------------------------------------------------------------------------------------------------------------- - #ifdef TEST_TYPEDETECTION - impl_testTypeDetection(); - #endif - - //------------------------------------------------------------------------------------------------------------- - #ifdef TEST_LOGINDIALOG - ResMgr* pRessourceManager = CREATEVERSIONRESMGR( lgd ); - Resource::SetResManager( pRessourceManager ); - impl_testLoginDialog(); - #endif - - //------------------------------------------------------------------------------------------------------------- - #ifdef TEST_DESKTOP - Reference< XDesktop > xDesktop( xGlobalServiceManager->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY ); - impl_testDesktop( xDesktop ); - #endif - - //------------------------------------------------------------------------------------------------------------- - #ifdef TEST_PLUGIN - impl_testPlugIn( xDesktop, xGlobalServiceManager ); - #endif - - //------------------------------------------------------------------------------------------------------------- - #ifdef TEST_FILTERREGISTRATION - impl_testFilterRegistration(); - #endif - - //------------------------------------------------------------------------------------------------------------- - #ifdef TEST_TREESEARCH - bState = impl_testTreeSearch(); - #endif - - if( bState == sal_True ) - { - LOG_ERROR( "TestApplication::Main()", "Test successful ..." ) - } - else - { - LOG_ERROR( "TestApplication::Main()", "Test failed ..." ) - } -} - -//_________________________________________________________________________________________________________________ -// test method -//_________________________________________________________________________________________________________________ -#ifdef TEST_TYPEDETECTION -void TestApplication::impl_testTypeDetection() -{ - // We use a string buffer to log important informations and search results. - // Errors are shown directly by an assert! - OUStringBuffer sBuffer( 100000 ); - - // Create a new type detection service. - Reference< XTypeDetection > xTypeDetection( getProcessServiceFactory()->createInstance( SERVICENAME_TYPEDETECTION ), UNO_QUERY ); - LOG_ASSERT( !(xTypeDetection.is()==sal_False), "TestApplication::impl_testTypeDetection()\nCouldn't create the type detection service.\n" ); - - if( xTypeDetection.is() == sal_True ) - { - // a) Check his implementation and his supported interfaces first. - Reference< XInterface > xInterface ( xTypeDetection, UNO_QUERY ); - Reference< XTypeProvider > xTypeProvider ( xTypeDetection, UNO_QUERY ); - Reference< XServiceInfo > xServiceInfo ( xTypeDetection, UNO_QUERY ); - Reference< XNameAccess > xNameAccess ( xTypeDetection, UNO_QUERY ); - Reference< XElementAccess > xElementAccess ( xTypeDetection, UNO_QUERY ); - - LOG_ASSERT( !( xInterface.is() == sal_False || - xTypeProvider.is() == sal_False || - xServiceInfo.is() == sal_False || - xNameAccess.is() == sal_False || - xElementAccess.is() == sal_False ), "TestApplication::impl_testTypeDetection()\nMiss supported for searched interface!\n" ) - - // b) Check OneInstance mode of service. - Reference< XTypeDetection > xTypeDetection2( getProcessServiceFactory()->createInstance( SERVICENAME_TYPEDETECTION ), UNO_QUERY ); - LOG_ASSERT( !(xTypeDetection!=xTypeDetection2), "TestApplication::impl_testTypeDetection()\nService isn't \"OneInstance\" ...!\n" ) - xTypeDetection2 = Reference< XTypeDetection >(); - - // c) Check "XTypeDetection" ... flat by URL - // Define list of URLs for checking. - OUString pURLs[] = - { - DECLARE_ASCII("file://c|/temp/test.sdw" ), - DECLARE_ASCII("private:factory/scalc" ), - DECLARE_ASCII("file://c|/temp/test.txt" ), - DECLARE_ASCII("slot:5000" ), - }; - sal_uInt32 nCount = 4; - Sequence< OUString > seqURLs( pURLs, nCount ); - - Reference< XMultiServiceFactory > xFilterFactory( getProcessServiceFactory()->createInstance( SERVICENAME_FILTERFACTORY ), UNO_QUERY ); - Reference< XMultiServiceFactory > xLoaderFactory( getProcessServiceFactory()->createInstance( SERVICENAME_FRAMELOADERFACTORY), UNO_QUERY ); - LOG_ASSERT( !(xFilterFactory.is()==sal_False), "TestApplication::impl_testTypeDetection()\nCouldn't create filter factory!\n" ) - LOG_ASSERT( !(xLoaderFactory.is()==sal_False), "TestApplication::impl_testTypeDetection()\nCouldn't create loader factory!\n" ) - - // Step over these list. - for( sal_uInt32 nURL=0; nURL<nCount; ++nURL ) - { - // Try to get a type name for every URL from list and log search result. - OUString sTypeName = xTypeDetection->queryTypeByURL( seqURLs[nURL] ); - sBuffer.appendAscii ( "queryTypeByURL( \"" ); - sBuffer.append ( seqURLs[nURL] ); - sBuffer.appendAscii ( "\" ) returns type \"" ); - sBuffer.append ( sTypeName ); - sBuffer.appendAscii ( "\"\n" ); - // If a type was found - try to get a filter and a frame loader for it. - if( sTypeName.getLength() > 0 ) - { - Reference< XInterface > xFilter = xFilterFactory->createInstance( sTypeName ); - Reference< XInterface > xLoader = xLoaderFactory->createInstance( sTypeName ); - if( xFilter.is() == sal_False ) - { - sBuffer.appendAscii( "Couldn't find an filter.\n" ); - } - else - { - Reference< XPropertySet > xFilterProperties( xFilter, UNO_QUERY ); - LOG_ASSERT( !(xFilterProperties.is()==sal_False), "TestApplication::impl_testTypeDetection()\nFilter don't support XPropertySet!\n" ) - if( xFilterProperties.is() == sal_True ) - { - OUString sUIName; - xFilterProperties->getPropertyValue( DECLARE_ASCII("UIName") ) >>= sUIName; - sBuffer.appendAscii ( "Found filter \"" ); - sBuffer.append ( sUIName ); - sBuffer.appendAscii ( "\"\n" ); - } - - Reference< XPropertySet > xLoaderProperties( xLoader, UNO_QUERY ); - LOG_ASSERT( !(xLoaderProperties.is()==sal_False), "TestApplication::impl_testTypeDetection()\nLoader don't support XPropertySet!\n" ) - if( xLoaderProperties.is() == sal_True ) - { - OUString sUIName; - xLoaderProperties->getPropertyValue( DECLARE_ASCII("UIName") ) >>= sUIName; - sBuffer.appendAscii ( "Found loader \"" ); - sBuffer.append ( sUIName ); - sBuffer.appendAscii ( "\"\n" ); - } - } - } - } - } - - WRITE_LOGFILE( "testTypeDetection.log", U2B(sBuffer.makeStringAndClear()) ) -} -#endif - -//_________________________________________________________________________________________________________________ -// test method -//_________________________________________________________________________________________________________________ -#ifdef TEST_FILTERCACHE -void TestApplication::impl_testFilterCache() -{ - FilterCache aCache; - - OUStringBuffer sBuffer( 100000 ); - if( aCache.isValid() == sal_False ) - { - sBuffer.appendAscii( "Cache isn't valid!\n" ); - } - else - { - - // searchFirstType( URL, MediaType, ClipboardFormat, startEntry ) - TCheckedTypeIterator aIterator; - sBuffer.appendAscii( "search type for \"file://c|/temp/test.sdw\"; no media type; no clipboard format\n" ); - OUString sURL = DECLARE_ASCII("file://c|/temp/test.sdw"); - const OUString* pType = aCache.searchFirstType( &sURL, NULL, NULL, aIterator ); - while( pType != NULL ) - { - sBuffer.appendAscii ( "\tfound \"" ); - sBuffer.append ( *pType ); - sBuffer.appendAscii ( "\"\n" ); - pType = aCache.searchType( &sURL, NULL, NULL, aIterator ); - } - } - - WRITE_LOGFILE( "test_FilterCache.log", U2B(sBuffer.makeStringAndClear()) ) -} -#endif - -//_________________________________________________________________________________________________________________ -// test method -//_________________________________________________________________________________________________________________ -#ifdef TEST_LOGINDIALOG -void TestApplication::impl_testLoginDialog() -{ - // Get global servicemanager to create service "LoginDialog". - Reference< XMultiServiceFactory > xFactory = getProcessServiceFactory(); - LOG_ASSERT( !(xFactory.is()==sal_False), "TestApplication::impl_testLoginDialog()\nServicemanager not valid.\n" ) - // Create LoginDialog. - Reference< XDialog > xDialog( xFactory->createInstance( DECLARE_ASCII("com.sun.star.framework.LoginDialog") ), UNO_QUERY ); - LOG_ASSERT( !(xDialog.is()==sal_False), "TestApplication::impl_testLoginDialog()\nCould not create login dialog.\n" ) - // Check set/getTitle() - /* not implemented yet! */ -// LOG_ASSERT( !(xDialog->getTitle()!=sTitle), "TestApplication::impl_testLoginDialog()\nset/getTitle don't work correct.\n" ) - - UniString sInternalURL = DECLARE_ASCII("private:factory/scalc"); - UniString sExternalURL = OUString(); - - OString sOut = "internal: "; - sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ); - sOut += "\nexternal: "; - sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ); - sOut += "\n"; - LOG_ASSERT( sal_False, sOut ) - - INetURLObject::translateToExternal( sInternalURL, sExternalURL ); - sOut = "internal: "; - sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ); - sOut += "\nexternal: "; - sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ); - sOut += "\n"; - LOG_ASSERT( sal_False, sOut ) - - INetURLObject::translateToInternal( sExternalURL, sInternalURL ); - sOut = "internal: "; - sOut += OUStringToOString( sInternalURL, RTL_TEXTENCODING_UTF8 ); - sOut += "\nexternal: "; - sOut += OUStringToOString( sExternalURL, RTL_TEXTENCODING_UTF8 ); - sOut += "\n"; - LOG_ASSERT( sal_False, sOut ) - - // Work with properties of dialog. - Reference< XPropertySet > xPropertySet( xDialog, UNO_QUERY ); - LOG_ASSERT( !(xPropertySet.is()==sal_False), "TestApplication::impl_testLoginDialog()\nCan't cast dialog to XPropertySet interface.\n" ) - Any aUserName ; - Any aPassword ; - Any aServer ; - Any aConnectionType ; - Any aPort ; - aUserName <<= DECLARE_ASCII("Andreas"); - aPassword <<= DECLARE_ASCII("Test"); - aServer <<= DECLARE_ASCII("www.yahoo.de:7777"); - aConnectionType <<= DECLARE_ASCII("Bla"); - sal_Int32 nPort = 8081; - aPort <<= nPort; - try - { - xPropertySet->setPropertyValue( DECLARE_ASCII("UserName" ), aUserName ); - xPropertySet->setPropertyValue( DECLARE_ASCII("Password" ), aPassword ); - xPropertySet->setPropertyValue( DECLARE_ASCII("Server" ), aServer ); - xPropertySet->setPropertyValue( DECLARE_ASCII("ConnectionType" ), aConnectionType ); - xPropertySet->setPropertyValue( DECLARE_ASCII("Compressed" ), aPort ); - } - catch( ::com::sun::star::beans::UnknownPropertyException& ) - { - LOG_ASSERT( sal_False, "UnkownPropertyException detected!\n" ) - } - catch( ::com::sun::star::beans::PropertyVetoException& ) - { - LOG_ASSERT( sal_False, "PropertyVetoException detected!\n" ) - } - catch( ::com::sun::star::lang::IllegalArgumentException& ) - { - LOG_ASSERT( sal_False, "IllegalArgumentException detected!\n" ) - } - catch( ::com::sun::star::lang::WrappedTargetException& ) - { - LOG_ASSERT( sal_False, "WrappedTargetException detected!\n" ) - } - catch( ::com::sun::star::uno::RuntimeException& ) - { - LOG_ASSERT( sal_False, "RuntimeException detected!\n" ) - } - - xDialog->execute(); - - OUString sUserName ; - OUString sPassword ; - OUString sServer ; - OUString sConnectionType ; - xPropertySet->getPropertyValue( DECLARE_ASCII("UserName" ) ) >>= sUserName ; - xPropertySet->getPropertyValue( DECLARE_ASCII("Password" ) ) >>= sPassword ; - xPropertySet->getPropertyValue( DECLARE_ASCII("Server" ) ) >>= sServer ; - xPropertySet->getPropertyValue( DECLARE_ASCII("ConnectionType" ) ) >>= sConnectionType ; - xPropertySet->getPropertyValue( sConnectionType ) >>= nPort ; - - LOG_ASSERT( sal_False, OUStringToOString( sUserName, RTL_TEXTENCODING_UTF8 ) ) - LOG_ASSERT( sal_False, OUStringToOString( sPassword, RTL_TEXTENCODING_UTF8 ) ) - LOG_ASSERT( sal_False, OUStringToOString( sServer , RTL_TEXTENCODING_UTF8 ) ) - LOG_ASSERT( sal_False, OUStringToOString( sConnectionType , RTL_TEXTENCODING_UTF8 ) ) - LOG_ASSERT( sal_False, OString::valueOf( (sal_Int32)nPort ) ) -} -#endif - -//_________________________________________________________________________________________________________________ -// test method -//_________________________________________________________________________________________________________________ -#ifdef TEST_PLUGIN -void TestApplication::impl_testPlugIn( const Reference< XDesktop >& xDesktop, const Reference< XMultiServiceFactory >& xFactory ) -{ - // create instance provider for creation of factories. - Reference< XInstanceProvider > xInstanceProvider( (OWeakObject*)(new OInstanceProvider( xFactory )), UNO_QUERY ); - LOG_ASSERT( !(xInstanceProvider.is()==sal_False), "TestApplication::impl_testPlugIn()\nCan't create new instance provider!\n" ) - - // try to get factory for create a plugin - Reference< XSingleServiceFactory > xPlugInFactory( xInstanceProvider->getInstance( INSTANCENAME_PLUGINFACTORY ), UNO_QUERY ); - LOG_ASSERT( !(xPlugInFactory.is()==sal_False), "TestApplication::impl_testPlugIn()\nCan't get PlugInFactory from instance provider!\n" ) - - // initialize parameter for creation of plugin - Reference< XPluginInstancePeer > xPlugInDLL =Reference< XPluginInstancePeer >(); - Sequence< Any > seqArguments(1); - seqArguments[0] <<= xPlugInDLL; - - // create plugin - Reference< XFrame > xPlugIn( xPlugInFactory->createInstanceWithArguments( seqArguments ), UNO_QUERY ); - LOG_ASSERT( !(xPlugIn.is()==sal_False), "TestApplication::impl_testPlugIn()\nFactory has created no valid plugin!\n" ) - - xPlugIn->setName( OUString(RTL_CONSTASCII_USTRINGPARAM("PlugIn")) ); - Reference< XFramesSupplier > xSupplier( xDesktop, UNO_QUERY ); - xPlugIn->setCreator( xSupplier ); -} -#endif - -//_________________________________________________________________________________________________________________ -// test method -//_________________________________________________________________________________________________________________ -#ifdef TEST_DESKTOP -#define LOGFILE_TARGETING "targeting.log" -void TestApplication::impl_testDesktop( const Reference< XDesktop >& xDesktop ) -{ - //------------------------------------------------------------------------------------------------------------- - // 1) Test cast to all supported interfaces of Desktop. - - Reference< XInterface > xDesktopInterface ( xDesktop, UNO_QUERY ); - Reference< XTypeProvider > xDesktopTypeProvider ( xDesktop, UNO_QUERY ); - Reference< XServiceInfo > xDesktopServiceInfo ( xDesktop, UNO_QUERY ); - Reference< XComponentLoader > xDesktopComponentLoader ( xDesktop, UNO_QUERY ); - Reference< XTasksSupplier > xDesktopTasksSupplier ( xDesktop, UNO_QUERY ); - Reference< XDispatchProvider > xDesktopDispatchProvider ( xDesktop, UNO_QUERY ); - Reference< XFramesSupplier > xDesktopFramesSupplier ( xDesktop, UNO_QUERY ); - Reference< XFrame > xDesktopFrame ( xDesktop, UNO_QUERY ); - Reference< XComponent > xDesktopComponent ( xDesktop, UNO_QUERY ); - Reference< XStatusIndicatorFactory > xDesktopStatusIndicatorFactory ( xDesktop, UNO_QUERY ); - Reference< XPropertySet > xDesktopPropertySet ( xDesktop, UNO_QUERY ); - Reference< XFastPropertySet > xDesktopFastPropertySet ( xDesktop, UNO_QUERY ); - Reference< XMultiPropertySet > xDesktopMultiPropertySet ( xDesktop, UNO_QUERY ); - - LOG_ASSERT( !(xDesktopInterface.is() ==sal_False), "TestApplication::impl_testDesktop()\nXInterface not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopTypeProvider.is() ==sal_False), "TestApplication::impl_testDesktop()\nXTypeProvider not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopServiceInfo.is() ==sal_False), "TestApplication::impl_testDesktop()\nXServiceInfo not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktop.is() ==sal_False), "TestApplication::impl_testDesktop()\nXDesktop not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopComponentLoader.is() ==sal_False), "TestApplication::impl_testDesktop()\nXComponentLoader not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopTasksSupplier.is() ==sal_False), "TestApplication::impl_testDesktop()\nXTasksSupplier not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopDispatchProvider.is() ==sal_False), "TestApplication::impl_testDesktop()\nXDispatchProvider not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopFramesSupplier.is() ==sal_False), "TestApplication::impl_testDesktop()\nXFramesSupplier not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopFrame.is() ==sal_False), "TestApplication::impl_testDesktop()\nXFrame not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopComponent.is() ==sal_False), "TestApplication::impl_testDesktop()\nXComponent not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopStatusIndicatorFactory.is() ==sal_False), "TestApplication::impl_testDesktop()\nXStatusIndicatorFactory not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopPropertySet.is() ==sal_False), "TestApplication::impl_testDesktop()\nXPropertySet not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopFastPropertySet.is() ==sal_False), "TestApplication::impl_testDesktop()\nXFastPropertySet not supported by Desktop.\n\n" ) - LOG_ASSERT( !(xDesktopMultiPropertySet.is() ==sal_False), "TestApplication::impl_testDesktop()\nXMultiPropertySet not supported by Desktop.\n\n" ) - - //------------------------------------------------------------------------------------------------------------- - // 2) Test set-/getName(). - - // 2a) Test default value "Desktop". - OUString sName( RTL_CONSTASCII_USTRINGPARAM("Desktop") ); - LOG_ASSERT( !(xDesktopFrame->getName()!=sName), "TestApplication::impl_testDesktop()\nDefault value of desktop name is invalid.\n\n" ) - - // 2b) Set name and try to get the same name. - sName = OUString( RTL_CONSTASCII_USTRINGPARAM("New Desktop") ); - xDesktopFrame->setName( sName ); - LOG_ASSERT( !(xDesktopFrame->getName()!=sName), "TestApplication::impl_testDesktop()\nSetting of name works not correct on desktop.\n\n" ) - - // Reset name do default! - // Its neccessary for follow operations. - sName = OUString( RTL_CONSTASCII_USTRINGPARAM("Desktop") ); - xDesktopFrame->setName( sName ); - - //------------------------------------------------------------------------------------------------------------- - // 3) Test findFrame(). - - // Build new example tree and log initial structure in file. - impl_buildTree ( xDesktop ); - impl_logTree ( xDesktop ); - - OUString sTargetFrameName; - sal_uInt32 nSearchFlags ; - Reference< XFrame > xSearchFrame ; - Reference< XFrame > xTask_4 ; - Reference< XFrame > xFrame_41 ; - Reference< XFrame > xFrame_411 ; - Reference< XFrame > xFrame_112 ; - Reference< XFrame > xFrame_1123 ; - Reference< XFrame > xFrame_11231 ; - Reference< XFrame > xFrame_11221 ; - - // 3a) Search for Desktop - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Desktop\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - sTargetFrameName = OUString(RTL_CONSTASCII_USTRINGPARAM("Desktop")); - nSearchFlags = FrameSearchFlag::SELF; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3a)-1 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Desktop\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::ALL; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3a)-2 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Desktop\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::CHILDREN; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-3 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Desktop\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::SIBLINGS; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-4 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with AUTO for \"Desktop\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::AUTO; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3a)-5 invalid\n" ); - - // 3b) Search for Task_4 - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Task_4\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - sTargetFrameName = OUString(RTL_CONSTASCII_USTRINGPARAM("Task_4")); - nSearchFlags = FrameSearchFlag::SELF; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3b)-1 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Task_4\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::SIBLINGS; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3b)-2 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Task_4\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::CHILDREN; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3b)-3 invalid\n" ); - - xTask_4 = xSearchFrame; - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Task_4\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::ALL; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3b)-4 invalid\n" ); - - // 3c) Search for Frame_41 - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Frame_41\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - sTargetFrameName = OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_41")); - nSearchFlags = FrameSearchFlag::SELF; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-1 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Frame_41\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::SIBLINGS; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-2 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Frame_41\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::CHILDREN; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-3 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Frame_41\" on Desktop\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::ALL; - xSearchFrame = xDesktopFrame->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-4 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SELF for \"Frame_41\" on Task_4\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::SELF; - xSearchFrame = xTask_4->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-5 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with SIBLINGS for \"Frame_41\" on Task_4\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::SIBLINGS; - xSearchFrame = xTask_4->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_True), "TestApplication::impl_testDesktop()\nSearch 3c)-6 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with CHILDREN for \"Frame_41\" on Task_4\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::CHILDREN; - xSearchFrame = xTask_4->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-7 invalid\n" ); - - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, " Search with ALL for \"Frame_41\" on Task_4\n" ) - WRITE_LOGFILE( LOGFILE_TARGETING, "--------------------------------------------------------------------------------\n" ) - nSearchFlags = FrameSearchFlag::ALL; - xSearchFrame = xTask_4->findFrame(sTargetFrameName, nSearchFlags); - LOG_ASSERT( !(xSearchFrame.is()==sal_False), "TestApplication::impl_testDesktop()\nSearch 3c)-8 invalid\n" ); - - xFrame_41 = xSearchFrame; - - // 3d) Search for Frame_411 - // 3e) Search for Frame_112 - // 3f) Search for Frame_1123 - // 3g) Search for Frame_11231 - // 3h) Search for Frame_11221 -} - -//_________________________________________________________________________________________________________________ -// helper method to build a new binaer-tree with desktop as top-frame -//_________________________________________________________________________________________________________________ -void TestApplication::impl_buildTree( const Reference< XDesktop >& xDesktop ) -{ - // You can append and remove frames only on XFRames interface of desktop. - // But the desktop support this interface not directly! Use getFrames() instantly. - Reference< XFramesSupplier > xDesktopSupplier( xDesktop, UNO_QUERY ); - Reference< XFrames > xFrames = xDesktopSupplier->getFrames(); - LOG_ASSERT( !(xFrames.is()==sal_False), "TestApplication::impl_buildTree()\nCan't get framesaccess on desktop.\n\n" ) - - // Create some tasks and frames. - Reference< XMultiServiceFactory > xServiceManager( getProcessServiceFactory() ); - - Reference< XTask > xTask_1( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY ); - Reference< XTask > xTask_2( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY ); - Reference< XTask > xTask_3( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY ); - Reference< XTask > xTask_4( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY ); - Reference< XTask > xTask_5( xServiceManager->createInstance(SERVICENAME_TASK), UNO_QUERY ); - Reference< XFrame > xFrame_11( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_12( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_21( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_22( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_31( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_32( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_41( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_42( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_51( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_52( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_111( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_112( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_121( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_411( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_1121( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_1122( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_1123( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_4111( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_4112( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_4113( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_11221( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - Reference< XFrame > xFrame_11231( xServiceManager->createInstance(SERVICENAME_FRAME), UNO_QUERY ); - - // Initialize tasks and frames with names to support easy finding! - Reference< XFrame > xTaskFrame_1( xTask_1, UNO_QUERY ); - Reference< XFrame > xTaskFrame_2( xTask_2, UNO_QUERY ); - Reference< XFrame > xTaskFrame_3( xTask_3, UNO_QUERY ); - Reference< XFrame > xTaskFrame_4( xTask_4, UNO_QUERY ); - Reference< XFrame > xTaskFrame_5( xTask_5, UNO_QUERY ); - - xTaskFrame_1->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_1"))); - xTaskFrame_2->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_2"))); - xTaskFrame_3->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_3"))); - xTaskFrame_4->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_4"))); - xTaskFrame_5->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Task_5"))); - xFrame_11->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11"))); - xFrame_12->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_12"))); - xFrame_21->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_21"))); - xFrame_22->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_22"))); - xFrame_31->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_31"))); - xFrame_32->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_32"))); - xFrame_41->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_41"))); - xFrame_42->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_42"))); - xFrame_51->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_51"))); - xFrame_52->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_52"))); - xFrame_111->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_111"))); - xFrame_112->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_112"))); - xFrame_121->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_121"))); - xFrame_411->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_411"))); - xFrame_1121->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1121"))); - xFrame_1122->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1122"))); - xFrame_1123->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_1123"))); - xFrame_4111->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4111"))); - xFrame_4112->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4112"))); - xFrame_4113->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_4113"))); - xFrame_11221->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11221"))); - xFrame_11231->setName(OUString(RTL_CONSTASCII_USTRINGPARAM("Frame_11231"))); - - // Build tree. - // Append tasks as childs of desktop. - xFrames->append( xTaskFrame_1 ); - xFrames->append( xTaskFrame_2 ); - xFrames->append( xTaskFrame_3 ); - xFrames->append( xTaskFrame_4 ); - xFrames->append( xTaskFrame_5 ); - - // Append frames as childs of tasks. - Reference< XFramesSupplier > xTaskFramesSupplier_1( xTask_1, UNO_QUERY ); - Reference< XFramesSupplier > xTaskFramesSupplier_2( xTask_2, UNO_QUERY ); - Reference< XFramesSupplier > xTaskFramesSupplier_3( xTask_3, UNO_QUERY ); - Reference< XFramesSupplier > xTaskFramesSupplier_4( xTask_4, UNO_QUERY ); - Reference< XFramesSupplier > xTaskFramesSupplier_5( xTask_5, UNO_QUERY ); - Reference< XFramesSupplier > xFramesSupplier_11( xFrame_11, UNO_QUERY ); - Reference< XFramesSupplier > xFramesSupplier_12( xFrame_12, UNO_QUERY ); - Reference< XFramesSupplier > xFramesSupplier_112( xFrame_112, UNO_QUERY ); - Reference< XFramesSupplier > xFramesSupplier_1122( xFrame_1122, UNO_QUERY ); - Reference< XFramesSupplier > xFramesSupplier_1123( xFrame_1123, UNO_QUERY ); - Reference< XFramesSupplier > xFramesSupplier_41( xFrame_41, UNO_QUERY ); - Reference< XFramesSupplier > xFramesSupplier_411( xFrame_411, UNO_QUERY ); - - xFrames = xTaskFramesSupplier_1->getFrames(); - xFrames->append( xFrame_11 ); - xFrames->append( xFrame_12 ); - xFrames = xTaskFramesSupplier_2->getFrames(); - xFrames->append( xFrame_21 ); - xFrames->append( xFrame_22 ); - xFrames = xTaskFramesSupplier_3->getFrames(); - xFrames->append( xFrame_31 ); - xFrames->append( xFrame_32 ); - xFrames = xTaskFramesSupplier_4->getFrames(); - xFrames->append( xFrame_41 ); - xFrames->append( xFrame_42 ); - xFrames = xTaskFramesSupplier_5->getFrames(); - xFrames->append( xFrame_51 ); - xFrames->append( xFrame_52 ); - xFrames = xFramesSupplier_11->getFrames(); - xFrames->append( xFrame_111 ); - xFrames->append( xFrame_112 ); - xFrames = xFramesSupplier_12->getFrames(); - xFrames->append( xFrame_121 ); - xFrames = xFramesSupplier_112->getFrames(); - xFrames->append( xFrame_1121 ); - xFrames->append( xFrame_1122 ); - xFrames->append( xFrame_1123 ); - xFrames = xFramesSupplier_1122->getFrames(); - xFrames->append( xFrame_11221 ); - xFrames = xFramesSupplier_1123->getFrames(); - xFrames->append( xFrame_11231 ); - xFrames = xFramesSupplier_41->getFrames(); - xFrames->append( xFrame_411 ); - xFrames = xFramesSupplier_411->getFrames(); - xFrames->append( xFrame_4111 ); - xFrames->append( xFrame_4112 ); - xFrames->append( xFrame_4113 ); - - -// WRITE_LOGFILE( LOGFILENAME_TREE, "initiale Hierarchy:" ) - impl_logTree( xDesktop ); - -// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_411->activate():" ) - xFrame_411->activate(); -// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_411->activate():" ) - impl_logTree( xDesktop ); -// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_11231->activate():" ) - xFrame_11231->activate(); -// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_11231->activate():" ) - impl_logTree( xDesktop ); - -// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_11221->activate():" ) - xFrame_11221->activate(); -// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_11221->activate():" ) - impl_logTree( xDesktop ); - - xFrame_112->deactivate(); -// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_112->deactivate():" ) - impl_logTree( xDesktop ); - -// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_41->activate():" ) - xFrame_41->activate(); -// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_41->activate():" ) - impl_logTree( xDesktop ); - -// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xTask_4->activate():" ) - xTask_4->activate(); -// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xTask_4->activate():" ) - impl_logTree( xDesktop ); - -// WRITE_LOGFILE( LOGFILENAME_EVENTS, "nach xFrame_1123->deactivate():" ) - xFrame_1123->deactivate(); -// WRITE_LOGFILE( LOGFILENAME_TREE, "nach xFrame_1123->deactivate():" ) - impl_logTree( xDesktop ); -} - -//_________________________________________________________________________________________________________________ -// helper method to log current tree state -//_________________________________________________________________________________________________________________ -void TestApplication::impl_logTree( const Reference< XDesktop >& xDesktop ) -{ -#ifdef ENABLE_SERVICEDEBUG - // Use special feature of Desktop-implementation. - // NEVER USE THIS IN RELEASE VERSIONS!!! - Reference< XSPECIALDEBUGINTERFACE > xDebug( xDesktop, UNO_QUERY ); - - // Get a "stream" of all names of frames in tree. - OUString sTreeNamesStream = xDebug->dumpVariable( DUMPVARIABLE_TREEINFO, 0 ); - // And write it to logfile. - OString sOutPut = OUStringToOString( sTreeNamesStream, RTL_TEXTENCODING_UTF8 ); -#endif -} -#endif // TEST_DESKTOP - -//_________________________________________________________________________________________________________________ -// test method for registration of new filters in configuration -//_________________________________________________________________________________________________________________ -#ifdef TEST_FILTERREGISTRATION -void TestApplication::impl_testFilterRegistration() -{ - Reference< XNameContainer > xContainer( m_xFactory->createInstance( SERVICENAME_FILTERFACTORY ), UNO_QUERY ); - LOG_ASSERT( !(xContainer.is()==sal_False), "TestApplication::impl_testFilterRegistration()\nCould not create FilterFactory-service or cast it to XNameContainer.\n" ) - if( xContainer.is() == sal_True ) - { - Sequence< PropertyValue > lProperties( 8 ); - - lProperties[0].Name = DECLARE_ASCII("Type" ); - lProperties[0].Value <<= DECLARE_ASCII("component_DB" ); - - lProperties[1].Name = DECLARE_ASCII("UIName" ); - lProperties[1].Value <<= DECLARE_ASCII("Ein neuer Filter-Eintrag"); - - lProperties[2].Name = DECLARE_ASCII("DocumentService" ); - lProperties[2].Value <<= DECLARE_ASCII("test.document.service" ); - - lProperties[3].Name = DECLARE_ASCII("FilterService" ); - lProperties[3].Value <<= DECLARE_ASCII("test.filter.service" ); - - lProperties[4].Name = DECLARE_ASCII("Flags" ); - lProperties[4].Value <<= (sal_Int32)100; - - Sequence< OUString > lTempData(1); - lTempData[0] = DECLARE_ASCII("meine UserData"); - lProperties[5].Name = DECLARE_ASCII("UserData" ); - lProperties[5].Value <<= lTempData; - - lProperties[6].Name = DECLARE_ASCII("FileFormatVersion" ); - lProperties[6].Value <<= (sal_Int32)1; - - lProperties[7].Name = DECLARE_ASCII("TemplateName" ); - lProperties[7].Value <<= DECLARE_ASCII("Mein Template Name" ); - - Any aProperties; - aProperties <<= lProperties; - xContainer->insertByName( DECLARE_ASCII("mein_eigener_neuer_Filter"), aProperties ); - - lProperties[0].Name = DECLARE_ASCII("Type" ); - lProperties[0].Value <<= DECLARE_ASCII("component_DB" ); - - lProperties[1].Name = DECLARE_ASCII("UIName" ); - lProperties[1].Value <<= DECLARE_ASCII("Ein neuer Filter-Eintrag 2"); - - lProperties[2].Name = DECLARE_ASCII("DocumentService" ); - lProperties[2].Value <<= DECLARE_ASCII("test.document.service 2" ); - - lProperties[3].Name = DECLARE_ASCII("FilterService" ); - lProperties[3].Value <<= DECLARE_ASCII("test.filter.service 2" ); - - lProperties[4].Name = DECLARE_ASCII("Flags" ); - lProperties[4].Value <<= (sal_Int32)200; - - lTempData[0] = DECLARE_ASCII("meine UserData 2"); - lProperties[5].Name = DECLARE_ASCII("UserData" ); - lProperties[5].Value <<= lTempData; - - lProperties[6].Name = DECLARE_ASCII("FileFormatVersion" ); - lProperties[6].Value <<= (sal_Int32)2; - - lProperties[7].Name = DECLARE_ASCII("TemplateName" ); - lProperties[7].Value <<= DECLARE_ASCII("Mein Template Name 2" ); - - aProperties <<= lProperties; - xContainer->insertByName( DECLARE_ASCII("mein_eigener_neuer_Filter_2"), aProperties ); - - xContainer->removeByName( DECLARE_ASCII("mein_eigener_neuer_Filter") ); - } -} -#endif - -//_________________________________________________________________________________________________________________ -// test method for search mechanism in our frame tree -//_________________________________________________________________________________________________________________ -#ifdef TEST_TREESEARCH -sal_Bool TestApplication::impl_testTreeSearch() -{ - // Build an example tree. - Reference< XFrame > xD ( m_xFactory->createInstance( SERVICENAME_DESKTOP ), UNO_QUERY ); - Reference< XFrame > xT1 ( m_xFactory->createInstance( SERVICENAME_TASK ), UNO_QUERY ); - Reference< XFrame > xT2 ( m_xFactory->createInstance( SERVICENAME_TASK ), UNO_QUERY ); - Reference< XFrame > xT3 ( m_xFactory->createInstance( SERVICENAME_TASK ), UNO_QUERY ); - Reference< XFrame > xF11 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF12 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF21 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF22 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF211 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF212 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF221 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF2111 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF2112 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF2121 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF2122 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF2211 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF21111 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF21112 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF21121 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF21122 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF21211 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF21212 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF21221 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF21222 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - Reference< XFrame > xF22111 ( m_xFactory->createInstance( SERVICENAME_FRAME ), UNO_QUERY ); - - xD->setName ( DECLARE_ASCII("D" ) ); - xT1->setName ( DECLARE_ASCII("T1" ) ); - xT2->setName ( DECLARE_ASCII("T2" ) ); - xT3->setName ( DECLARE_ASCII("T3" ) ); - xF11->setName ( DECLARE_ASCII("F11" ) ); - xF12->setName ( DECLARE_ASCII("F12" ) ); - xF21->setName ( DECLARE_ASCII("F21" ) ); - xF22->setName ( DECLARE_ASCII("F22" ) ); - xF211->setName ( DECLARE_ASCII("F211" ) ); - xF212->setName ( DECLARE_ASCII("F212" ) ); - xF221->setName ( DECLARE_ASCII("F221" ) ); - xF2111->setName ( DECLARE_ASCII("F2111" ) ); - xF2112->setName ( DECLARE_ASCII("F2112" ) ); - xF2121->setName ( DECLARE_ASCII("F2121" ) ); - xF2122->setName ( DECLARE_ASCII("F2122" ) ); - xF2211->setName ( DECLARE_ASCII("F2211" ) ); - xF21111->setName( DECLARE_ASCII("F21111") ); - xF21112->setName( DECLARE_ASCII("F21112") ); - xF21121->setName( DECLARE_ASCII("F21121") ); - xF21122->setName( DECLARE_ASCII("F21122") ); - xF21211->setName( DECLARE_ASCII("F21211") ); - xF21212->setName( DECLARE_ASCII("F21212") ); - xF21221->setName( DECLARE_ASCII("F21221") ); - xF21222->setName( DECLARE_ASCII("F21222") ); - xF22111->setName( DECLARE_ASCII("F22111") ); - - Reference< XFramesSupplier > xSD ( xD , UNO_QUERY ); - Reference< XFramesSupplier > xST1 ( xT1 , UNO_QUERY ); - Reference< XFramesSupplier > xST2 ( xT2 , UNO_QUERY ); - Reference< XFramesSupplier > xST3 ( xT3 , UNO_QUERY ); - Reference< XFramesSupplier > xSF11 ( xF11 , UNO_QUERY ); - Reference< XFramesSupplier > xSF12 ( xF12 , UNO_QUERY ); - Reference< XFramesSupplier > xSF21 ( xF21 , UNO_QUERY ); - Reference< XFramesSupplier > xSF22 ( xF22 , UNO_QUERY ); - Reference< XFramesSupplier > xSF211 ( xF211 , UNO_QUERY ); - Reference< XFramesSupplier > xSF212 ( xF212 , UNO_QUERY ); - Reference< XFramesSupplier > xSF221 ( xF221 , UNO_QUERY ); - Reference< XFramesSupplier > xSF2111 ( xF2111 , UNO_QUERY ); - Reference< XFramesSupplier > xSF2112 ( xF2112 , UNO_QUERY ); - Reference< XFramesSupplier > xSF2121 ( xF2121 , UNO_QUERY ); - Reference< XFramesSupplier > xSF2122 ( xF2122 , UNO_QUERY ); - Reference< XFramesSupplier > xSF2211 ( xF2211 , UNO_QUERY ); - Reference< XFramesSupplier > xSF21111 ( xF21111 , UNO_QUERY ); - Reference< XFramesSupplier > xSF21112 ( xF21112 , UNO_QUERY ); - Reference< XFramesSupplier > xSF21121 ( xF21121 , UNO_QUERY ); - Reference< XFramesSupplier > xSF21122 ( xF21122 , UNO_QUERY ); - Reference< XFramesSupplier > xSF21211 ( xF21211 , UNO_QUERY ); - Reference< XFramesSupplier > xSF21212 ( xF21212 , UNO_QUERY ); - Reference< XFramesSupplier > xSF21221 ( xF21221 , UNO_QUERY ); - Reference< XFramesSupplier > xSF21222 ( xF21222 , UNO_QUERY ); - Reference< XFramesSupplier > xSF22111 ( xF22111 , UNO_QUERY ); - - xSD->getFrames()->append ( xT1 ); - xSD->getFrames()->append ( xT2 ); - xSD->getFrames()->append ( xT3 ); - xST1->getFrames()->append ( xF11 ); - xST1->getFrames()->append ( xF12 ); - xST2->getFrames()->append ( xF21 ); - xST2->getFrames()->append ( xF22 ); - xSF21->getFrames()->append ( xF211 ); - xSF21->getFrames()->append ( xF212 ); - xSF211->getFrames()->append ( xF2111 ); - xSF211->getFrames()->append ( xF2112 ); - xSF212->getFrames()->append ( xF2121 ); - xSF212->getFrames()->append ( xF2122 ); - xSF2111->getFrames()->append ( xF21111 ); - xSF2111->getFrames()->append ( xF21112 ); - xSF2112->getFrames()->append ( xF21121 ); - xSF2112->getFrames()->append ( xF21122 ); - xSF2121->getFrames()->append ( xF21211 ); - xSF2121->getFrames()->append ( xF21212 ); - xSF2122->getFrames()->append ( xF21221 ); - xSF2122->getFrames()->append ( xF21222 ); - xSF22->getFrames()->append ( xF221 ); - xSF221->getFrames()->append ( xF2211 ); - xSF2211->getFrames()->append ( xF22111 ); - - sal_Int32 nFlags = 0; - - // Test deep down search - nFlags = FrameSearchFlag::CHILDREN; - if ( - ( xD->findFrame( DECLARE_ASCII("T1" ), nFlags ) != xT1 ) || - ( xD->findFrame( DECLARE_ASCII("T2" ), nFlags ) != xT2 ) || - ( xD->findFrame( DECLARE_ASCII("T3" ), nFlags ) != xT3 ) || - ( xD->findFrame( DECLARE_ASCII("F11" ), nFlags ) != xF11 ) || - ( xD->findFrame( DECLARE_ASCII("F12" ), nFlags ) != xF12 ) || - ( xD->findFrame( DECLARE_ASCII("F21" ), nFlags ) != xF21 ) || - ( xD->findFrame( DECLARE_ASCII("F22" ), nFlags ) != xF22 ) || - ( xD->findFrame( DECLARE_ASCII("F211" ), nFlags ) != xF211 ) || - ( xD->findFrame( DECLARE_ASCII("F212" ), nFlags ) != xF212 ) || - ( xD->findFrame( DECLARE_ASCII("F2111" ), nFlags ) != xF2111 ) || - ( xD->findFrame( DECLARE_ASCII("F2112" ), nFlags ) != xF2112 ) || - ( xD->findFrame( DECLARE_ASCII("F2121" ), nFlags ) != xF2121 ) || - ( xD->findFrame( DECLARE_ASCII("F2122" ), nFlags ) != xF2122 ) || - ( xD->findFrame( DECLARE_ASCII("F21111" ), nFlags ) != xF21111 ) || - ( xD->findFrame( DECLARE_ASCII("F21112" ), nFlags ) != xF21112 ) || - ( xD->findFrame( DECLARE_ASCII("F21121" ), nFlags ) != xF21121 ) || - ( xD->findFrame( DECLARE_ASCII("F21122" ), nFlags ) != xF21122 ) || - ( xD->findFrame( DECLARE_ASCII("F21211" ), nFlags ) != xF21211 ) || - ( xD->findFrame( DECLARE_ASCII("F21212" ), nFlags ) != xF21212 ) || - ( xD->findFrame( DECLARE_ASCII("F21221" ), nFlags ) != xF21221 ) || - ( xD->findFrame( DECLARE_ASCII("F21222" ), nFlags ) != xF21222 ) || - ( xD->findFrame( DECLARE_ASCII("F221" ), nFlags ) != xF221 ) || - ( xD->findFrame( DECLARE_ASCII("F2211" ), nFlags ) != xF2211 ) || - ( xD->findFrame( DECLARE_ASCII("F22111" ), nFlags ) != xF22111 ) - ) - { - LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "deep down search failed" ) - return sal_False; - } - - // Test flat down search - nFlags = FrameSearchFlag::CHILDREN | FrameSearchFlag::SIBLINGS; - if ( - ( xD->findFrame( DECLARE_ASCII("T1" ), nFlags ) != xT1 ) || - ( xD->findFrame( DECLARE_ASCII("T2" ), nFlags ) != xT2 ) || - ( xD->findFrame( DECLARE_ASCII("T3" ), nFlags ) != xT3 ) || - ( xD->findFrame( DECLARE_ASCII("F11" ), nFlags ) != xF11 ) || - ( xD->findFrame( DECLARE_ASCII("F12" ), nFlags ) != xF12 ) || - ( xD->findFrame( DECLARE_ASCII("F21" ), nFlags ) != xF21 ) || - ( xD->findFrame( DECLARE_ASCII("F22" ), nFlags ) != xF22 ) || - ( xD->findFrame( DECLARE_ASCII("F211" ), nFlags ) != xF211 ) || - ( xD->findFrame( DECLARE_ASCII("F212" ), nFlags ) != xF212 ) || - ( xD->findFrame( DECLARE_ASCII("F2111" ), nFlags ) != xF2111 ) || - ( xD->findFrame( DECLARE_ASCII("F2112" ), nFlags ) != xF2112 ) || - ( xD->findFrame( DECLARE_ASCII("F2121" ), nFlags ) != xF2121 ) || - ( xD->findFrame( DECLARE_ASCII("F2122" ), nFlags ) != xF2122 ) || - ( xD->findFrame( DECLARE_ASCII("F21111" ), nFlags ) != xF21111 ) || - ( xD->findFrame( DECLARE_ASCII("F21112" ), nFlags ) != xF21112 ) || - ( xD->findFrame( DECLARE_ASCII("F21121" ), nFlags ) != xF21121 ) || - ( xD->findFrame( DECLARE_ASCII("F21122" ), nFlags ) != xF21122 ) || - ( xD->findFrame( DECLARE_ASCII("F21211" ), nFlags ) != xF21211 ) || - ( xD->findFrame( DECLARE_ASCII("F21212" ), nFlags ) != xF21212 ) || - ( xD->findFrame( DECLARE_ASCII("F21221" ), nFlags ) != xF21221 ) || - ( xD->findFrame( DECLARE_ASCII("F21222" ), nFlags ) != xF21222 ) || - ( xD->findFrame( DECLARE_ASCII("F221" ), nFlags ) != xF221 ) || - ( xD->findFrame( DECLARE_ASCII("F2211" ), nFlags ) != xF2211 ) || - ( xD->findFrame( DECLARE_ASCII("F22111" ), nFlags ) != xF22111 ) - ) - { - LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "flat down search failed" ) - return sal_False; - } - - // Test deep up search - // All targets must be found. Control search steps in log files! - nFlags = FrameSearchFlag::PARENT; - if ( - ( xF11->findFrame ( DECLARE_ASCII("T1"), nFlags ) != xT1 ) || // search for valid targets - ( xF12->findFrame ( DECLARE_ASCII("T1"), nFlags ) != xT1 ) || - ( xF21->findFrame ( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF22->findFrame ( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF211->findFrame ( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF212->findFrame ( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF221->findFrame ( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF2111->findFrame ( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF2121->findFrame ( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF2122->findFrame ( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF2211->findFrame ( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF21111->findFrame( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF21112->findFrame( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF21121->findFrame( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF21122->findFrame( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF21211->findFrame( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF21212->findFrame( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF21221->findFrame( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF21222->findFrame( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF22111->findFrame( DECLARE_ASCII("T2"), nFlags ) != xT2 ) || - ( xF11->findFrame ( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || // search for existing but non valid targets - ( xF12->findFrame ( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF21->findFrame ( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF22->findFrame ( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF211->findFrame ( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF212->findFrame ( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF221->findFrame ( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF2111->findFrame ( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF2121->findFrame ( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF2122->findFrame ( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF2211->findFrame ( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF21111->findFrame( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF21112->findFrame( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF21121->findFrame( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF21122->findFrame( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF21211->findFrame( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF21212->findFrame( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF21221->findFrame( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF21222->findFrame( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) || - ( xF22111->findFrame( DECLARE_ASCII("T3"), nFlags ).is() == sal_True ) - ) - { - LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "deep up search failed" ) - return sal_False; - } - - // Test inside/outside tasks search - // No frames outside current task should be found if TASKS flag isnt set. - // Otherwise he must be found! - if ( - ( xF21211->findFrame( DECLARE_ASCII("F12" ), FrameSearchFlag::ALL ) == xF12 ) || - ( xF21211->findFrame( DECLARE_ASCII("F22111"), FrameSearchFlag::GLOBAL ) != xF22111 ) || - ( xF21211->findFrame( DECLARE_ASCII("T4" ), FrameSearchFlag::GLOBAL | FrameSearchFlag::CREATE ).is() == sal_False) - ) - { - LOG_ERROR( "TestApplikation::impl_testTreeSearch()", "inside/outside task search failed" ) - return sal_False; - } - - // Test SELF - // Use the desktop, one task and one frame node to do that. - // The desktop must ignore these question ... all other must return himself. - LOG_ASSERT2( (xD->findFrame ( DECLARE_ASCII(""), FrameSearchFlag::SELF ) == xD ), "TestApplication::impl_testTreeSearch()", "SELF search for D failed\n" ) - LOG_ASSERT2( (xT1->findFrame ( DECLARE_ASCII(""), FrameSearchFlag::SELF ) != xT1 ), "TestApplication::impl_testTreeSearch()", "SELF search for T1 failed\n" ) - LOG_ASSERT2( (xF12->findFrame ( DECLARE_ASCII(""), FrameSearchFlag::SELF ) != xF12 ), "TestApplication::impl_testTreeSearch()", "SELF search for F12 failed\n" ) - - // Test special task search at desktop - // These search allow TASKS and CREATE flags only! - // We make no deep search - we work on direct children of desktop only. - // Supported for desktop only. - LOG_ASSERT2( (xD->findFrame ( DECLARE_ASCII("T1"), FrameSearchFlag::TASKS ) != xT1 ), "TestApplication::impl_testTreeSearch()", "special TASKS search for T1 failed\n" ) - LOG_ASSERT2( (xD->findFrame ( DECLARE_ASCII("T2"), FrameSearchFlag::TASKS ) != xT2 ), "TestApplication::impl_testTreeSearch()", "special TASKS search for T2 failed\n" ) - LOG_ASSERT2( (xD->findFrame ( DECLARE_ASCII("T3"), FrameSearchFlag::TASKS ) != xT3 ), "TestApplication::impl_testTreeSearch()", "special TASKS search for T3 failed\n" ) - // Attention: T4 was created before! - LOG_ASSERT2( (xD->findFrame ( DECLARE_ASCII("T5"), FrameSearchFlag::TASKS ).is() == sal_True ), "TestApplication::impl_testTreeSearch()", "special TASKS search for T5 failed\n" ) - LOG_ASSERT2( (xD->findFrame ( DECLARE_ASCII("T5"), FrameSearchFlag::TASKS | FrameSearchFlag::CREATE ).is() == sal_False ), "TestApplication::impl_testTreeSearch()", "special TASKS+CREATE search for T5 failed\n" ) - LOG_ASSERT2( (xD->findFrame ( DECLARE_ASCII("F12"), FrameSearchFlag::TASKS ).is() == sal_True ), "TestApplication::impl_testTreeSearch()", "special TASKS search for F12 failed\n" ) - LOG_ASSERT2( (xF12->findFrame ( DECLARE_ASCII("T1"), FrameSearchFlag::TASKS ).is() == sal_True ), "TestApplication::impl_testTreeSearch()", "special TASKS search for T1 from F12 failed\n" ) - LOG_ASSERT2( (xF22111->findFrame( DECLARE_ASCII("T1"), FrameSearchFlag::TASKS ).is() == sal_True ), "TestApplication::impl_testTreeSearch()", "special TASKS search for T1 from F22111 failed\n" ) - - return sal_True; -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/test/test_componentenumeration.bas b/framework/test/test_componentenumeration.bas deleted file mode 100644 index 77b64bb96939..000000000000 --- a/framework/test/test_componentenumeration.bas +++ /dev/null @@ -1,78 +0,0 @@ -rem _______________________________________________________________________________________________________________________________________ -rem Test script for helper class "framework/helper/OComponentAccess and OComponentEnumeration. -rem These two classes are used for "framework/baeh_services/Desktop::getComponents()" only. -rem _______________________________________________________________________________________________________________________________________ - - -Sub Main - - rem ___________________________________________________________________________________________________________________________________ - rem Get all current components of the frame tree as an enumeration access object. - rem The return value must be a valid reference! - xComponentAccess = StarDesktop.Components - if( isNull(xComponentAccess) = TRUE ) then - msgbox "Error: Desktop return null reference as enumeration access to all tree components!" - exit Sub - endif - - rem ___________________________________________________________________________________________________________________________________ - rem Control service specification of helper class "framework/helper/OComponentAccess". - rem The follow output must occure: com.sun.star.lang.XTypeProvider - rem com.sun.star.container.XEnumerationAccess -> com.sun.star.container.XElementAccess - msgbox xComponentAccess.dbg_supportedInterfaces - - rem ___________________________________________________________________________________________________________________________________ - rem Test interface XElementAccess of helper OComponentAcces. - - rem Method hasElements() must return TRUE, because if you call this from the basic IDE at least one task must exist ... - rem the IDE by himself. Normaly two tasks exist - an empty writer document and a basic frame. - rem Attention: Not all tasks or frames must support a full implemented component! - if( xComponentAccess.hasElements <> TRUE ) then - msgbox "Error: xComponentAccess has no elements - but I can't believe it!" - exit Sub - endif - - rem Method getElementType() must return the cppu type of XComponent. - rem Otherwise something is wrong or implementation has changed. - if( xComponentAccess.getElementType.Name <> "com.sun.star.lang.XComponent" ) then - msgbox "Error: xComponentAccess return wrong type as element type! - Has implementation changed?" - exit Sub - endif - - rem ___________________________________________________________________________________________________________________________________ - rem Test interface XEnumerationAccess of helper OComponentAcces. - rem The return value must be a valid reference! - xComponentEnumeration = xComponentAccess.createEnumeration - if( isNull(xComponentEnumeration) = TRUE ) then - msgbox "Error: Could not create a component enumeration!" - exit Sub - endif - - rem ___________________________________________________________________________________________________________________________________ - rem Control service specification of helper class "framework/helper/OComponentEnumeration". - rem The follow output must occure: com.sun.star.lang.XTypeProvider - rem com.sun.star.lang.XEventListener - rem com.sun.star.container.XEnumeration - msgbox xComponentEnumeration.dbg_supportedInterfaces - - rem ___________________________________________________________________________________________________________________________________ - rem Test interface XEnumeration of helper OComponentEnumeration. - nElementCounter = 0 - while( xComponentEnumeration.hasMoreElements = TRUE ) - xElement = xComponentEnumeration.nextElement - if( isNull(xElement) = TRUE ) then - msgbox "Error: An empty component in enumeration detected! Whats wrong?" - exit Sub - endif - nElementCounter = nElementCounter + 1 - wend - if( nElementCounter < 1 ) then - msgbox "Warning: The enumeration was empty. I think it's wrong ... please check it again." - endif - msgbox "Info: An enumeration with " + nElementCounter + " element(s) was detected." - - rem ___________________________________________________________________________________________________________________________________ - rem If this point arrived our test was successful. - msgbox "Test of framework/helper/OComponentAccess & OComponentEnumeration was successful!" - -End Sub diff --git a/framework/test/test_documentproperties.bas b/framework/test/test_documentproperties.bas deleted file mode 100644 index 15e4f62a2967..000000000000 --- a/framework/test/test_documentproperties.bas +++ /dev/null @@ -1,1083 +0,0 @@ -Sub Main - ' Oeffnen der LOG-Datei - ' Es gibt 2 Moeglichgkeiten, diesen Test zu absolvieren. - ' 1) Ausgabe von Informationen in MessageBoxen - ' 2) Ausgabe von Informationen in einer LOG-Datei - ' - ' Die Methoden OpenLOG, CloseLOG, Message, ErrorMessage und InfoMessage beruecksichtigen das automatisch! - ' Zum Umschalten zwischen den beiden Zustaenden genuegt es, eine der folgenden - ' zwei Programmzeilen zu aktivieren ... - - 'bLOGOn = cOn - bLOGOn = cOff - - 'bShowErrorsOnly = cOn - bShowErrorsOnly = cOff - - OpenLOG ( cTestPath + "TestDocumentProperties.log" ) - InfoMessage ( "Test DocumentProperties ... [start]" ) - - ' Service besorgen - InfoMessage ( "Service besorgen ... [start]" ) - aDocumentProperties = createUnoService ( "com.sun.star.document.DocumentProperties" ) - - ' Erfolg abtesten - if ( isnull ( aDocumentProperties ) ) then - ErrorMessage ( "Service konnte nicht instanziiert werden!" ) - exit sub - else - InfoMessage ( "Service erfolgreich instanziiert ..." ) - InfoMessage ( "Service besorgen ... [ende]" ) - end if - - ' Unterstuetzte Schnittstellen, Methoden und Properties anzeigen - ' Achtung: Methoden und Properties koennen nicht angezeigt werden ... - ' neues Uno <-> Basic !? - msgbox aDocumentProperties.dbg_supportedInterfaces - 'msgbox aDocumentProperties.dbg_methods - 'msgbox aDocumentProperties.dbg_properties - - ' Testen des Services unter normalen Bedingungen (also wie vorgesehen) - bState = Test_NormalUse ( aDocumentProperties ) - ' Fehlerstatus abfragen - if ( bState = cError ) then - ErrorMessage ( "Der Service arbeitet unter normalen Bedingungen nicht korrekt!" ) - end if - - bState = Test_ErrorUse ( aDocumentProperties ) - ' Fehlerstatus abfragen - if ( bState = cError ) then - ErrorMessage ( "Der Service verhaelt sich in Fehlersituationen nicht korrekt!" ) - end if - - ' Schliessen der Error-Logdatei - InfoMessage ( "Test DocumentProperties ... [ende]" ) - CloseLOG -End Sub - -'***************************************************************************************************************** -' Testfunktionen -'***************************************************************************************************************** - -'---------------------------------------------------------------------------- -' Testmethode: Testet den Service unter normalen Bedingungen -' -' Returnwert cOK bedeutet, dass sich das Objekt normal verhaelt ... -' Returnwert cError bedeutet, dass sich das ein Fehler aufgetreten ist ... -'---------------------------------------------------------------------------- -Function Test_NormalUse ( aDocumentProperties ) as Boolean - - ' Zunaechst wird vom Erfolg des Test ausgegangen. - ' Sollte einer der Detail-Tests fehlschlagen, dann wird dieser Wert - ' zurueckgesetzt. Damit wird dann angezeigt, dass mindestens ein - ' Einzeltest nicht korrekt funktionierte. - - Test_NormalUse = cOK - - bState = Test_NormalUse_XPropertySet ( aDocumentProperties ) - if ( bState = cError ) then - Test_NormalUse = cError - end if - - bState = Test_NormalUse_XNameContainer ( aDocumentProperties ) - if ( bState = cError ) then - Test_NormalUse = cError - end if - - bState = Test_NormalUse_XPersist ( aDocumentProperties ) - if ( bState = cError ) then - Test_NormalUse = cError - end if - -End Function - -'---------------------------------------------------------------------------- -' Testmethode: Testet den Service unter Randbedingungen und provoziert Fehlerzustaende -' -' Returnwert cOK bedeutet, dass das Objekt damit keine Probleme hat ... -' Returnwert cError bedeutet, dass das Objekt noch nicht robust genug ist ... -'---------------------------------------------------------------------------- -Function Test_ErrorUse ( aDocumentProperties ) as Boolean - - Test_ErrorUse = cOK - -End Function - -'---------------------------------------------------------------------------- -' Testmethode: Testen des unterstuetzten Interfaces "XPropertySet" unter normalen Bedingungen -' -' Returnwert = cOK ; wenn der Test erfolgreich war -' Returnwert = cError ; wenn sich das Objekt nicht korrekt verhalten hat -'---------------------------------------------------------------------------- -Function Test_NormalUse_XPropertySet ( aDocumentProperties ) as Boolean - - ' Einschalten der Fehlerbehandlung, um Exceptions oder aehnliches abzufangen! - on Error goto Test_NormalUse_XPropertySet_Error - - InfoMessage ( "Test_NormalUse_XPropertySet ... [start]" ) - - ' 1) Test der Funktion "getPropertySetInfo()" - ' Da diese Funktion keine Parameter besitzt und zudem eine "get"-Methode - ' darstellt, wird sie durch Basic automatisch als "Property" behandelt! - ' Daher schreibt man nicht "getPropertySetInfo()" sondern nur "PropertySetInfo". - - ' Besorgen der Info - PropertySetInfo = aDocumentProperties.PropertySetInfo - ' Und abtesten auf Gueltigkeit - if ( isnull (PropertySetInfo) ) then - ErrorMessage ( "getPropertySetInfo() ... Error (Keine Info bestimmbar!)" ) - goto Test_NormalUse_XPropertySet_Error - end if - - ' Hier fehlt noch der Test der InfoStruktur! (Laesst sich unter Basic irgendwie NICHT testen!!!???) - ' ... - - InfoMessage ( "getPropertySetInfo() ... OK" ) - - ' 2) getPropertyValue() & setPropertyValue () - ' In diesem Service sind mehrere Properties bereits definiert und vorbelegt. - ' Zum Test werden repraesentativ einige davon verwendet. Naemlich je eine - ' der verschiedenen Datentypen! - ' Das sind im folgenden: OWString, sal_Bool, sal_Int16, sal_uInt16, sal_Int32, DateTime, Sequence< sal_Int8 > - ' Achtung! sal_uInt16 kann in Basic so nicht dargestellt werden. Daher wird ein normaler - ' Integer-Wert angenommen - Bedingung ist, das hier im Test der Wertebereich nicht - ' ueberschritten wird! - ' Es wird versucht den Standardwert dieser zu ermitteln und zu merken; - ' dann einen neuen Wert zu setzen; sowie diesen wiederum zu lesen und mit den - ' vorherigen Werten zu vergleichen! - - ' Zunaechst werden die Standardwerte dieser Properties besorgt ... - sDefaultValue_OWString$ = aDocumentProperties.getPropertyValue ( "Author" ) - bDefaultValue_sal_Bool = aDocumentProperties.getPropertyValue ( "AutoloadEnabled" ) - nDefaultValue_sal_Int16% = aDocumentProperties.getPropertyValue ( "EditingCycles" ) - nDefaultValue_sal_uInt16% = aDocumentProperties.getPropertyValue ( "Priority" ) - nDefaultValue_sal_Int32& = aDocumentProperties.getPropertyValue ( "EditingDuration" ) - aDefaultValue_DateTime = aDocumentProperties.getPropertyValue ( "ModifyDate" ) -' aDefaultValue_ByteSequence = aDocumentProperties.getPropertyValue ( "ExtraData" ) - aDefaultValue_ByteSequence = aDocumentProperties.ExtraData - - ' ... dann die Werte zur Kontrolle ausgeben. - ShowProperties ( aDocumentProperties ) - - InfoMessage ( "getPropertyValue() ... OK" ) - - ' Jetzt werden neue Werte vereinbart ... - ' Diese werden so gewaehlt, das sie garantiert von den Standardwerten verschieden sind! - ' Dazu werden die alten auf Wert abgefragt und entsprechend die neuen gesetzt. - sNewValue_OWString$ = sDefaultValue_OWString$ + "NeuerWert" - bNewValue_sal_Bool = not bDefaultValue_sal_Bool - nNewValue_sal_Int16% = nDefaultValue_sal_Int16% + 1 - if ( nDefaultValue_sal_uInt16% = 1 ) then - nNewValue_sal_uInt16% = 2 - else - nNewValue_sal_uInt16% = 1 - end if - nNewValue_sal_Int32& = nDefaultValue_sal_Int32& + 1 - - aNewValue_DateTime = aDefaultValue_DateTime - aNewValue_DateTime.HundredthSeconds = aDefaultValue_DateTime.HundredthSeconds + 1 - aNewValue_DateTime.Seconds = aDefaultValue_DateTime.Seconds + 1 - aNewValue_DateTime.Minutes = aDefaultValue_DateTime.Minutes + 1 - aNewValue_DateTime.Hours = aDefaultValue_DateTime.Hours + 1 - aNewValue_DateTime.Day = aDefaultValue_DateTime.Day + 1 - aNewValue_DateTime.Month = aDefaultValue_DateTime.Month + 1 - aNewValue_DateTime.Year = aDefaultValue_DateTime.Year + 1 - - aNewValue_ByteSequence = aDefaultValue_ByteSequence - nElementCount% = UBound ( aDefaultValue_ByteSequence ) -' for nCounter%=0 to nElementCount% step 1 -' aNewValue_ByteSequence(nCounter%) = ( aDefaultValue_ByteSequence(nCounter%) + 1 ) -' next nCounter% - - ' Anschliessend muessen diese neuen Werte gesetzt werden. - aDocumentProperties.setPropertyValue ( "Author" , sNewValue_OWString$ ) - aDocumentProperties.setPropertyValue ( "AutoloadEnabled", bNewValue_sal_Bool ) - aDocumentProperties.setPropertyValue ( "EditingCycles" , nNewValue_sal_Int16% ) - aDocumentProperties.setPropertyValue ( "Priority" , nNewValue_sal_uInt16% ) - aDocumentProperties.setPropertyValue ( "EditingDuration", nNewValue_sal_Int32& ) - aDocumentProperties.setPropertyValue ( "ModifyDate" , aNewValue_DateTime ) -' aDocumentProperties.setPropertyValue ( "ExtraData" , aNewValue_ByteSequence ) - aDocumentProperties.ExtraData = aNewValue_ByteSequence - - ' Dann lassen wir sie uns ausgeben, um sie mit den vorherigen vergleichen zu koennen. - ' (Das geht natuerlich nur, wenn "bLOGOn=cOn" ist - also eine LOG-Datei geschrieben wird!) - ShowProperties ( aDocumentProperties ) - - ' Nun werden die Properties wieder gelesen ... - sLastValue_OWString$ = aDocumentProperties.getPropertyValue ( "Author" ) - bLastValue_sal_Bool = aDocumentProperties.getPropertyValue ( "AutoloadEnabled" ) - nLastValue_sal_Int16% = aDocumentProperties.getPropertyValue ( "EditingCycles" ) - nLastValue_sal_uInt16% = aDocumentProperties.getPropertyValue ( "Priority" ) - nLastValue_sal_Int32& = aDocumentProperties.getPropertyValue ( "EditingDuration" ) - aLastValue_DateTime = aDocumentProperties.getPropertyValue ( "ModifyDate" ) - aLastValue_ByteSequence = aDocumentProperties.getPropertyValue ( "ExtraData" ) - - ' ... und mit den vorher als zu setzend bestimmte Werte vergleichen! - ' Es duerfen KEINE Unterschiede auftreten, da sonst "setPropertyValue()" nicht korrekt funktioniert hat! - - if ( CompareOWString ( sNewValue_OWString$, sLastValue_OWString$ ) = cDifferent ) then - ErrorMessage ( "setPropertyValue() ... Fehler [OWString fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - elseif ( CompareBool ( bNewValue_sal_Bool, bLastValue_sal_Bool ) = cDifferent ) then - ErrorMessage ( "setPropertyValue() ... Fehler [sal_Bool fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - elseif ( CompareInt16 ( nNewValue_sal_Int16%, nLastValue_sal_Int16% ) = cDifferent ) then - ErrorMessage ( "setPropertyValue() ... Fehler [sal_Int16 fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - elseif ( CompareInt16 ( nNewValue_sal_uInt16%, nLastValue_sal_uInt16% ) = cDifferent ) then - ErrorMessage ( "setPropertyValue() ... Fehler [sal_uInt16 fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - elseif ( CompareInt32 ( nNewValue_sal_Int32&, nLastValue_sal_Int32& ) = cDifferent ) then - ErrorMessage ( "setPropertyValue() ... Fehler [sal_Int32 fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - elseif ( CompareDateTime ( aNewValue_DateTime, aLastValue_DateTime ) = cDifferent ) then - ErrorMessage ( "setPropertyValue() ... Fehler [DateTime fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - elseif ( CompareByteSequence ( aNewValue_ByteSequence, aLastValue_ByteSequence ) = cDifferent ) then - ErrorMessage ( "setPropertyValue() ... Fehler [ByteSequence fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - end if - - InfoMessage ( "setPropertyValue() ... OK" ) - - ' Nun wird noch mit den zuerst ermittelten Default-Werten verglichen! - ' Hier MUESSEN Unterschiede auftreten, da sonst "get-" UND "setPropertyValue()" nicht korrekt funktioniert haben! - - if ( CompareOWString ( sDefaultValue_OWString$, sLastValue_OWString$ ) = cEqual ) then - ErrorMessage ( "Zusammenspiel set & getPropertyValue() ... Fehler [OWString fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - elseif ( CompareBool ( bDefaultValue_sal_Bool, bLastValue_sal_Bool ) = cEqual ) then - ErrorMessage ( "Zusammenspiel set & getPropertyValue() ... Fehler [sal_Bool fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - elseif ( CompareInt16 ( nDefaultValue_sal_Int16%, nLastValue_sal_Int16% ) = cEqual ) then - ErrorMessage ( "Zusammenspiel set & getPropertyValue() ... Fehler [sal_Int16 fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - elseif ( CompareInt16 ( nDefaultValue_sal_uInt16%, nLastValue_sal_uInt16% ) = cEqual ) then - ErrorMessage ( "Zusammenspiel set & getPropertyValue() ... Fehler [sal_uInt16 fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - elseif ( CompareInt32 ( nDefaultValue_sal_Int32&, nLastValue_sal_Int32& ) = cEqual ) then - ErrorMessage ( "Zusammenspiel set & getPropertyValue() ... Fehler [sal_Int32 fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error - elseif ( CompareDateTime ( aDefaultValue_DateTime, aLastValue_DateTime ) = cEqual ) then - ErrorMessage ( "Zusammenspiel set & getPropertyValue() ... Fehler [DateTime fehlerhaft]" ) - goto Test_NormalUse_XPropertySet_Error -' elseif ( CompareByteSequence ( aDefaultValue_ByteSequence, aLastValue_ByteSequence ) = cEqual ) then -' ErrorMessage ( "Zusammenspiel set & getPropertyValue() ... Fehler [ByteSequence fehlerhaft]" ) -' goto Test_NormalUse_XPropertySet_Error - end if - - InfoMessage ( "Zusammenspiel set & getPropertyValue() ... OK" ) - - ' Der Test war erfolgreich! Meldung ausgeben und zurueck zm Aufrufer. - ' Ausschalten der Fehlerbehandlung - on Error goto 0 - ' Meldung ausgeben - InfoMessage ( "Test_NormalUse_XPropertySet ... [ende]" ) - ' Status setzen - Test_NormalUse_XPropertySet = cOK - ' Und Funktion beenden - Exit Function - -' Es ist ein unerwartete Fehler aufgetreten! (Exception ...) -' Meldung ausgeben und mit Fehler zurueckkehren. -Test_NormalUse_XPropertySet_Error: - ' Ausschalten der Fehlerbehandlung - on Error goto 0 - ' Meldung ausgeben - ErrorMessage ( "Test_NormalUse_XPropertySet ... [Error]" ) - ' und Fehlerstatus setzen - Test_NormalUse_XPropertySet = cError - ' Abbruch der Funktion erzwingen! - Exit Function - -End Function - -'---------------------------------------------------------------------------- -' Testmethode: Testen des unterstuetzten Interfaces "XNameContainer" unter normalen Bedingungen -' -' Returnwert = cOK ; wenn sich das Objekt korrekt verhalten hat -' Returnwert = cError ; wenn das Objekt noch nicht robust genug ist -'---------------------------------------------------------------------------- -Function Test_NormalUse_XNameContainer ( aDocumentProperties ) as Boolean - - ' Einschalten der Fehlerbehandlung, um Exceptions oder aehnliches abzufangen! - on Error goto Test_NormalUse_XNameContainer_Error - - InfoMessage ( "Test_NormalUse_XNameContainer ... [start]" ) - - ' Da das Initialisieren im Konstruktor des Objektes und das Aufraeumen im Destruktor - ' automatisch geschieht und diese Methode pro Programmablauf nur einmal verwendet wird, - ' darf sich kein Element schon im NameContainer befinden! - ' Wenn doch, ist das ein Fehler! - if ( aDocumentProperties.hasElements () = TRUE ) then - ErrorMessage ( "Der NameConatiner sollte eigentlich leer sein, enthaelt initial aber schon Elemente!?" ) - goto Test_NormalUse_XNameContainer_Error - end if - - ' Zunaechst werden mehrere Elemente in den NameContainer eingefuegt. - sItemName_1$ = "Item 1" - sItemName_2$ = "Item 2" - sItemName_3$ = "Item 3" - sItemName_4$ = "Item 4" - sItemName_5$ = "Item 5" - - sFirstValue_1$ = "Value 1" - sFirstValue_2$ = "Value 2" - sFirstValue_3$ = "Value 3" - sFirstValue_4$ = "Value 4" - sFirstValue_5$ = "Value 5" - - aDocumentProperties.insertByName ( sItemName_1$, sFirstValue_1$ ) - aDocumentProperties.insertByName ( sItemName_2$, sFirstValue_2$ ) - aDocumentProperties.insertByName ( sItemName_3$, sFirstValue_3$ ) - aDocumentProperties.insertByName ( sItemName_4$, sFirstValue_4$ ) - aDocumentProperties.insertByName ( sItemName_5$, sFirstValue_5$ ) - - ' Zur Kontrolle die Werte ausgeben. (Nur wichtig, wenn geloggt wird!) - ' Dabei wird die Methode "getElementNames()" gleich implizit mitgetestet! - ShowNameContainer ( aDocumentProperties ) - - ' Aber auch die Anzahl kontrollieren. - ' (Hier wird eine eigene BASIC-Hilfsfunktion verwendet! keine Interface-Methode) - if ( getNameContainerCount ( aDocumentProperties ) <> 5 ) then - ErrorMessage ( "insertByName() ... Fehler (Der NameConatiner enthaelt nicht die eingefuegten 5 Elemente!)" ) - goto Test_NormalUse_XNameContainer_Error - end if - - ' Nun noch feststellen, ob die 5 denn auch tatsaechlich vorhanden sind. - if ( aDocumentProperties.hasByName ( sItemName_1$ ) = FALSE ) then - ErrorMessage ( "hasByName() ... Fehler [Element 1 nicht vorhanden!?]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( aDocumentProperties.hasByName ( sItemName_2$ ) = FALSE ) then - ErrorMessage ( "hasByName() ... Fehler [Element 2 nicht vorhanden!?]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( aDocumentProperties.hasByName ( sItemName_3$ ) = FALSE ) then - ErrorMessage ( "hasByName() ... Fehler [Element 3 nicht vorhanden!?]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( aDocumentProperties.hasByName ( sItemName_4$ ) = FALSE ) then - ErrorMessage ( "hasByName() ... Fehler [Element 4 nicht vorhanden!?]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( aDocumentProperties.hasByName ( sItemName_5$ ) = FALSE ) then - ErrorMessage ( "hasByName() ... Fehler [Element 5 nicht vorhanden!?]" ) - goto Test_NormalUse_XNameContainer_Error - end if - - ' Dann die Werte wieder auslesen. - sCompareValue_1$ = aDocumentProperties.getByName ( sItemName_1$ ) - sCompareValue_2$ = aDocumentProperties.getByName ( sItemName_2$ ) - sCompareValue_3$ = aDocumentProperties.getByName ( sItemName_3$ ) - sCompareValue_4$ = aDocumentProperties.getByName ( sItemName_4$ ) - sCompareValue_5$ = aDocumentProperties.getByName ( sItemName_5$ ) - - ' Zum Vergleich die Werte ausgeben. (Nur wichtig, wenn geloggt wird!) - ShowNameContainer ( aDocumentProperties ) - - ' Dann die Werte automatisch vergleichen! - if ( CompareOWString ( sFirstValue_1$, sCompareValue_1$ ) = cDifferent ) then - ErrorMessage ( "getByName() ... Fehler [Element 1 fehlerhaft]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( CompareOWString ( sFirstValue_2$, sCompareValue_2$ ) = cDifferent ) then - ErrorMessage ( "getByName() ... Fehler [Element 2 fehlerhaft]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( CompareOWString ( sFirstValue_3$, sCompareValue_3$ ) = cDifferent ) then - ErrorMessage ( "getByName() ... Fehler [Element 3 fehlerhaft]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( CompareOWString ( sFirstValue_4$, sCompareValue_4$ ) = cDifferent ) then - ErrorMessage ( "getByName() ... Fehler [Element 4 fehlerhaft]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( CompareOWString ( sFirstValue_5$, sCompareValue_5$ ) = cDifferent ) then - ErrorMessage ( "getByName() ... Fehler [Element 5 fehlerhaft]" ) - goto Test_NormalUse_XNameContainer_Error - end if - - InfoMessage ( "getByName() ... OK" ) - - ' Jetzt wird versucht einige der Elemente in ihrem Wert zu veraendern. - sNewValue_1$ = "NewValue 1" - sNewValue_2$ = "NewValue 2" - sNewValue_3$ = "NewValue 3" - sNewValue_4$ = "NewValue 4" - sNewValue_5$ = "NewValue 5" - - aDocumentProperties.replaceByName ( sItemName_1$, sNewValue_1$ ) - aDocumentProperties.replaceByName ( sItemName_2$, sNewValue_2$ ) - aDocumentProperties.replaceByName ( sItemName_3$, sNewValue_3$ ) - aDocumentProperties.replaceByName ( sItemName_4$, sNewValue_4$ ) - aDocumentProperties.replaceByName ( sItemName_5$, sNewValue_5$ ) - - ' Zur Kontrolle die Werte ausgeben. (Nur wichtig, wenn geloggt wird!) - ShowNameContainer ( aDocumentProperties ) - - ' Dann die Werte wieder auslesen. - sCompareValue_1$ = aDocumentProperties.getByName ( sItemName_1$ ) - sCompareValue_2$ = aDocumentProperties.getByName ( sItemName_2$ ) - sCompareValue_3$ = aDocumentProperties.getByName ( sItemName_3$ ) - sCompareValue_4$ = aDocumentProperties.getByName ( sItemName_4$ ) - sCompareValue_5$ = aDocumentProperties.getByName ( sItemName_5$ ) - - ' Zum Vergleich die Werte ausgeben. (Nur wichtig, wenn geloggt wird!) - ShowNameContainer ( aDocumentProperties ) - - ' Dann die Werte automatisch vergleichen! - if ( CompareOWString ( sNewValue_1$, sCompareValue_1$ ) = cDifferent ) then - ErrorMessage ( "replaceByName() ... Fehler [Element 1 fehlerhaft]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( CompareOWString ( sNewValue_2$, sCompareValue_2$ ) = cDifferent ) then - ErrorMessage ( "replaceByName() ... Fehler [Element 2 fehlerhaft]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( CompareOWString ( sNewValue_3$, sCompareValue_3$ ) = cDifferent ) then - ErrorMessage ( "replaceByName() ... Fehler [Element 3 fehlerhaft]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( CompareOWString ( sNewValue_4$, sCompareValue_4$ ) = cDifferent ) then - ErrorMessage ( "replaceByName() ... Fehler [Element 4 fehlerhaft]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( CompareOWString ( sNewValue_5$, sCompareValue_5$ ) = cDifferent ) then - ErrorMessage ( "replaceByName() ... Fehler [Element 5 fehlerhaft]" ) - goto Test_NormalUse_XNameContainer_Error - end if - - InfoMessage ( "replaceByName() ... OK" ) - - ' Hier sollen einige der 5 Eintraege geloescht werden. - aDocumentProperties.removeByName ( sItemName_1$ ) - aDocumentProperties.removeByName ( sItemName_3$ ) - - ' Dann wieder die Anzahl kontrollieren. - ' (Hier wird eine eigene BASIC-Hilfsfunktion verwendet! keine Interface-Methode) - if ( getNameContainerCount ( aDocumentProperties ) <> 3 ) then - ErrorMessage ( "removeByName() ... Fehler (Der NameConatiner enthaelt nicht die erwarteten 3 Elemente!)" ) - goto Test_NormalUse_XNameContainer_Error - end if - - ' Nun noch feststellen, ob die restlichen 3 denn auch tatsaechlich die richtigen sind. - if ( aDocumentProperties.hasByName ( sItemName_2$ ) = FALSE ) then - ErrorMessage ( "removeByName() ... Fehler [Element 2 nicht vorhanden!?]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( aDocumentProperties.hasByName ( sItemName_4$ ) = FALSE ) then - ErrorMessage ( "removeByName() ... Fehler [Element 4 nicht vorhanden!?]" ) - goto Test_NormalUse_XNameContainer_Error - elseif ( aDocumentProperties.hasByName ( sItemName_5$ ) = FALSE ) then - ErrorMessage ( "removeByName() ... Fehler [Element 5 nicht vorhanden!?]" ) - goto Test_NormalUse_XNameContainer_Error - end if - - ' Zur Kontrolle die Werte nochmals ausgeben. (Nur wichtig, wenn geloggt wird!) - ShowNameContainer ( aDocumentProperties ) - - InfoMessage ( "removeByName() ... OK" ) - - ' Der Test war erfolgreich! Meldung ausgeben und zurueck zm Aufrufer. - ' Ausschalten der Fehlerbehandlung - on Error goto 0 - ' Meldung ausgeben - InfoMessage ( "Test_NormalUse_XNameContainer ... [ende]" ) - ' Status setzen - Test_NormalUse_XNameContainer = cOK - ' Und Funktion beenden - Exit Function - -' Es ist ein unerwartete Fehler aufgetreten! (Exception ...) -' Meldung ausgeben und mit Fehler zurueckkehren. -Test_NormalUse_XNameContainer_Error: - ' Ausschalten der Fehlerbehandlung - on Error goto 0 - ' Meldung ausgeben - ErrorMessage ( "Test_NormalUse_XNameContainer ... [Error]" ) - ' und Fehlerstatus setzen - Test_NormalUse_XNameContainer = cError - ' Abbruch der Funktion erzwingen! - Exit Function - -End Function - -'---------------------------------------------------------------------------- -' Testmethode: Testen des unterstuetzten Interfaces "XPersist" unter normalen Bedingungen -' -' Returnwert = cOK ; wenn der Test erfolgreich war -' Returnwert = cError ; wenn sich das Objekt nicht korrekt verhalten hat -'---------------------------------------------------------------------------- -Function Test_NormalUse_XPersist ( aDocumentProperties ) as Boolean - - ' Einschalten der Fehlerbehandlung, um Exceptions oder aehnliches abzufangen! - on Error goto Test_NormalUse_XPersist_Error - - InfoMessage ( "Test_NormalUse_XPersist ... [start]" ) - - ' Laden der Properties aus einer Datei - aDocumentProperties.read ( cTestPath + "TestDebug_in.sdw" ) - - ' Zur Kontrolle anzeigen - ShowProperties ( aDocumentProperties ) - - ' Speichern der Properties in einer neuen Datei - aDocumentProperties.write ( cTestPath + "TestDebug_Out.sdw" ) - aDocumentProperties.read ( cTestPath + "TestDebug_Out.sdw" ) - - ' Zur Kontrolle anzeigen - ShowProperties ( aDocumentProperties ) - - ' Der Test war erfolgreich! Meldung ausgeben und zurueck zm Aufrufer. - ' Ausschalten der Fehlerbehandlung - on Error goto 0 - ' Meldung ausgeben - InfoMessage ( "Test_NormalUse_XPersist ... [ende]" ) - ' Status setzen - Test_NormalUse_XPersist = cOK - ' Und Funktion beenden - Exit Function - -' Es ist ein unerwartete Fehler aufgetreten! (Exception ...) -' Meldung ausgeben und mit Fehler zurueckkehren. -Test_NormalUse_XPersist_Error: - ' Ausschalten der Fehlerbehandlung - on Error goto 0 - ' Meldung ausgeben - ErrorMessage ( "Test_NormalUse_XPersist ... [Error]" ) - ' und Fehlerstatus setzen - Test_NormalUse_XPersist = cError - ' Abbruch der Funktion erzwingen! - Exit Function - -End Function - -'***************************************************************************************************************** -' Hilfsfunktionen und -methoden -'***************************************************************************************************************** - -'---------------------------------------------------------------------------- -' Hilfsmethode: Oeffnet die LOG-Datei. -'---------------------------------------------------------------------------- -Sub OpenLOG ( sFileName$ ) - if ( bLOGOn = cOn ) then - sLOGFileName$ = sFileName$ - nLOGFileHandle% = FreeFile - open sLOGFileName$ for output as nLOGFileHandle% - end if -End Sub - -'---------------------------------------------------------------------------- -' Hilfsmethode: Schliesst die LOG-Datei. -'---------------------------------------------------------------------------- -Sub CloseLOG - if ( bLOGOn = cOn ) then - close #nLOGFileHandle% - end if -End Sub - -'---------------------------------------------------------------------------- -' Hilfsmethode: Gibt einen Text in einer LOG-Datei aus. -'---------------------------------------------------------------------------- -Sub WriteLOG ( sMessage$ ) - if ( bLOGOn = cOn ) then - Write #nLOGFileHandle% sMessage$ - end if -End Sub - -'---------------------------------------------------------------------------- -' Hilfsmethode: Gibt eine MessageBox mit Fehlertext, Zeilennummer und Warnschild aus. -'---------------------------------------------------------------------------- -Sub ErrorMessage ( sMessage$ ) - ' Entweder in die LOG-Datei schreiben oder eine MessageBox anzeigen. - if ( bLOGOn = cOn ) then - WriteLOG ( sMessage$ ) - else - MsgBox ( sMessage$, 16 ) - end if -End Sub - -'---------------------------------------------------------------------------- -' Hilfsmethode: Gibt eine Hinweisbox aus. -'---------------------------------------------------------------------------- -Sub InfoMessage ( sMessage$ ) - ' Nur was anzeigen, wenn Nutzer es wuenscht! - if ( bShowErrorsOnly = cOff ) then - ' Ansonsten wird entweder in die LOG-Datei geschrieben oder eine MessageBox angezeigt. - if ( bLOGOn = cOn ) then - WriteLOG ( sMessage$ ) - else - MsgBox ( sMessage$, 64 ) - end if - end if -End Sub - -'---------------------------------------------------------------------------- -' Hilfsfunktion: Vergleicht zwei OWString-Werte -' -' Returnwert = cEqual ; wenn Werte identisch sind -' Returnwert = cDifferent ; wenn Werte verschieden sind -'---------------------------------------------------------------------------- -Function CompareOWString ( sOWString_1$, sOWString_2$ ) as Boolean - - if ( sOWString_1$ = sOWString_2$ ) then - CompareOWString = cEqual - else - CompareOWString = cDifferent - end if - -End Function - -'---------------------------------------------------------------------------- -' Hilfsfunktion: Vergleicht zwei DateTime-Strukturen -' -' Returnwert = cEqual ; wenn Werte identisch sind -' Returnwert = cDifferent ; wenn Werte verschieden sind -'---------------------------------------------------------------------------- -Function CompareDateTime ( aDateTime_1, aDateTime_2 ) as Boolean - - if ( aDateTime_1.Day = aDateTime_2.Day and aDateTime_1.Month = aDateTime_2.Month and aDateTime_1.Year = aDateTime_2.Year and aDateTime_1.Hours = aDateTime_1.Hours and aDateTime_1.Minutes = aDateTime_1.Minutes and aDateTime_1.Seconds = aDateTime_1.Seconds and aDateTime_1.HundredthSeconds = aDateTime_1.HundredthSeconds ) then - CompareDateTime = cEqual - else - CompareDateTime = cDifferent - end if - -End Function - -'---------------------------------------------------------------------------- -' Hilfsfunktion: Vergleicht zwei ByteSequence's -' -' Returnwert = cEqual ; wenn Werte identisch sind -' Returnwert = cDifferent ; wenn Werte verschieden sind -'---------------------------------------------------------------------------- -Function CompareByteSequence ( seqByteSequence_1, seqByteSequence_2 ) as Boolean - - ' Wenn beide leer sind, sind sie auch identisch ! - ' Dieser Test mit "IsArray" ist noetig, da bei einem leeren Array die - ' Funktion "UBound" einen Fehler produziert! - if ( IsArray ( seqByteSequence_1 ) = FALSE and IsArray ( seqByteSequence_2 ) = FALSE ) then - CompareByteSequence = cEqual - Exit Function - end if - - ' Wenn jedoch nur eine leer ist, dann sind sie nicht identisch. - if ( IsArray ( seqByteSequence_1 ) = FALSE ) or ( IsArray ( seqByteSequence_2 ) = FALSE ) then - CompareByteSequence = cDifferent - Exit Function - end if - - ' Besorgen der Anzahl der Elemente der Sequences - nElementCount_1% = UBound ( seqByteSequence_1 ) - nElementCount_2% = UBound ( seqByteSequence_2 ) - - ' Wenn diese Anzahl schon verschieden ist, dann ... - if ( nElementCount_1% <> nElementCount_2% ) then - ' ... sind die Sequences wohl verschieden. - CompareByteSequence = cDifferent - ' Die Element brauchen dann nicht mehr verglichen zu werden. - Exit Function - end if - - ' Ansonsten werden die Elemente einzeln miteinander verglichen. - for nCounter%=0 to nElementCount_1% step 1 - ' Wenn auch nur ein paar davon verschieden ist, dann ... - if ( nElementCount_1%(nCounter%) <> nElementCount_2%(nCounter%) ) then - ' ... kann der Vergleich abgebrochen werden! - CompareByteSequence = cDifferent - Exit Function - end if - next nCounter% - - ' Wenn man bis hier gekommen ist, dann sind die Sequences identisch. - CompareByteSequence = cEqual - -End Function - -'---------------------------------------------------------------------------- -' Hilfsfunktion: Vergleicht zwei Int16-Werte -' -' Returnwert = cEqual ; wenn Werte identisch sind -' Returnwert = cDifferent ; wenn Werte verschieden sind -'---------------------------------------------------------------------------- -Function CompareInt16 ( nInt16_1%, nInt16_2% ) as Boolean - - if ( nInt16_1% = nInt16_2% ) then - CompareInt16 = cEqual - else - CompareInt16 = cDifferent - end if - -End Function - -'---------------------------------------------------------------------------- -' Hilfsfunktion: Vergleicht zwei Int32-Werte -' -' Returnwert = cEqual ; wenn Werte identisch sind -' Returnwert = cDifferent ; wenn Werte verschieden sind -'---------------------------------------------------------------------------- -Function CompareInt32 ( nInt32_1&, nInt32_2& ) as Boolean - - if ( nInt32_1& = nInt32_2& ) then - CompareInt32 = cEqual - else - CompareInt32 = cDifferent - end if - -End Function - -'---------------------------------------------------------------------------- -' Hilfsfunktion: Vergleicht zwei Bool-Werte -' -' Returnwert = cEqual ; wenn Werte identisch sind -' Returnwert = cDifferent ; wenn Werte verschieden sind -'---------------------------------------------------------------------------- -Function CompareBool ( bBool_1, bBool_2 ) as Boolean - - if ( bBool_1 = bBool_2 ) then - CompareBool = cEqual - else - CompareBool = cDifferent - end if - -End Function - -'---------------------------------------------------------------------------- -' Hilfsfunktion: Vergleicht die Properties zweier Objekte um Unterschiede festzustellen. -' -' Returnwert = cEqual ; wenn Objekte von den Properties her identisch sind -' Returnwert = cDifferent ; wenn Objekte von den Properties her verschieden sind -'---------------------------------------------------------------------------- -Function CompareDocumentProperties ( aDocumentProperties_1, aDocumentProperties_2 ) as Boolean - - ' Besorgen der Werte und zwischenspeichern (bezogen auf Objekt 1) - sAuthor_1$ = aDocumentProperties_1.getPropertyValue ( "Author" ) - bAutoloadEnabled_1 = aDocumentProperties_1.getPropertyValue ( "AutoloadEnabled" ) - nAutoloadSecs_1% = aDocumentProperties_1.getPropertyValue ( "AutoloadSecs" ) - sAutoLoadURL_1$ = aDocumentProperties_1.getPropertyValue ( "AutoloadURL" ) - sBliendCopiesTo_1$ = aDocumentProperties_1.getPropertyValue ( "BlindCopiesTo" ) - sCopiesTo_1$ = aDocumentProperties_1.getPropertyValue ( "CopiesTo" ) - aCreationDate_1 = aDocumentProperties_1.getPropertyValue ( "CreationDate" ) - sDefaultTarget_1$ = aDocumentProperties_1.getPropertyValue ( "DefaultTarget" ) - sDescription_1$ = aDocumentProperties_1.getPropertyValue ( "Description" ) - nEditingCycles_1% = aDocumentProperties_1.getPropertyValue ( "EditingCycles" ) - nEditingDuration_1& = aDocumentProperties_1.getPropertyValue ( "EditingDuration" ) - seqExtraData_1 = aDocumentProperties_1.getPropertyValue ( "ExtraData" ) - sInReplyTo_1$ = aDocumentProperties_1.getPropertyValue ( "InReplyTo" ) - bIsEncrypted_1 = aDocumentProperties_1.getPropertyValue ( "IsEncrypted" ) - sKeywords_1$ = aDocumentProperties_1.getPropertyValue ( "Keywords" ) - sMIMEType_1$ = aDocumentProperties_1.getPropertyValue ( "MIMEType" ) - sModifiedBy_1$ = aDocumentProperties_1.getPropertyValue ( "ModifiedBy" ) - aModifyDate_1 = aDocumentProperties_1.getPropertyValue ( "ModifyDate" ) - sNewsgroups_1$ = aDocumentProperties_1.getPropertyValue ( "Newsgroups" ) - sOriginal_1$ = aDocumentProperties_1.getPropertyValue ( "Original" ) - bPortableGraphics_1 = aDocumentProperties_1.getPropertyValue ( "PortableGraphics" ) - aPrintDate_1 = aDocumentProperties_1.getPropertyValue ( "PrintDate" ) - sPrintedBy_1$ = aDocumentProperties_1.getPropertyValue ( "PrintedBy" ) - nPriority_1% = aDocumentProperties_1.getPropertyValue ( "Priority" ) - bQueryTemplate_1 = aDocumentProperties_1.getPropertyValue ( "QueryTemplate" ) - sRecipient_1$ = aDocumentProperties_1.getPropertyValue ( "Recipient" ) - sReferences_1$ = aDocumentProperties_1.getPropertyValue ( "References" ) - sReplyTo_1$ = aDocumentProperties_1.getPropertyValue ( "ReplyTo" ) - bSaveGraphicsCompressed_1 = aDocumentProperties_1.getPropertyValue ( "SaveGraphicsCompressed" ) - bSaveOriginalGraphics_1 = aDocumentProperties_1.getPropertyValue ( "SaveOriginalGraphics" ) - bSaveVersionOnClose_1 = aDocumentProperties_1.getPropertyValue ( "SaveVersionOnClose" ) - sTemplate_1$ = aDocumentProperties_1.getPropertyValue ( "Template" ) - bTemplateConfig_1 = aDocumentProperties_1.getPropertyValue ( "TemplateConfig" ) - aTemplateDate_1 = aDocumentProperties_1.getPropertyValue ( "TemplateDate" ) - sTemplateFileName_1$ = aDocumentProperties_1.getPropertyValue ( "TemplateFileName" ) - sTheme_1$ = aDocumentProperties_1.getPropertyValue ( "Theme" ) - sTitle_1$ = aDocumentProperties_1.getPropertyValue ( "Title" ) - bUserData_1 = aDocumentProperties_1.getPropertyValue ( "UserData" ) - - ' Besorgen der Werte und zwischenspeichern (bezogen auf Objekt 2) - sAuthor_2$ = aDocumentProperties_2.getPropertyValue ( "Author" ) - bAutoloadEnabled_2 = aDocumentProperties_2.getPropertyValue ( "AutoloadEnabled" ) - nAutoloadSecs_2% = aDocumentProperties_2.getPropertyValue ( "AutoloadSecs" ) - sAutoLoadURL_2$ = aDocumentProperties_2.getPropertyValue ( "AutoloadURL" ) - sBliendCopiesTo_2$ = aDocumentProperties_2.getPropertyValue ( "BlindCopiesTo" ) - sCopiesTo_2$ = aDocumentProperties_2.getPropertyValue ( "CopiesTo" ) - aCreationDate_2 = aDocumentProperties_2.getPropertyValue ( "CreationDate" ) - sDefaultTarget_2$ = aDocumentProperties_2.getPropertyValue ( "DefaultTarget" ) - sDescription_2$ = aDocumentProperties_2.getPropertyValue ( "Description" ) - nEditingCycles_2% = aDocumentProperties_2.getPropertyValue ( "EditingCycles" ) - nEditingDuration_2& = aDocumentProperties_2.getPropertyValue ( "EditingDuration" ) - seqExtraData_2 = aDocumentProperties_2.getPropertyValue ( "ExtraData" ) - sInReplyTo_2$ = aDocumentProperties_2.getPropertyValue ( "InReplyTo" ) - bIsEncrypted_2 = aDocumentProperties_2.getPropertyValue ( "IsEncrypted" ) - sKeywords_2$ = aDocumentProperties_2.getPropertyValue ( "Keywords" ) - sMIMEType_2$ = aDocumentProperties_2.getPropertyValue ( "MIMEType" ) - sModifiedBy_2$ = aDocumentProperties_2.getPropertyValue ( "ModifiedBy" ) - aModifyDate_2 = aDocumentProperties_2.getPropertyValue ( "ModifyDate" ) - sNewsgroups_2$ = aDocumentProperties_2.getPropertyValue ( "Newsgroups" ) - sOriginal_2$ = aDocumentProperties_2.getPropertyValue ( "Original" ) - bPortableGraphics_2 = aDocumentProperties_2.getPropertyValue ( "PortableGraphics" ) - aPrintDate_2 = aDocumentProperties_2.getPropertyValue ( "PrintDate" ) - sPrintedBy_2$ = aDocumentProperties_2.getPropertyValue ( "PrintedBy" ) - nPriority_2% = aDocumentProperties_2.getPropertyValue ( "Priority" ) - bQueryTemplate_2 = aDocumentProperties_2.getPropertyValue ( "QueryTemplate" ) - sRecipient_2$ = aDocumentProperties_2.getPropertyValue ( "Recipient" ) - sReferences_2$ = aDocumentProperties_2.getPropertyValue ( "References" ) - sReplyTo_2$ = aDocumentProperties_2.getPropertyValue ( "ReplyTo" ) - bSaveGraphicsCompressed_2 = aDocumentProperties_2.getPropertyValue ( "SaveGraphicsCompressed" ) - bSaveOriginalGraphics_2 = aDocumentProperties_2.getPropertyValue ( "SaveOriginalGraphics" ) - bSaveVersionOnClose_2 = aDocumentProperties_2.getPropertyValue ( "SaveVersionOnClose" ) - sTemplate_2$ = aDocumentProperties_2.getPropertyValue ( "Template" ) - bTemplateConfig_2 = aDocumentProperties_2.getPropertyValue ( "TemplateConfig" ) - aTemplateDate_2 = aDocumentProperties_2.getPropertyValue ( "TemplateDate" ) - sTemplateFileName_2$ = aDocumentProperties_2.getPropertyValue ( "TemplateFileName" ) - sTheme_2$ = aDocumentProperties_2.getPropertyValue ( "Theme" ) - sTitle_2$ = aDocumentProperties_2.getPropertyValue ( "Title" ) - bUserData_2 = aDocumentProperties_2.getPropertyValue ( "UserData" ) - - ' Als erwarteten Zielwert schon mal "Properties identisch" annehmen!!! - ' Fr den Fall, das nur eine diesen Anspruch nicht erfllt, wird der Wert einfach zurckgesetzt. - ' Von da bleibt der neue Wert bestehen und zeigt an, da sich mindestens eine Property gendert hat! - CompareDocumentProperties = cEqual - - ' Dann die Werte vergleichen - if ( CompareOWString ( sAuthor_1$, sAuthor_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareBool ( bAutoloadEnabled_1, bAutoloadEnabled_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareInt16 ( nAutoloadSecs_1%, nAutoloadSecs_2% ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sAutoLoadURL_1$, sAutoLoadURL_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sBliendCopiesTo_1$, sBliendCopiesTo_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sCopiesTo_1$, sCopiesTo_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareDateTime ( aCreationDate_1, aCreationDate_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sDefaultTarget_1$, sDefaultTarget_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sDescription_1$, sDescription_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareInt16 ( nEditingCycles_1%, nEditingCycles_2% ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareInt32 ( nEditingDuration_1&, nEditingDuration_2& ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareByteSequence( seqExtraData_1, seqExtraData_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sInReplyTo_1$, sInReplyTo_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareBool ( bIsEncrypted_1, bIsEncrypted_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sKeywords_1$, sKeywords_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sMIMEType_1$, sMIMEType_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sModifiedBy_1$, sModifiedBy_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareDateTime ( aModifyDate_1, aModifyDate_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sNewsgroups_1$, sNewsgroups_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sOriginal_1$, sOriginal_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareBool ( bPortableGraphics_1, bPortableGraphics_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareDateTime ( aPrintDate_1, aPrintDate_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sPrintedBy_1$, sPrintedBy_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareInt16 ( nPriority_1%, nPriority_2% ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareBool ( bQueryTemplate_1, bQueryTemplate_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sRecipient_1$, sRecipient_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sReferences_1$, sReferences_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sReplyTo_1$, sReplyTo_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareBool ( bSaveGraphicsCompressed_1, bSaveGraphicsCompressed_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareBool ( bSaveOriginalGraphics_1, bSaveOriginalGraphics_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareBool ( bSaveVersionOnClose_1, bSaveVersionOnClose_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sTemplate_1$, sTemplate_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareBool ( bTemplateConfig_1, bTemplateConfig_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareDateTime ( aTemplateDate_1, aTemplateDate_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sTemplateFileName_1$, sTemplateFileName_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sTheme_1$, sTheme_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareOWString ( sTitle_1$, sTitle_2$ ) = cDifferent ) then - CompareDocumentProperties = cDifferent - elseif ( CompareBool ( bUserData_1, bUserData_2 ) = cDifferent ) then - CompareDocumentProperties = cDifferent - end if - -End Function - -'---------------------------------------------------------------------------- -' Hilfsfunktion: Wandelt eine Struktur des Types DateTime in einen formatierten String um -'---------------------------------------------------------------------------- -Function DateTime2String ( aDateTime ) as String - - stempString$ = "" - stempString$ = stempString$ + aDateTime.Day + "." - stempString$ = stempString$ + aDateTime.Month + "." - stempString$ = stempString$ + aDateTime.Year + " - " - stempString$ = stempString$ + aDateTime.Hours + ":" - stempString$ = stempString$ + aDateTime.Minutes + ":" - stempString$ = stempString$ + aDateTime.Seconds + ":" - stempString$ = stempString$ + aDateTime.HundredthSeconds + " Uhr" - - DateTime2String = stempString$ - -End Function - -'---------------------------------------------------------------------------- -' Hilfsfunktion: Wandelt eine Sequence von Bytes in einen formatierten String um -'---------------------------------------------------------------------------- -Function ByteSequence2String ( seqByteSequence ) as String - - nElementCount% = UBound ( seqByteSequence() ) - - if ( nElementCount% < 1 ) then - stempString$ = "leer" - else - stempString$ = "{" - for nCounter%=0 to nElementCount% step 1 - stempString$ = stempString$ + seqByteSequence(nCounter%) - next nCounter% - stempString$ = stempString$ + "}" - end if - - ByteSequence2String = stempString$ - -End Function - -'---------------------------------------------------------------------------- -' Hilfsmethode: Zeigt die aktuellen Werte ALLER Properties an -'---------------------------------------------------------------------------- -Sub ShowProperties ( aDocumentProperties ) - - ' Besorgen der Werte und zwischenspeichern - sAuthor$ = aDocumentProperties.getPropertyValue ( "Author" ) - bAutoloadEnabled = aDocumentProperties.getPropertyValue ( "AutoloadEnabled" ) - nAutoloadSecs% = aDocumentProperties.getPropertyValue ( "AutoloadSecs" ) - sAutoLoadURL$ = aDocumentProperties.getPropertyValue ( "AutoloadURL" ) - sBliendCopiesTo$ = aDocumentProperties.getPropertyValue ( "BlindCopiesTo" ) - sCopiesTo$ = aDocumentProperties.getPropertyValue ( "CopiesTo" ) - dCreationDate = aDocumentProperties.getPropertyValue ( "CreationDate" ) - sDefaultTarget$ = aDocumentProperties.getPropertyValue ( "DefaultTarget" ) - sDescription$ = aDocumentProperties.getPropertyValue ( "Description" ) - nEditingCycles% = aDocumentProperties.getPropertyValue ( "EditingCycles" ) - nEditingDuration& = aDocumentProperties.getPropertyValue ( "EditingDuration" ) - seqExtraData = aDocumentProperties.getPropertyValue ( "ExtraData" ) - sInReplyTo$ = aDocumentProperties.getPropertyValue ( "InReplyTo" ) - bIsEncrypted = aDocumentProperties.getPropertyValue ( "IsEncrypted" ) - sKeywords$ = aDocumentProperties.getPropertyValue ( "Keywords" ) - sMIMEType$ = aDocumentProperties.getPropertyValue ( "MIMEType" ) - sModifiedBy$ = aDocumentProperties.getPropertyValue ( "ModifiedBy" ) - dModifyDate = aDocumentProperties.getPropertyValue ( "ModifyDate" ) - sNewsgroups$ = aDocumentProperties.getPropertyValue ( "Newsgroups" ) - sOriginal$ = aDocumentProperties.getPropertyValue ( "Original" ) - bPortableGraphics = aDocumentProperties.getPropertyValue ( "PortableGraphics" ) - dPrintDate = aDocumentProperties.getPropertyValue ( "PrintDate" ) - sPrintedBy$ = aDocumentProperties.getPropertyValue ( "PrintedBy" ) - nPriority% = aDocumentProperties.getPropertyValue ( "Priority" ) - bQueryTemplate = aDocumentProperties.getPropertyValue ( "QueryTemplate" ) - sRecipient$ = aDocumentProperties.getPropertyValue ( "Recipient" ) - sReferences$ = aDocumentProperties.getPropertyValue ( "References" ) - sReplyTo$ = aDocumentProperties.getPropertyValue ( "ReplyTo" ) - bSaveGraphicsCompressed = aDocumentProperties.getPropertyValue ( "SaveGraphicsCompressed" ) - bSaveOriginalGraphics = aDocumentProperties.getPropertyValue ( "SaveOriginalGraphics" ) - bSaveVersionOnClose = aDocumentProperties.getPropertyValue ( "SaveVersionOnClose" ) - sTemplate$ = aDocumentProperties.getPropertyValue ( "Template" ) - bTemplateConfig = aDocumentProperties.getPropertyValue ( "TemplateConfig" ) - dTemplateDate = aDocumentProperties.getPropertyValue ( "TemplateDate" ) - sTemplateFileName$ = aDocumentProperties.getPropertyValue ( "TemplateFileName" ) - sTheme$ = aDocumentProperties.getPropertyValue ( "Theme" ) - sTitle$ = aDocumentProperties.getPropertyValue ( "Title" ) - bUserData = aDocumentProperties.getPropertyValue ( "UserData" ) - - ' Eine Zeichenkette zusammenbasteln, welche die Werte formatiert darstellt. - sOutLine$ = "[OWString]" + chr$(9) + "Author" + chr$(9) + "= {" + chr$(9) + sAuthor$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Bool]" + chr$(9) + "AutoloadEnabled" + chr$(9) + "= {" + chr$(9) + bAutoloadEnabled + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Int16]" + chr$(9) + "AutoloadSecs" + chr$(9) + "= {" + chr$(9) + nAutoloadSecs% + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "AutoLoadURL" + chr$(9) + "= {" + chr$(9) + sAutoLoadURL$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "BliendCopiesTo" + chr$(9) + "= {" + chr$(9) + sBliendCopiesTo$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "CopiesTo" + chr$(9) + "= {" + chr$(9) + sCopiesTo$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[DateTime]" + chr$(9) + "CreationDate" + chr$(9) + "= {" + chr$(9) + DateTime2String(dCreationDate) + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "DefaultTarget" + chr$(9) + "= {" + chr$(9) + sDefaultTarget$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "Description" + chr$(9) + "= {" + chr$(9) + sDescription$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Int16]" + chr$(9) + "EditingCycles" + chr$(9) + "= {" + chr$(9) + nEditingCycles% + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Int32]" + chr$(9) + "EditingDuration" + chr$(9) + "= {" + chr$(9) + nEditingDuration& + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[Sequence<Byte>]" + chr$(9) + "ExtraData" + chr$(9) + "= {" + chr$(9) + ByteSequence2String(seqExtraData) + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "InReplyTo" + chr$(9) + "= {" + chr$(9) + sInReplyTo$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Bool]" + chr$(9) + "IsEncrypted" + chr$(9) + "= {" + chr$(9) + bIsEncrypted + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "Keywords" + chr$(9) + "= {" + chr$(9) + sKeywords$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "MIMEType" + chr$(9) + "= {" + chr$(9) + sMIMEType$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "ModifiedBy" + chr$(9) + "= {" + chr$(9) + sModifiedBy$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[DateTime]" + chr$(9) + "ModifyDate" + chr$(9) + "= {" + chr$(9) + DateTime2String(dModifyDate) + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "Newsgroups" + chr$(9) + "= {" + chr$(9) + sNewsgroups$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "Original" + chr$(9) + "= {" + chr$(9) + sOriginal$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Bool]" + chr$(9) + "PortableGraphics" + chr$(9) + "= {" + chr$(9) + bPortableGraphics + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[DateTime]" + chr$(9) + "PrintDate" + chr$(9) + "= {" + chr$(9) + DateTime2String(dPrintDate) + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "PrintedBy" + chr$(9) + "= {" + chr$(9) + sPrintedBy$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Int16]" + chr$(9) + "Priority" + chr$(9) + "= {" + chr$(9) + nPriority% + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Bool]" + chr$(9) + "QueryTemplate" + chr$(9) + "= {" + chr$(9) + bQueryTemplate + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "Recipient" + chr$(9) + "= {" + chr$(9) + sRecipient$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "References" + chr$(9) + "= {" + chr$(9) + sReferences$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "ReplyTo" + chr$(9) + "= {" + chr$(9) + sReplyTo$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Bool]" + chr$(9) + "SaveGraphicsCompressed" + chr$(9) + "= {" + chr$(9) + bSaveGraphicsCompressed + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Bool]" + chr$(9) + "SaveOriginalGraphics" + chr$(9) + "= {" + chr$(9) + bSaveOriginalGraphics + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Bool]" + chr$(9) + "SaveVersionOnClose" + chr$(9) + "= {" + chr$(9) + bSaveVersionOnClose + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "Template" + chr$(9) + "= {" + chr$(9) + sTemplate$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Bool]" + chr$(9) + "TemplateConfig" + chr$(9) + "= {" + chr$(9) + bTemplateConfig + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[DateTime]" + chr$(9) + "TemplateDate" + chr$(9) + "= {" + chr$(9) + DateTime2String(dTemplateDate) + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "TemplateFileName" + chr$(9) + "= {" + chr$(9) + sTemplateFileName$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "Theme" + chr$(9) + "= {" + chr$(9) + sTheme$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[OWString]" + chr$(9) + "Title" + chr$(9) + "= {" + chr$(9) + sTitle$ + "}" + chr$(13) - sOutLine$ = sOutLine$ + "[sal_Bool]" + chr$(9) + "UserData" + chr$(9) + "= {" + chr$(9) + bUserData + "}" - - ' Ausgabe der formatierten Zeichenkette - InfoMessage ( sOutLine$ ) -End Sub - -'---------------------------------------------------------------------------- -' Hilfsmethode: Zeigt die aktuellen Elemente des NameContainers an. -'---------------------------------------------------------------------------- -Sub ShowNameContainer ( aDocumentProperties ) - - if ( aDocumentProperties.hasElements () = FALSE ) then - InfoMessage ( "Keine Elemente im NameContainer enthalten." ) - Exit Sub - end if - - aNameField = aDocumentProperties.getElementNames () - if ( IsArray ( aNameField ) = FALSE ) then - ErrorMessage ( "getElementNames() .... Fehler (Es konnte keine Sequence bestimmt werden!)" ) - Exit Sub - end if - nElementCount% = UBound ( aNameField () ) - - stempString$ = "" - for nCounter%=0 to nElementCount% step 1 - stempString$ = "[" + nCounter% + "]" - stempString$ = stempString$ + chr$(9) + aNameField(nCounter%) - stempString$ = stempString$ + chr$(9) + "=" - stempString$ = stempString$ + chr$(9) + aDocumentProperties.getByName ( aNameField(nCounter%) ) - stempString$ = stempString$ + chr$(13) - next nCounter% - - InfoMessage ( stempString$ ) - -End Sub - -'---------------------------------------------------------------------------- -' Hilfsfunktion: Ermittelt die Anzahl der im NameContainer enthaltenen Elemente. -' -' Returnwert = Anzahl der Elemente -'---------------------------------------------------------------------------- -Function getNameContainerCount ( aDocumentProperties ) as Long - - if ( aDocumentProperties.hasElements () = FALSE ) then - getNameContainerCount = 0 - Exit Function - end if - - aNameField = aDocumentProperties.getElementNames () - nElementCount% = UBound ( aNameField () ) - - ' Da die Zaehlung bei 0 beginnt, und der ermittelte Wert die obere Grenze darstellt, - ' muss hier eine 1 draufgeschlagen werden. - getNameContainerCount = nElementCount% + 1 - -End Function
\ No newline at end of file diff --git a/framework/test/test_filterregistration.bas b/framework/test/test_filterregistration.bas deleted file mode 100644 index 831cbbab8914..000000000000 --- a/framework/test/test_filterregistration.bas +++ /dev/null @@ -1,95 +0,0 @@ -rem _______________________________________________________________________________________________________________________________________ -rem Test script for registering or changing filter of our configuration. -rem _______________________________________________________________________________________________________________________________________ - -Sub Main - Dim xFiterFactory as object - Dim sFilterName as string - - xFilterFactory = createUNOService("com.sun.star.document.FilterFactory") - - sFilterName = "MeinFilter_5" - -rem AddFilter ( xFilterFactory, sFilterName ) - ReadFilter ( xFilterFactory, sFilterName ) -rem QueryFilters ( xFilterFactory ) - - xFilterFactory.flush() - -End Sub - -rem ************************************************************************************************************* -Sub AddFilter( xFilterFactory, sFilterName ) - Dim lProperties(8) as new com.sun.star.beans.PropertyValue - Dim lUserData (1) as string - - lUserData(1) = "Userdata von TestFilter" - - lProperties(0).Name = "Type" - lProperties(0).Value = "bmp_MS_Windows" - - lProperties(1).Name = "UIName" - lProperties(1).Value = sFilterName - - lProperties(2).Name = "DocumentService" - lProperties(2).Value = "com.sun.star.text.TextDocument" - - lProperties(3).Name = "FilterService" - lProperties(3).Value = "com.sun.star.comp.framework.TestFilter" - - lProperties(4).Name = "Flags" - lProperties(4).Value = 256 - - lProperties(5).Name = "UserData" - lProperties(5).Value = lUserData() - - lProperties(6).Name = "FileFormatVersion" - lProperties(6).Value = 0 - - lProperties(7).Name = "TemplateName" - lProperties(7).Value = "" - - xFilterFactory.insertByName( sFilterName, lProperties() ) -End Sub - -rem ************************************************************************************************************* -Sub ReadFilter( xFilterFactory, sFilterName ) -rem Dim lFilters() as com.sun.star.beans.PropertyValue - Dim sOut as string - Dim nCount as integer - - lProperties = xFilterFactory.getByName( sFilterName ) - - sOut = "" - for nCount=0 to ubound(lProperties()) step 1 - sOut = sOut + lProperties(nCount).Name - sOut = sOut + " = " -rem Disable follow if statement to produce bug! -rem if( lProperties(nCount).Name <> "UserData" ) then - sOut = sOut + lProperties(nCount).Value -rem endif - sOut = sOut + chr(13) - next nCount - - msgbox sOut -End Sub - -rem ************************************************************************************************************* -Sub QueryFilters( xFilterFactory ) - Dim lFilters() as string - Dim sQuery as string - Dim sOut as string - Dim nCount as integer - - sQuery = "_filterquery_defaultfilter" -rem sQuery = "_filterquery_textdocument_withdefault" - - lFilters() = xFilterFactory.getByName( sQuery ) - - sOut = "" - for nCount=0 to ubound( lFilters() ) - sOut = sOut + lFilters(nCount) + chr(13) - next nCount - - msgbox sOut -End Sub diff --git a/framework/test/test_statusindicatorfactory.bas b/framework/test/test_statusindicatorfactory.bas deleted file mode 100644 index e82590fb7678..000000000000 --- a/framework/test/test_statusindicatorfactory.bas +++ /dev/null @@ -1,69 +0,0 @@ -Sub Main - - rem Get reference to current active frame. Most time this will be - rem the basic ide by himself. - xTestFrame = StarDesktop.ActiveFrame - - rem Create more then one indicator objects for this frame. - xIndicator1 = xTestFrame.createStatusIndicator() - xIndicator2 = xTestFrame.createStatusIndicator() - xIndicator3 = xTestFrame.createStatusIndicator() - - rem Check status of creation. No null references should be detected. - if( isNull(xIndicator1)=TRUE ) or ( isNull(xIndicator2)=TRUE ) or ( isNull(xIndicator3)=TRUE ) then - msgbox "Error: Could not create status indicators!" - exit Sub - endif - - rem Start working for indicator 1 and 2. - rem The window should NOT be shown! - xIndicator1.start( "Indicator 1:", 100 ) - xIndicator2.start( "Indicator 2:", 200 ) - msgbox "Indicator 1 and 2 was started ... the window should NOT be shown!" - - rem Start working for indicator 3. - rem The window should be shown! It's the most active one. - xIndicator3.start( "Indicator 3:", 300 ) - msgbox "Indicator 3 was started ... the window should be shown!" - - rem Set different values and texts for indicator 1 and 2. - rem These values are not visible. - xIndicator1.setValue( 25 ) - xIndicator2.setValue( 50 ) - - rem Work with indicator 3. - rem If working finished automaticly indicator 2 is reactivated. - i = 0 - while i<300 - xIndicator3.setText( "Indicator 3: Range=300 Value=" + i ) - xIndicator3.setValue( i ) - i = i+10 - wait( 1 ) - wend - - rem Delete indicator 2 before you deactivate number 3! - rem The next automaticly activated indicator will be the number 1. - xIndicator2.end - msgbox "Indicator 3 will be destroyed. Indicator 2 was deleted ... number 1 must reactivated automaticly!" - xIndicator3.end - - rem Work with indicator 1. - rem If working finished automaticly the window will be destroyed. - i = 25 - while i<100 - xIndicator1.setText( "Indicator 1: Range=100 Value=" + i ) - xIndicator1.setValue( i ) - i = i+10 - wait( 1 ) - wend - xIndicator1.setText( "Indicator 1: ... reset values to defaults" ) - wait( 1000 ) - xIndicator1.reset - xIndicator1.setText( "Indicator 1: ... set 50 % for progress" ) - wait( 1000 ) - xIndicator1.setValue( 50 ) - msgbox "Indicator 1 will be destroyed. Indicator window must destroyed automaticly!" - xIndicator1.end - - msgbox "Test for status indicator finished successful!" -End Sub diff --git a/framework/test/threadtest.cxx b/framework/test/threadtest.cxx deleted file mode 100644 index d7f15304d85f..000000000000 --- a/framework/test/threadtest.cxx +++ /dev/null @@ -1,732 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include <macros/generic.hxx> -#include <macros/debug.hxx> -#include <threadhelp/resetableguard.hxx> -#include <threadhelp/transactionguard.hxx> - -#include <threadhelp/rwlockbase.hxx> - -#include <threadhelp/transactionbase.hxx> -#include <threadhelp/readguard.hxx> -#include <threadhelp/writeguard.hxx> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ - -//_________________________________________________________________________________________________________________ -// other includes -//_________________________________________________________________________________________________________________ -#include <rtl/random.h> -#include <osl/process.h> -#include <rtl/ustring.hxx> -#include <rtl/ustrbuf.hxx> -#include <osl/time.h> - -#include <osl/interlock.h> - -#include <vcl/event.hxx> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> -#include <stdio.h> - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define LOGFILE "threadtest.log" -#define STATISTICS_FILE "threadtest_statistic.csv" - -//_________________________________________________________________________________________________________________ -// namespace -//_________________________________________________________________________________________________________________ - -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::framework ; - -//_________________________________________________________________________________________________________________ -// defines -//_________________________________________________________________________________________________________________ - -/*---------------- Use follow defines to enable/disable some special features of this little test program! -------*/ - -#define ENABLE_LOG -//#define ENABLE_THREADDELAY -#define ENABLE_REQUESTCOUNT - -/*----------------------------------------------------------------------------------------------------------------*/ - -#ifdef ENABLE_LOG - #define LOG_SETA_START( NA, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ResetableGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] call setA( " ); \ - sLog.append( NA ); \ - sLog.append( " )\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_SETA_END( NA, EREASON, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ResetableGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - if( EREASON == E_NOREASON ) \ - sLog.append( " ] finish setA( " ); \ - else \ - sLog.append( " ] was refused at setA( "); \ - sLog.append( NA ); \ - sLog.append( " )\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_GETA_START( NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ResetableGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] call getA()\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_GETA_END( NRETURN, EREASON, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ResetableGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - if( EREASON == E_NOREASON ) \ - sLog.append( " ] finish getA() with " ); \ - else \ - sLog.append( " ] was refused at getA() with " ); \ - sLog.append( NRETURN ); \ - sLog.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_WORKA_START( NA, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ResetableGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] call workA( " ); \ - sLog.append( NA ); \ - sLog.append( " )\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_WORKA_END( NRETURN, EREASON, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ResetableGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - if( EREASON == E_NOREASON ) \ - sLog.append( " ] finish workA() with " ); \ - else \ - sLog.append( " ] was refused at workA() with " ); \ - sLog.append( NRETURN ); \ - sLog.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_INITEXCEPTION( SMETHOD, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ResetableGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] get EInitException from \"" ); \ - sLog.append( SMETHOD ); \ - sLog.append( "\"\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_CLOSEEXCEPTION( SMETHOD, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ResetableGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] get ECloseException from \"" ); \ - sLog.append( SMETHOD ); \ - sLog.append( "\"\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_INIT( NA, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ResetableGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] initialize me with " ); \ - sLog.append( NA ); \ - sLog.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_CLOSE( NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ResetableGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] close me\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } -#else - #define LOG_SETA_START( NA, NID ) - #define LOG_SETA_END( NA, EREASON, NID ) - #define LOG_GETA_START( NID ) - #define LOG_GETA_END( NRETURN, EREASON, NID ) - #define LOG_WORKA_START( NA, NID ) - #define LOG_WORKA_END( NRETURN, EREASON, NID ) - #define LOG_INITEXCEPTION( SMETHOD, NID ) - #define LOG_CLOSEEXCEPTION( SMETHOD, NID ) - #define LOG_INIT( NA, NID ) - #define LOG_CLOSE( NID ) -#endif - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -sal_uInt16 getRandomValue() -{ - // Get new random value for thread-sleep! - // See run() for further informations. - // Always calculate a new random number. - sal_uInt16 nValue; - rtlRandomPool aPool = rtl_random_createPool(); - rtl_random_getBytes ( aPool, &nValue, 2 ); - rtl_random_destroyPool ( aPool ); - return nValue; -} - -/*-************************************************************************************************************//** - @descr This class is used from different threads at the same time. - We start working after calling init() first(!) ... - and finish it by calling close(). It exist two methods for reading/writing an - internal variable "A". Another function workA() do both things at the same time. - All public methods log information in a file if DO_LOG is defined. - - @attention Our public base class FaiRWLockBase is a struct with a RWLock as member. - This member can be used by guards to safe access at internal variables - in interface methods. - Another baseclass is the TransactionBase. They support rejection of wrong calls at wrong time. - e.g. calls after closing object! -*//*-*************************************************************************************************************/ - -class ThreadSafeClass : private TransactionBase - , private FairRWLockBase -{ - public: - - ThreadSafeClass (); - ~ThreadSafeClass(); - - // This methods are used from differnt threads - // to test this class. - void init ( sal_Int32 nA , - sal_Int32 nThreadID ); - void close ( sal_Int32 nThreadID ); - void setA ( sal_Int32 nA , - sal_Int32 nThreadID ); - sal_Int32 getA ( sal_Int32 nThreadID ); - sal_Int32 workA ( sal_Int32 nA , - sal_Int32 nThreadID ); - - #ifdef ENABLE_REQUESTCOUNT - // This methods are used for statistics only! - sal_Int32 getReadCount () { return m_nReadCount; } - sal_Int32 getWriteCount() { return m_nWriteCount; } - #endif - - private: - - sal_Int32 m_nA ; /// test member fro reading/writing - - #ifdef ENABLE_LOG - ::osl::Mutex m_aLogMutex ; /// mutex to serialize writing log file! - #endif - - #ifdef ENABLE_REQUESTCOUNT - oslInterlockedCount m_nReadCount ; /// statistic variables to count read/write requests - oslInterlockedCount m_nWriteCount ; - #endif -}; - -//_________________________________________________________________________________________________________________ -ThreadSafeClass::ThreadSafeClass() - : TransactionBase ( ) - , FairRWLockBase ( ) - , m_nA ( 0 ) - #ifdef ENABLE_REQUESTCOUNT - , m_nReadCount ( 0 ) - , m_nWriteCount ( 0 ) - #endif -{ -} - -//_________________________________________________________________________________________________________________ -ThreadSafeClass::~ThreadSafeClass() -{ -} - -//_________________________________________________________________________________________________________________ -void ThreadSafeClass::init( sal_Int32 nA, sal_Int32 nThreadID ) -{ - // Set write lock for setting internal member AND - // protect changing of working mode! - WriteGuard aWriteLock( m_aLock ); - - LOG_INIT( nA, nThreadID ) - - // Look for multiple calls of this method first! - // Use E_SOFTEXCEPTIONS to disable automaticly throwing of exceptions for some working modes. - ERejectReason eReason; - TransactionGuard aTransaction( m_aTransactionManager, E_NOEXCEPTIONS, eReason ); - if( eReason == E_UNINITIALIZED ) - { - // OK, it must be the first call and we are synchronized with all other threads by using the write lock! - // Otherwise (e.g. if working mode == E_WORK) we get a exception and follow lines are never called. - - // We can set our member and change the working mode now. - m_nA = nA; - m_aTransactionManager.setWorkingMode( E_WORK ); - } -} - -//_________________________________________________________________________________________________________________ -void ThreadSafeClass::close( sal_Int32 nThreadID ) -{ - // Make it threadsafe. - // It must be an exclusiv access! => WriteLock! - WriteGuard aWriteLock( m_aLock ); - - LOG_CLOSE( nThreadID ) - - // We must look for multiple calls of this method. - // Try to register this method as a transaction. - // In combination with E_HARDEXCEPTIONS only working mode E_WORK pass this barrier. - ERejectReason eReason; - TransactionGuard aTransaction( m_aTransactionManager, E_NOEXCEPTIONS, eReason ); - if( eReason == E_NOREASON ) - { - // Change working mode to BEFORECLOSE to enable rejection of normal interface calls - // and enable SOFTEXCEPTION mode for some impl- or helper methods! - // Attention: We must stop successful registered transaction first ... - // because setWorkingMode() blocks and wait for all current existing ones! - aTransaction.stop(); - m_aTransactionManager.setWorkingMode( E_BEFORECLOSE ); - - // Now we are alone ... - // All further calls to this object are rejected ... - // (not all ... some special ones can work by using E_SOFTEXCEPTIONS!) - - // Deinitialize all member and set working mode to E_CLOSE. - m_nA = 0; - m_aTransactionManager.setWorkingMode( E_CLOSE ); - } -} - -//_________________________________________________________________________________________________________________ -void ThreadSafeClass::setA( sal_Int32 nA, sal_Int32 nThreadID ) -{ - // Make it threadsafe. - WriteGuard aWriteLock( m_aLock ); - - LOG_SETA_START( nA, nThreadID ) - - // Register this method as a transaction to prevent code against wrong calls - // after close() or before init()! - ERejectReason eReason; - TransactionGuard aTransaction( m_aTransactionManager, E_NOEXCEPTIONS, eReason ); - if( eReason == E_NOREASON ) - { - // This object is ready for working and we have full write access. - // We can work with our member. - m_nA = nA; - #ifdef ENABLE_REQUESTCOUNT - osl_incrementInterlockedCount( &m_nWriteCount ); - #endif - } - LOG_SETA_END( nA, eReason, nThreadID ) -} - -//_________________________________________________________________________________________________________________ -sal_Int32 ThreadSafeClass::getA( sal_Int32 nThreadID ) -{ - // Make it threadsafe. - ReadGuard aReadLock( m_aLock ); - - LOG_GETA_START( nThreadID ) - - // Register this method as a transaction to prevent code against wrong calls - // after close() or before init()! - sal_Int32 nReturn = 0; - ERejectReason eReason; - TransactionGuard aTransaction( m_aTransactionManager, E_NOEXCEPTIONS, eReason ); - if( eReason == E_NOREASON ) - { - // This object is ready for working and we have a read access. - // We can work with our member. - nReturn = m_nA; - #ifdef ENABLE_REQUESTCOUNT - osl_incrementInterlockedCount( &m_nReadCount ); - #endif - } - - LOG_GETA_END( nReturn, eReason, nThreadID ) - return nReturn; -} - -//_________________________________________________________________________________________________________________ -sal_Int32 ThreadSafeClass::workA( sal_Int32 nA , - sal_Int32 nThreadID ) -{ - // This method test the downgrade-mechanism of used lock implementation! - // Make it threadsafe. - WriteGuard aWriteLock( m_aLock ); - - LOG_WORKA_START( nA, nThreadID ) - - // Register this method as a transaction to prevent code against wrong calls - // after close() or before init()! - sal_Int32 nReturn = 0; - ERejectReason eReason; - TransactionGuard aTransaction( m_aTransactionManager, E_NOEXCEPTIONS, eReason ); - if( eReason == E_NOREASON ) - { - // We have write access to our member. - // Set new value. - m_nA = nA; - #ifdef ENABLE_REQUESTCOUNT - osl_incrementInterlockedCount( &m_nWriteCount ); - #endif - - // Downgrade write access to read access and read the set value again. - // This call can't be rejected - but it can fail! - aWriteLock.downgrade(); - nReturn = m_nA; - #ifdef ENABLE_REQUESTCOUNT - osl_incrementInterlockedCount( &m_nReadCount ); - #endif - } - - LOG_WORKA_END( nReturn, eReason, nThreadID ) - return nReturn; -} - -/*-****************************************************************************************************//** - @descr Every thread instance of these class lopp from 0 up to "nLoops". - He sleep for a random time and work with given test class "pClass" then. - We use random values for waiting for better results! - Otherwise all threads are sychron after first 2,3...5 calls - I think! -*//*-*****************************************************************************************************/ - -class TestThread : public osl::Thread -{ - public: - - TestThread( ThreadSafeClass* pClass , - sal_Int32 nLoops , - Condition* pListener , - sal_Bool bOwner = sal_False ); - - private: - - virtual void SAL_CALL run (); - virtual void SAL_CALL onTerminated (); - - private: - - ThreadSafeClass* m_pClass ; - sal_Int32 m_nLoops ; - sal_Int32 m_nThreadID ; - Condition* m_pListener ; - sal_Bool m_bOwner ; -}; - -//_________________________________________________________________________________________________________________ -TestThread::TestThread( ThreadSafeClass* pClass , - sal_Int32 nLoops , - Condition* pListener , - sal_Bool bOwner ) - : m_pClass ( pClass ) - , m_nLoops ( nLoops ) - , m_pListener ( pListener ) - , m_bOwner ( bOwner ) -{ -} - -//_________________________________________________________________________________________________________________ -void SAL_CALL TestThread::run() -{ - // Get ID of this thread. - // Is used for logging information ... - m_nThreadID = getCurrentIdentifier(); - - // If we are the owner of given pClass - // we must initialize ... and close - // it. See at the end of this method too. - if( m_bOwner == sal_True ) - { - m_pClass->init( 0, m_nThreadID ); - } - - #ifdef ENABLE_THREADDELAY - TimeValue nDelay ; - #endif - - sal_Int32 nA ; - - for( sal_Int32 nCount=0; nCount<m_nLoops; ++nCount ) - { - // Work with class. - // Use random to select called method. - nA = (sal_Int32)getRandomValue(); - if( nA % 5 == 0 ) - { - nA = m_pClass->workA( nA, m_nThreadID ); - } - else - if( nA % 3 == 0 ) - { - m_pClass->setA( nA, m_nThreadID ); - } - else - { - nA = m_pClass->getA( m_nThreadID ); - } - #ifdef ENABLE_THREADDELAY - // Sleep - use random value to do that too! - nDelay.Seconds = 0; - nDelay.Nanosec = getRandomValue(); - sleep( nDelay ); - #endif - } - - // Don't forget to "close" teset object if you are the owner! - if( m_bOwner == sal_True ) - { - m_pClass->close( m_nThreadID ); - } -} - -//_________________________________________________________________________________________________________________ -void SAL_CALL TestThread::onTerminated() -{ - // Destroy yourself if you finished. - // But don't forget to call listener before. - m_pListener->set(); - - m_pClass = NULL; - m_pListener = NULL; - - delete this; -} - -/*-****************************************************************************************************//** - @descr This is our test application. - We create one ThreadSafeClass object and a lot of threads - which use it at different times. -*//*-*****************************************************************************************************/ - -struct ThreadInfo -{ - Condition* pCondition ; - TestThread* pThread ; -}; - -class TestApplication : public Application -{ - public: - void Main ( ); - sal_Int32 measureTime ( sal_Int32 nThreadCount , - sal_Int32 nOwner , - sal_Int32 nLoops=0 ); -}; - -//_________________________________________________________________________________________________________________ -// definition -//_________________________________________________________________________________________________________________ - -TestApplication aApplication; - -//_________________________________________________________________________________________________________________ -// This function start "nThreadCount" threads to use same test class. -// You can specify the owner thread of this test class which start/stop it by using "nOwner". [1..nThreadcount]! -// If you specify "nLoops" different from 0 we use it as loop count for every started thread. -// Otherwise we work with random values. -sal_Int32 TestApplication::measureTime( sal_Int32 nThreadCount , - sal_Int32 nOwner , - sal_Int32 nLoops ) -{ - // This is the class which should be tested. - ThreadSafeClass aClass; - - // Create list of threads. - ThreadInfo* pThreads = new ThreadInfo[nThreadCount]; - sal_Int32 nLoopCount = nLoops ; - sal_Bool bOwner = sal_False ; - for( sal_Int32 nI=1; nI<=nThreadCount; ++nI ) - { - // If nLoops==0 => we must use random value; otherwise we must use given count ... - if( nLoops == 0 ) - { - nLoopCount = getRandomValue(); - } - // Search owner of class. - bOwner = sal_False; - if( nOwner == nI ) - { - bOwner = sal_True; - } - // initialize condition. - pThreads[nI].pCondition = new Condition; - // Initialize thread. - pThreads[nI].pThread = new TestThread( &aClass, nLoopCount, pThreads[nI].pCondition, bOwner ); - } - - // Start clock to get information about used time. - sal_uInt32 nStartTime ; - sal_uInt32 nEndTime ; - - nStartTime = osl_getGlobalTimer(); - - // Start threads ... - for( nI=1; nI<=nThreadCount; ++nI ) - { - pThreads[nI].pThread->create(); - } - - // Wait for threads ... - for( nI=1; nI<=nThreadCount; ++nI ) - { - pThreads[nI].pCondition->wait(); - delete pThreads[nI].pCondition; - pThreads[nI].pCondition = NULL; - } - - delete[] pThreads; - pThreads = NULL; - - nEndTime = osl_getGlobalTimer(); - - // Calc used time and return it. [ms] - return( nEndTime-nStartTime ); -} - -//_________________________________________________________________________________________________________________ -void TestApplication::Main() -{ - sal_Int32 nTestCount = 0; /// count of calling "measureTime()" - sal_Int32 nThreadCount = 0; /// count of used threads by "measure..." - sal_Int32 nLoops = 0; /// loop count for every thread - sal_Int32 nOwner = 0; /// number of owner thread - - // Parse command line. - // Attention: All parameter are required and must exist! - // syntax: "threadtest.exe <testcount> <threadcount> <loops> <owner>" - OUString sArgument ; - sal_Int32 nArgument ; - sal_Int32 nCount = osl_getCommandArgCount(); - - LOG_ASSERT2( nCount!=4 ,"TestApplication::Main()" , "Wrong argument line detected!") - - for( nArgument=0; nArgument<nCount; ++nArgument ) - { - osl_getCommandArg( nArgument, &sArgument.pData ); - if( nArgument== 0 ) nTestCount =sArgument.toInt32(); - if( nArgument== 1 ) nThreadCount=sArgument.toInt32(); - if( nArgument== 2 ) nLoops =sArgument.toInt32(); - if( nArgument== 3 ) nOwner =sArgument.toInt32(); - } - - // Start test. - OStringBuffer sBuf(256); - sal_Int32 nTime=0; - sBuf.append( "Nr.\tTime\tThreadCount\tLoops\tOwner\n" ); - for( sal_Int32 nI=1; nI<=nTestCount; ++nI ) - { - nTime = measureTime( nThreadCount, nOwner, nLoops ); - sBuf.append( nI ); - sBuf.append( "\t" ); - sBuf.append( nTime ); - sBuf.append( "\t" ); - sBuf.append( nThreadCount ); - sBuf.append( "\t" ); - sBuf.append( nLoops ); - sBuf.append( "\t" ); - sBuf.append( nOwner ); - sBuf.append( "\n" ); - } - - WRITE_LOGFILE( STATISTICS_FILE, sBuf.makeStringAndClear() ); - LOG_ERROR( "TApplication::Main()", "Test finish successful!" ) -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/test/threadtest/test.btm b/framework/test/threadtest/test.btm deleted file mode 100755 index 627c756893bf..000000000000 --- a/framework/test/threadtest/test.btm +++ /dev/null @@ -1,29 +0,0 @@ -@echo off -pushd - -rem TESTCOUNT = Anzahl von Test-Durchlaeufen -rem THREADCOUNT = Anzahl konk. Threads -rem LOOPS = Anzahl Durchlaeufe pro Test -rem OWNER = Numer des Threads, welcher Testklasse "besitzt" ... er muss diese initialisieren und deinitialisieren! - -echo "set test parameter ..." -set _TESTCOUNT=100 -set _THREADCOUNT=30 -set _LOOPS=50 -set _OWNER=10 - -cd bin - -echo "delete old log files ..." -*del .\threadtest_statistic.csv -*del .\threadtest.log - -echo "start test ..." -.\threadtest.exe %_TESTCOUNT% %_THREADCOUNT% %_LOOPS% %_OWNER% - -echo "show log files ..." -edit .\threadtest_statistic.csv -edit .\threadtest.log - -popd -echo on diff --git a/framework/test/threadtest/threadtest.cxx b/framework/test/threadtest/threadtest.cxx deleted file mode 100644 index 785ba77dcc29..000000000000 --- a/framework/test/threadtest/threadtest.cxx +++ /dev/null @@ -1,729 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include <threadhelp/threadhelpbase.hxx> - -#include <threadhelp/transactionbase.hxx> -#include <threadhelp/resetableguard.hxx> -#include <threadhelp/readguard.hxx> -#include <threadhelp/writeguard.hxx> -#include <threadhelp/transactionguard.hxx> -#include <macros/generic.hxx> -#include <macros/debug.hxx> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ - -//_________________________________________________________________________________________________________________ -// other includes -//_________________________________________________________________________________________________________________ -#include <rtl/random.h> -#include <osl/process.h> -#include <rtl/ustring.hxx> -#include <rtl/ustrbuf.hxx> -#include <osl/time.h> - -#include <osl/interlock.h> -#include <osl/thread.hxx> - -#include <vcl/event.hxx> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> -#include <stdio.h> - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define LOGFILE "threadtest.log" -#define STATISTICS_FILE "threadtest_statistic.csv" - -//_________________________________________________________________________________________________________________ -// namespace -//_________________________________________________________________________________________________________________ - -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::vos ; -using namespace ::framework ; - -//_________________________________________________________________________________________________________________ -// defines -//_________________________________________________________________________________________________________________ - -/*---------------- Use follow defines to enable/disable some special features of this little test program! -------*/ - -#define ENABLE_LOG -//#define ENABLE_THREADDELAY -#define ENABLE_REQUESTCOUNT - -/*----------------------------------------------------------------------------------------------------------------*/ - -#ifdef ENABLE_LOG - #define LOG_SETA_START( NA, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ::osl::MutexGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] call setA( " ); \ - sLog.append( NA ); \ - sLog.append( " )\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_SETA_END( NA, EREASON, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ::osl::MutexGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - if( EREASON == E_NOREASON ) \ - sLog.append( " ] finish setA( " ); \ - else \ - sLog.append( " ] was refused at setA( "); \ - sLog.append( NA ); \ - sLog.append( " )\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_GETA_START( NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ::osl::MutexGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] call getA()\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_GETA_END( NRETURN, EREASON, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ::osl::MutexGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - if( EREASON == E_NOREASON ) \ - sLog.append( " ] finish getA() with " ); \ - else \ - sLog.append( " ] was refused at getA() with " ); \ - sLog.append( NRETURN ); \ - sLog.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_WORKA_START( NA, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ::osl::MutexGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] call workA( " ); \ - sLog.append( NA ); \ - sLog.append( " )\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_WORKA_END( NRETURN, EREASON, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ::osl::MutexGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - if( EREASON == E_NOREASON ) \ - sLog.append( " ] finish workA() with " ); \ - else \ - sLog.append( " ] was refused at workA() with " ); \ - sLog.append( NRETURN ); \ - sLog.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_INITEXCEPTION( SMETHOD, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ::osl::MutexGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] get EInitException from \"" ); \ - sLog.append( SMETHOD ); \ - sLog.append( "\"\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_CLOSEEXCEPTION( SMETHOD, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ::osl::MutexGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] get ECloseException from \"" ); \ - sLog.append( SMETHOD ); \ - sLog.append( "\"\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_INIT( NA, NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ::osl::MutexGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] initialize me with " ); \ - sLog.append( NA ); \ - sLog.append( "\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } - - #define LOG_CLOSE( NID ) \ - { \ - sal_uInt32 nTimeStamp = osl_getGlobalTimer(); \ - ::osl::MutexGuard aLogGuard( m_aLogMutex ); \ - OStringBuffer sLog(256); \ - sLog.append( (sal_Int32)nTimeStamp ); \ - sLog.append( ": Thread[ " ); \ - sLog.append( NID ); \ - sLog.append( " ] close me\n" ); \ - WRITE_LOGFILE( LOGFILE, sLog.makeStringAndClear() ) \ - } -#else - #define LOG_SETA_START( NA, NID ) - #define LOG_SETA_END( NA, EREASON, NID ) - #define LOG_GETA_START( NID ) - #define LOG_GETA_END( NRETURN, EREASON, NID ) - #define LOG_WORKA_START( NA, NID ) - #define LOG_WORKA_END( NRETURN, EREASON, NID ) - #define LOG_INITEXCEPTION( SMETHOD, NID ) - #define LOG_CLOSEEXCEPTION( SMETHOD, NID ) - #define LOG_INIT( NA, NID ) - #define LOG_CLOSE( NID ) -#endif - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -sal_uInt16 getRandomValue() -{ - // Get new random value for thread-sleep! - // See run() for further informations. - // Always calculate a new random number. - sal_uInt16 nValue; - rtlRandomPool aPool = rtl_random_createPool(); - rtl_random_getBytes ( aPool, &nValue, 2 ); - rtl_random_destroyPool ( aPool ); - return nValue; -} - -/*-************************************************************************************************************//** - @descr This class is used from different threads at the same time. - We start working after calling init() first(!) ... - and finish it by calling close(). It exist two methods for reading/writing an - internal variable "A". Another function workA() do both things at the same time. - All public methods log information in a file if DO_LOG is defined. - - @attention Our public base class FaiRWLockBase is a struct with a RWLock as member. - This member can be used by guards to safe access at internal variables - in interface methods. - Another baseclass is the TransactionBase. They support rejection of wrong calls at wrong time. - e.g. calls after closing object! -*//*-*************************************************************************************************************/ - -class ThreadSafeClass : private ThreadHelpBase - , private TransactionBase - -{ - public: - - ThreadSafeClass (); - ~ThreadSafeClass(); - - // This methods are used from differnt threads - // to test this class. - void init ( sal_Int32 nA , - sal_Int32 nThreadID ); - void close ( sal_Int32 nThreadID ); - void setA ( sal_Int32 nA , - sal_Int32 nThreadID ); - sal_Int32 getA ( sal_Int32 nThreadID ); - sal_Int32 workA ( sal_Int32 nA , - sal_Int32 nThreadID ); - - #ifdef ENABLE_REQUESTCOUNT - // This methods are used for statistics only! - sal_Int32 getReadCount () { return m_nReadCount; } - sal_Int32 getWriteCount() { return m_nWriteCount; } - #endif - - private: - - sal_Int32 m_nA ; /// test member fro reading/writing - - #ifdef ENABLE_LOG - ::osl::Mutex m_aLogMutex ; /// mutex to serialize writing log file! - #endif - - #ifdef ENABLE_REQUESTCOUNT - oslInterlockedCount m_nReadCount ; /// statistic variables to count read/write requests - oslInterlockedCount m_nWriteCount ; - #endif -}; - -//_________________________________________________________________________________________________________________ -ThreadSafeClass::ThreadSafeClass() - : ThreadHelpBase ( ) - , TransactionBase ( ) - , m_nA ( 0 ) - #ifdef ENABLE_REQUESTCOUNT - , m_nReadCount ( 0 ) - , m_nWriteCount ( 0 ) - #endif -{ -} - -//_________________________________________________________________________________________________________________ -ThreadSafeClass::~ThreadSafeClass() -{ -} - -//_________________________________________________________________________________________________________________ -void ThreadSafeClass::init( sal_Int32 nA, sal_Int32 nThreadID ) -{ - // Look for multiple calls of this method first! - // Use E_SOFTEXCEPTIONS to disable automaticly throwing of exceptions for some working modes. - TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); - - // Set write lock for setting internal member AND - // protect changing of working mode! - WriteGuard aWriteLock( m_aLock ); - LOG_INIT( nA, nThreadID ) - - // OK, it must be the first call and we are synchronized with all other threads by using the write lock! - // Otherwise (e.g. if working mode == E_WORK) we get a exception and follow lines are never called. - - // We can set our member and change the working mode now. - m_nA = nA; - - aWriteLock.unlock(); - - m_aTransactionManager.setWorkingMode( E_WORK ); -} - -//_________________________________________________________________________________________________________________ -void ThreadSafeClass::close( sal_Int32 nThreadID ) -{ - // We must look for multiple calls of this method. - // Try to register this method as a transaction. - // In combination with E_HARDEXCEPTIONS only working mode E_WORK pass this barrier. - TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); - aTransaction.stop(); - - // Change working mode to BEFORECLOSE to enable rejection of normal interface calls - // and enable SOFTEXCEPTION mode for some impl- or helper methods! - // Attention: We must stop successful registered transaction first ... - // because setWorkingMode() blocks and wait for all current existing ones! - m_aTransactionManager.setWorkingMode( E_BEFORECLOSE ); - - // Make it threadsafe. - // It must be an exclusiv access! => WriteLock! - WriteGuard aWriteLock( m_aLock ); - - LOG_CLOSE( nThreadID ) - - // Now we are alone ... - // All further calls to this object are rejected ... - // (not all ... some special ones can work by using E_SOFTEXCEPTIONS!) - - // Deinitialize all member and set working mode to E_CLOSE. - m_nA = 0; - - aWriteLock.unlock(); - - m_aTransactionManager.setWorkingMode( E_CLOSE ); -} - -//_________________________________________________________________________________________________________________ -void ThreadSafeClass::setA( sal_Int32 nA, sal_Int32 nThreadID ) -{ - // Register this method as a transaction to prevent code against wrong calls - // after close() or before init()! - ERejectReason eReason; - TransactionGuard aTransaction( m_aTransactionManager, E_NOEXCEPTIONS, &eReason ); - if( eReason == E_NOREASON ) - { - // Make it threadsafe. - WriteGuard aWriteLock( m_aLock ); - - LOG_SETA_START( nA, nThreadID ) - - // This object is ready for working and we have full write access. - // We can work with our member. - m_nA = nA; - #ifdef ENABLE_REQUESTCOUNT - osl_incrementInterlockedCount( &m_nWriteCount ); - #endif - LOG_SETA_END( nA, eReason, nThreadID ) - } -} - -//_________________________________________________________________________________________________________________ -sal_Int32 ThreadSafeClass::getA( sal_Int32 nThreadID ) -{ - // Register this method as a transaction to prevent code against wrong calls - // after close() or before init()! - sal_Int32 nReturn = 0; - ERejectReason eReason; - TransactionGuard aTransaction( m_aTransactionManager, E_NOEXCEPTIONS, &eReason ); - if( eReason == E_NOREASON ) - { - // Make it threadsafe. - ReadGuard aReadLock( m_aLock ); - - LOG_GETA_START( nThreadID ) - - // This object is ready for working and we have a read access. - // We can work with our member. - nReturn = m_nA; - #ifdef ENABLE_REQUESTCOUNT - osl_incrementInterlockedCount( &m_nReadCount ); - #endif - LOG_GETA_END( nReturn, eReason, nThreadID ) - } - return nReturn; -} - -//_________________________________________________________________________________________________________________ -sal_Int32 ThreadSafeClass::workA( sal_Int32 nA , - sal_Int32 nThreadID ) -{ - // Register this method as a transaction to prevent code against wrong calls - // after close() or before init()! - sal_Int32 nReturn = 0; - ERejectReason eReason; - TransactionGuard aTransaction( m_aTransactionManager, E_NOEXCEPTIONS, &eReason ); - if( eReason == E_NOREASON ) - { - // This method test the downgrade-mechanism of used lock implementation! - // Make it threadsafe. - WriteGuard aWriteLock( m_aLock ); - - LOG_WORKA_START( nA, nThreadID ) - // We have write access to our member. - // Set new value. - m_nA = nA; - #ifdef ENABLE_REQUESTCOUNT - osl_incrementInterlockedCount( &m_nWriteCount ); - #endif - - // Downgrade write access to read access and read the set value again. - // This call can't be rejected - but it can fail! - aWriteLock.downgrade(); - nReturn = m_nA; - #ifdef ENABLE_REQUESTCOUNT - osl_incrementInterlockedCount( &m_nReadCount ); - #endif - - LOG_WORKA_END( nReturn, eReason, nThreadID ) - } - return nReturn; -} - -/*-****************************************************************************************************//** - @descr Every thread instance of these class lopp from 0 up to "nLoops". - He sleep for a random time and work with given test class "pClass" then. - We use random values for waiting for better results! - Otherwise all threads are sychron after first 2,3...5 calls - I think! -*//*-*****************************************************************************************************/ - -class TestThread : public osl::Thread -{ - public: - - TestThread( ThreadSafeClass* pClass , - sal_Int32 nLoops , - Condition* pListener , - sal_Bool bOwner = sal_False ); - - private: - - virtual void SAL_CALL run (); - virtual void SAL_CALL onTerminated (); - - private: - - ThreadSafeClass* m_pClass ; - sal_Int32 m_nLoops ; - sal_Int32 m_nThreadID ; - Condition* m_pListener ; - sal_Bool m_bOwner ; -}; - -//_________________________________________________________________________________________________________________ -TestThread::TestThread( ThreadSafeClass* pClass , - sal_Int32 nLoops , - Condition* pListener , - sal_Bool bOwner ) - : m_pClass ( pClass ) - , m_nLoops ( nLoops ) - , m_pListener ( pListener ) - , m_bOwner ( bOwner ) -{ -} - -//_________________________________________________________________________________________________________________ -void SAL_CALL TestThread::run() -{ - // Get ID of this thread. - // Is used for logging information ... - m_nThreadID = getCurrentIdentifier(); - - // If we are the owner of given pClass - // we must initialize ... and close - // it. See at the end of this method too. - if( m_bOwner == sal_True ) - { - m_pClass->init( 0, m_nThreadID ); - } - - #ifdef ENABLE_THREADDELAY - TimeValue nDelay ; - #endif - - sal_Int32 nA ; - - for( sal_Int32 nCount=0; nCount<m_nLoops; ++nCount ) - { - // Work with class. - // Use random to select called method. - nA = (sal_Int32)getRandomValue(); - if( nA % 3 == 0 ) - { - m_pClass->setA( nA, m_nThreadID ); - } - else - { - nA = m_pClass->getA( m_nThreadID ); - } - #ifdef ENABLE_THREADDELAY - // Sleep - use random value to do that too! - nDelay.Seconds = 0; - nDelay.Nanosec = getRandomValue(); - sleep( nDelay ); - #endif - } - - // Don't forget to "close" teset object if you are the owner! - if( m_bOwner == sal_True ) - { - m_pClass->close( m_nThreadID ); - } -} - -//_________________________________________________________________________________________________________________ -void SAL_CALL TestThread::onTerminated() -{ - // Destroy yourself if you finished. - // But don't forget to call listener before. - m_pListener->set(); - - m_pClass = NULL; - m_pListener = NULL; - - delete this; -} - -/*-****************************************************************************************************//** - @descr This is our test application. - We create one ThreadSafeClass object and a lot of threads - which use it at different times. -*//*-*****************************************************************************************************/ - -struct ThreadInfo -{ - Condition* pCondition ; - TestThread* pThread ; -}; - -class TestApplication : public Application -{ - public: - void Main ( ); - sal_Int32 measureTime ( sal_Int32 nThreadCount , - sal_Int32 nOwner , - sal_Int32 nLoops=0 ); -}; - -//_________________________________________________________________________________________________________________ -// definition -//_________________________________________________________________________________________________________________ - -TestApplication aApplication; - -//_________________________________________________________________________________________________________________ -// This function start "nThreadCount" threads to use same test class. -// You can specify the owner thread of this test class which start/stop it by using "nOwner". [1..nThreadcount]! -// If you specify "nLoops" different from 0 we use it as loop count for every started thread. -// Otherwise we work with random values. -sal_Int32 TestApplication::measureTime( sal_Int32 nThreadCount , - sal_Int32 nOwner , - sal_Int32 nLoops ) -{ - // This is the class which should be tested. - ThreadSafeClass aClass; - - // Create list of threads. - ThreadInfo* pThreads = new ThreadInfo[nThreadCount]; - sal_Int32 nLoopCount = nLoops ; - sal_Bool bOwner = sal_False ; - for( sal_Int32 nI=0; nI<nThreadCount; ++nI ) - { - // If nLoops==0 => we must use random value; otherwise we must use given count ... - if( nLoops == 0 ) - { - nLoopCount = getRandomValue(); - } - // Search owner of class. - bOwner = sal_False; - if( nOwner == nI ) - { - bOwner = sal_True; - } - // initialize condition. - pThreads[nI].pCondition = new Condition; - // Initialize thread. - pThreads[nI].pThread = new TestThread( &aClass, nLoopCount, pThreads[nI].pCondition, bOwner ); - } - - // Start clock to get information about used time. - sal_uInt32 nStartTime ; - sal_uInt32 nEndTime ; - - nStartTime = osl_getGlobalTimer(); - - // Start threads ... - for( nI=0; nI<nThreadCount; ++nI ) - { - pThreads[nI].pThread->create(); - } - - // Wait for threads ... - for( nI=0; nI<nThreadCount; ++nI ) - { - pThreads[nI].pCondition->wait(); - delete pThreads[nI].pCondition; - pThreads[nI].pCondition = NULL; - pThreads[nI].pThread = NULL; - } - - delete[] pThreads; - pThreads = NULL; - - nEndTime = osl_getGlobalTimer(); - - // Calc used time and return it. [ms] - return( nEndTime-nStartTime ); -} - -//_________________________________________________________________________________________________________________ -void TestApplication::Main() -{ - sal_Int32 nTestCount = 0; /// count of calling "measureTime()" - sal_Int32 nThreadCount = 0; /// count of used threads by "measure..." - sal_Int32 nLoops = 0; /// loop count for every thread - sal_Int32 nOwner = 0; /// number of owner thread - - // Parse command line. - // Attention: All parameter are required and must exist! - // syntax: "threadtest.exe <testcount> <threadcount> <loops> <owner>" - OUString sArgument ; - sal_Int32 nArgument ; - sal_Int32 nCount = osl_getCommandArgCount(); - - LOG_ASSERT2( nCount!=4 ,"TestApplication::Main()" , "Wrong argument line detected!") - - for( nArgument=0; nArgument<nCount; ++nArgument ) - { - osl_getCommandArg( nArgument, &sArgument.pData ); - if( nArgument== 0 ) nTestCount =sArgument.toInt32(); - if( nArgument== 1 ) nThreadCount=sArgument.toInt32(); - if( nArgument== 2 ) nLoops =sArgument.toInt32(); - if( nArgument== 3 ) nOwner =sArgument.toInt32(); - } - - LOG_ASSERT2( nTestCount==0||nThreadCount==0||nLoops==0||nOwner==0,"TestApplication::Main()", "Wrong argument value detected!" ) - - // Start test. - OStringBuffer sBuf(256); - sal_Int32 nTime=0; - sBuf.append( "Nr.\tTime\tThreadCount\tLoops\tOwner\n" ); - for( sal_Int32 nI=1; nI<=nTestCount; ++nI ) - { - nTime = measureTime( nThreadCount, nOwner, nLoops ); - sBuf.append( nI ); - sBuf.append( "\t" ); - sBuf.append( nTime ); - sBuf.append( "\t" ); - sBuf.append( nThreadCount ); - sBuf.append( "\t" ); - sBuf.append( nLoops ); - sBuf.append( "\t" ); - sBuf.append( nOwner ); - sBuf.append( "\n" ); - } - - WRITE_LOGFILE( STATISTICS_FILE, sBuf.makeStringAndClear() ); - LOG_ERROR( "TApplication::Main()", "Test finish successful!" ) -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/test/typecfg/build.btm b/framework/test/typecfg/build.btm deleted file mode 100755 index f984a1146296..000000000000 --- a/framework/test/typecfg/build.btm +++ /dev/null @@ -1,26 +0,0 @@ -@echo off - -pushd - -rem Set flag to enable special mechanism of "FilterCache". -rem This works for windows only! ... this batch too :-) -set ENVCFLAGS=-DENABLE_GENERATEFILTERCACHE - -rem Touch header file ... -cd ..\..\inc\classes -attrib -r .\filtercache.hxx -touch .\filtercache.hxx - -rem ... and start new build of library. -cd ..\.. -call build debug=true - -rem Build command line tool too. -cd test\typecfg -call dmake debug=true - -rem Don't forget to disable build flag! -unset ENVCFLAGS - -popd -echo on diff --git a/framework/test/typecfg/cfgview.cxx b/framework/test/typecfg/cfgview.cxx deleted file mode 100644 index ca60ea1b2f7e..000000000000 --- a/framework/test/typecfg/cfgview.cxx +++ /dev/null @@ -1,1500 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include <classes/servicemanager.hxx> -#include <classes/filtercache.hxx> -#include <macros/generic.hxx> -#include <macros/debug.hxx> -#include <services.h> -#include <filterflags.h> -#include <queries.h> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> - -//_________________________________________________________________________________________________________________ -// other includes -//_________________________________________________________________________________________________________________ -#include <comphelper/processfactory.hxx> -#include <osl/process.h> -#include <rtl/ustring.hxx> -#include <rtl/ustrbuf.hxx> - -#include <boost/unordered_map.hpp> - -#include <vcl/event.hxx> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> -#include <stdio.h> - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define RDBFILE DECLARE_ASCII("typecfg.rdb" ) -#define ARGUMENT_DIRNAME DECLARE_ASCII("-dir=" ) // argument for output directory -#define ARGUMENT_VERSION DECLARE_ASCII("-ver=" ) // argument for file version to read [1|2|3] -#define ARGUMENTLENGTH 5 // same length for all arguemnts make it easier to detect it :-) -#define ARGUMENTFOUND 0 // OUString::compareTo returns 0 if searched string match given one - -#define MENU_HTML "menu.html" -#define BLANK_HTML "blank.html" - -#define FRAMESET_START_HTML "index.html" -#define FRAMESET_TYPES_HTML "fs_types.html" -#define FRAMESET_FILTERS_HTML "fs_filters.html" -#define FRAMESET_MODULFILTERS_HTML "fs_modulfilters.html" -#define FRAMESET_DETECTORS_HTML "fs_detectors.html" -#define FRAMESET_LOADERS_HTML "fs_loaders.html" -#define FRAMESET_INVALIDFILTERS_HTML "fs_invalidfilters.html" -#define FRAMESET_INVALIDDETECTORS_HTML "fs_invaliddetectors.html" -#define FRAMESET_INVALIDLOADERS_HTML "fs_invalidloaders.html" -#define FRAMESET_DOUBLEFILTERUINAMES_HTML "fs_doublefilteruinames.html" - -#define ALLTYPES_HTML "alltypes.html" -#define ALLFILTERS_HTML "allfilters.html" -#define ALLDETECTORS_HTML "alldetectors.html" -#define ALLLOADERS_HTML "allloaders.html" - -#define TYPEPROPERTIES_HTML "typeproperties.html" -#define FILTERPROPERTIES_HTML "filterproperties.html" -#define DETECTORPROPERTIES_HTML "detectorproperties.html" -#define LOADERPROPERTIES_HTML "loaderproperties.html" - -#define INVALIDFILTERS_HTML "invalidfilters.html" -#define INVALIDDETECTORS_HTML "invaliddetectors.html" -#define INVALIDLOADERS_HTML "invalidloaders.html" - -#define FILTERFLAGS_HTML "filterflags.html" -#define MODULFILTERS_HTML "modulfilters.html" -#define DOUBLEFILTERUINAMES_HTML "doublefilteruinames.html" - -#define TARGET_MENU "menu" -#define TARGET_VIEW "view" -#define TARGET_LIST "list" -#define TARGET_PROPERTIES "properties" - -//_________________________________________________________________________________________________________________ -// namespace -//_________________________________________________________________________________________________________________ - -using namespace ::std ; -using namespace ::rtl ; -using namespace ::framework ; -using namespace ::comphelper ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::container ; -using namespace ::com::sun::star::beans ; - -//_________________________________________________________________________________________________________________ -// defines -//_________________________________________________________________________________________________________________ - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-***************************************************************************************************************/ -struct AppMember -{ - Reference< XMultiServiceFactory > xServiceManager ; - FilterCache* pCache ; - ::rtl::OUString sDirectory ; - sal_Int32 nVersion ; -}; - -/*-***************************************************************************************************************/ -class CFGView : public Application -{ - //************************************************************************************************************* - public: - void Main(); - - //************************************************************************************************************* - private: - void impl_parseCommandLine ( AppMember& rMember ); - void impl_generateHTMLView (); - - //************************************************************************************************************* - private: - void impl_printCopyright (); - void impl_printSyntax (); - void impl_generateTypeListHTML (); - void impl_generateFilterListHTML (); - void impl_generateFilterModulListHTML (); - void impl_generateDetectorListHTML (); - void impl_generateLoaderListHTML (); - void impl_generateInvalidFiltersHTML (); - void impl_generateInvalidDetectorsHTML (); - void impl_generateInvalidLoadersHTML (); - void impl_generateFilterFlagsHTML (); - void impl_generateDefaultFiltersHTML (); - void impl_generateDoubleFilterUINamesHTML (); - void impl_writeFile ( const ::rtl::OString& sFile, const ::rtl::OString& sContent ); - - //************************************************************************************************************* - private: - AppMember m_aData ; - -}; // class CFGView - -//_________________________________________________________________________________________________________________ -// global variables -//_________________________________________________________________________________________________________________ - -CFGView gApplication; - -//***************************************************************************************************************** -void CFGView::Main() -{ - // Init global servicemanager and set it. - // It's neccessary for other services ... e.g. configuration. - ServiceManager aManager; - ::comphelper::setProcessServiceFactory( aManager.getGlobalUNOServiceManager() ); - - // Get optional commands from command line. - impl_parseCommandLine( m_aData ); - - // Read configuration and fill cache ... use given file version (see parameter "-ver=" too) - m_aData.pCache = new FilterCache( m_aData.nVersion ); - - // Generate view as html - impl_generateHTMLView(); - - // Free all used memory - delete m_aData.pCache; - m_aData.pCache = NULL; -} - -/*-************************************************************************************************************//** - @short print some info messages to stderr - @descr We must show an copyright or help for using this file. - This two methods do that. - - @seealso - - - @param - - @return - - - @onerror - -*//*-*************************************************************************************************************/ -void CFGView::impl_printCopyright() -{ - fprintf( stderr, "\n(c) Copyright by Sun microsystems, 2001\n" ); -} - -//***************************************************************************************************************** -void CFGView::impl_printSyntax() -{ - fprintf( stderr, "\nusing: xml2xcd -fi=<outputfile> -vi=<version input> -vo=<version output> [-wr=<true|false>]\n\n" ); - fprintf( stderr, "\tneccessary parameters:\n" ); - fprintf( stderr, "\t\t-fi=<outputfile>\tname of output file in system notation\n" ); - fprintf( stderr, "\t\t-vi=<version input>\tformat version of input xml file\n" ); - fprintf( stderr, "\t\t-vo=<version output>\tformat version of generated xcd file\n\n" ); - fprintf( stderr, "\toptional parameters:\n" ); - fprintf( stderr, "\t\t-wr=<true|false>\tconfig items should be writeable ... [true|false]\n" ); -} - -/*-************************************************************************************************************//** - @short analyze command line arguments - @descr Created binary accept different command line arguments. These parameters - regulate creation of this html view. Follow arguments are supported: - "-dir=<directory for output files>" - "-ver=<version of input file>[1|2|3]" - - @seealso - - - @param "rMember", reference to struct of global application member to fill arguments in it - @return right filled member struct or unchanged struct if an error occure! - - @onerror We do nothing - or warn programmer! -*//*-*************************************************************************************************************/ -void CFGView::impl_parseCommandLine( AppMember& rMember ) -{ - ::rtl::OUString sArgument ; - sal_Int32 nArgument = 0 ; - sal_Int32 nCount = osl_getCommandArgCount(); - sal_Int32 nMinCount = 0 ; - - while( nArgument<nCount ) - { - osl_getCommandArg( nArgument, &sArgument.pData ); - //_____________________________________________________________________________________________________ - // look for "-dir=" - if( sArgument.compareTo( ARGUMENT_DIRNAME, ARGUMENTLENGTH ) == ARGUMENTFOUND ) - { - rMember.sDirectory = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH ); - ++nMinCount; - } - else - //_____________________________________________________________________________________________________ - // look for "-ver=" - if( sArgument.compareTo( ARGUMENT_VERSION, ARGUMENTLENGTH ) == ARGUMENTFOUND ) - { - ::rtl::OUString sVersion = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH ); - rMember.nVersion = sVersion.toInt32(); - ++nMinCount; - } - - ++nArgument; - } - - // Show help if user don't call us right! - if( nMinCount != 2 ) - { - impl_printSyntax(); - exit(-1); - } -} - -//***************************************************************************************************************** -void CFGView::impl_generateHTMLView() -{ - //------------------------------------------------------------------------------------------------------------- - // generate start frameset - OUStringBuffer sStartFramesetHTML( 10000 ); - - sStartFramesetHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tTypeDetection CFG\n\t\t</title>\n\t</head>\n" ); // open html - sStartFramesetHTML.appendAscii( "\t\t<frameset rows=\"25%,75%\">\n" ); // open frameset - sStartFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "menu" - sStartFramesetHTML.appendAscii( TARGET_MENU ); - sStartFramesetHTML.appendAscii( "\" src=\"" ); - sStartFramesetHTML.appendAscii( MENU_HTML ); - sStartFramesetHTML.appendAscii( "\" title=\"List\">\n" ); - sStartFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "view" - sStartFramesetHTML.appendAscii( TARGET_VIEW ); - sStartFramesetHTML.appendAscii( "\" src=\"" ); - sStartFramesetHTML.appendAscii( BLANK_HTML ); - sStartFramesetHTML.appendAscii( "\" title=\"Properties\">\n" ); - sStartFramesetHTML.appendAscii( "\t\t</frameset>\n" ); // close frameset - sStartFramesetHTML.appendAscii( "</html>\n" ); // close html - - impl_writeFile( FRAMESET_START_HTML, U2B(sStartFramesetHTML.makeStringAndClear()) ); - - //------------------------------------------------------------------------------------------------------------- - // generate blank html - OUStringBuffer sBlankHTML( 10000 ); - - sBlankHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tBlank\n\t\t</title>\n\t</head>\n\t<body>\n\t</body>Please select ...\n</html>\n" ); // open html - - impl_writeFile( BLANK_HTML, U2B(sBlankHTML.makeStringAndClear()) ); - - //------------------------------------------------------------------------------------------------------------- - // generate menu - OUStringBuffer sMenuHTML( 10000 ); - - sMenuHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tMenu\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - sMenuHTML.appendAscii( "\t\t<ul>\n" ); // open list - - sMenuHTML.appendAscii( "\t\t<li><a href=\"" ); // list entry for "All Types" - sMenuHTML.appendAscii( FRAMESET_TYPES_HTML ); - sMenuHTML.appendAscii( "\" target=\"" ); - sMenuHTML.appendAscii( TARGET_VIEW ); - sMenuHTML.appendAscii( "\">All Types</a></li>\n" ); - - sMenuHTML.appendAscii( "\t\t<li><a href=\"" ); // list entry for "All Filters" - sMenuHTML.appendAscii( FRAMESET_FILTERS_HTML ); - sMenuHTML.appendAscii( "\" target=\"" ); - sMenuHTML.appendAscii( TARGET_VIEW ); - sMenuHTML.appendAscii( "\">All Filters</a></li>\n" ); - - sMenuHTML.appendAscii( "\t\t<li><a href=\"" ); // list entry for "All Filters sorted by modules" - sMenuHTML.appendAscii( FRAMESET_MODULFILTERS_HTML ); - sMenuHTML.appendAscii( "\" target=\"" ); - sMenuHTML.appendAscii( TARGET_VIEW ); - sMenuHTML.appendAscii( "\">Filters by Moduls</a></li>\n" ); - - sMenuHTML.appendAscii( "\t\t<li><a href=\"" ); // list entry for "All Detectors" - sMenuHTML.appendAscii( FRAMESET_DETECTORS_HTML ); - sMenuHTML.appendAscii( "\" target=\"" ); - sMenuHTML.appendAscii( TARGET_VIEW ); - sMenuHTML.appendAscii( "\">All Detector Services</a></li>\n" ); - - sMenuHTML.appendAscii( "\t\t<li><a href=\"" ); // list entry for "All Loaders" - sMenuHTML.appendAscii( FRAMESET_LOADERS_HTML ); - sMenuHTML.appendAscii( "\" target=\"" ); - sMenuHTML.appendAscii( TARGET_VIEW ); - sMenuHTML.appendAscii( "\">All Loader Services</a></li>\n" ); - - sMenuHTML.appendAscii( "\t\t<li><a href=\"" ); // list entry for "Invalid Filter" - sMenuHTML.appendAscii( FRAMESET_INVALIDFILTERS_HTML ); - sMenuHTML.appendAscii( "\" target=\"" ); - sMenuHTML.appendAscii( TARGET_VIEW ); - sMenuHTML.appendAscii( "\">Invalid Filter</a></li>\n" ); - - sMenuHTML.appendAscii( "\t\t<li><a href=\"" ); // list entry for "Invalid Detect Services" - sMenuHTML.appendAscii( FRAMESET_INVALIDDETECTORS_HTML ); - sMenuHTML.appendAscii( "\" target=\"" ); - sMenuHTML.appendAscii( TARGET_VIEW ); - sMenuHTML.appendAscii( "\">Invalid Detect Services</a></li>\n" ); - - sMenuHTML.appendAscii( "\t\t<li><a href=\"" ); // list entry for "Double Filter UINames" - sMenuHTML.appendAscii( FRAMESET_DOUBLEFILTERUINAMES_HTML ); - sMenuHTML.appendAscii( "\" target=\"" ); - sMenuHTML.appendAscii( TARGET_VIEW ); - sMenuHTML.appendAscii( "\">Double Filter UINames</a></li>\n" ); - - sMenuHTML.appendAscii( "\t\t<li><a href=\"" ); // list entry for "Show Filter Flags" - sMenuHTML.appendAscii( FILTERFLAGS_HTML ); - sMenuHTML.appendAscii( "\" target=\"" ); - sMenuHTML.appendAscii( TARGET_VIEW ); - sMenuHTML.appendAscii( "\">Show Filter Flags</a></li>\n" ); - - sMenuHTML.appendAscii( "\t\t</ul>\n" ); // close list - sMenuHTML.appendAscii( "\t</body>\n</html>\n" ); // close html - - impl_writeFile( MENU_HTML, U2B(sMenuHTML.makeStringAndClear()) ); - - impl_generateTypeListHTML (); - impl_generateFilterListHTML (); - impl_generateFilterModulListHTML (); - impl_generateDetectorListHTML (); - impl_generateLoaderListHTML (); - impl_generateInvalidFiltersHTML (); - impl_generateInvalidDetectorsHTML (); - impl_generateInvalidLoadersHTML (); - impl_generateFilterFlagsHTML (); - impl_generateDoubleFilterUINamesHTML(); -} - -//***************************************************************************************************************** -void CFGView::impl_generateTypeListHTML() -{ - //------------------------------------------------------------------------------------------------------------- - // generate frameset for types - OUStringBuffer sTypesFramesetHTML( 10000 ); - - sTypesFramesetHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFrameset: Types\n\t\t</title>\n\t</head>\n" ); // open html - sTypesFramesetHTML.appendAscii( "\t\t<frameset cols=\"40%,60%\">\n" ); // open frameset for cols - sTypesFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "list" - sTypesFramesetHTML.appendAscii( TARGET_LIST ); - sTypesFramesetHTML.appendAscii( "\" src=\"" ); - sTypesFramesetHTML.appendAscii( ALLTYPES_HTML ); - sTypesFramesetHTML.appendAscii( "\" title=\"List\">\n" ); - sTypesFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "properties" - sTypesFramesetHTML.appendAscii( TARGET_PROPERTIES ); - sTypesFramesetHTML.appendAscii( "\" src=\"" ); - sTypesFramesetHTML.appendAscii( TYPEPROPERTIES_HTML ); - sTypesFramesetHTML.appendAscii( "\" title=\"Properties\">\n" ); - sTypesFramesetHTML.appendAscii( "\t\t</frameset>\n" ); // close frameset cols - sTypesFramesetHTML.appendAscii( "</html>\n" ); // close html - - impl_writeFile( FRAMESET_TYPES_HTML, U2B(sTypesFramesetHTML.makeStringAndClear()) ); - - //------------------------------------------------------------------------------------------------------------- - // generate type list (names and links only!) - // use same loop to generate type property list! - OUStringBuffer sAllTypesHTML( 10000 ); - OUStringBuffer sTypePropHTML( 10000 ); - - sAllTypesHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tAll Types\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - sAllTypesHTML.appendAscii( "\t\t<table border=0><tr><td bgcolor=#ff8040><strong>Nr.</strong></td><td bgcolor=#ff8040><strong>Type</strong></td></tr>\n" ); // open table - - sTypePropHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tTypeProperties\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - - css::uno::Sequence< ::rtl::OUString > lNames = m_aData.pCache->getAllTypeNames(); - sal_Int32 nCount = lNames.getLength() ; - for( sal_Int32 nItem=0; nItem<nCount; ++nItem ) - { - ::rtl::OUString sName = lNames[nItem] ; - FileType aItem = m_aData.pCache->getType( sName ); - - // write entry in type list table - sAllTypesHTML.appendAscii ( "\t\t\t<tr>\n" ); // open row - sAllTypesHTML.appendAscii ( "\t\t\t\t<td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">" ); // open column "nr" - sAllTypesHTML.append ( OUString::valueOf( nItem ) ); // write nr - sAllTypesHTML.appendAscii ( "</td>\n" ); // close column "nr" - sAllTypesHTML.appendAscii ( "\t\t\t\t<td>" ); // open column "name" - sAllTypesHTML.appendAscii ( "<a href=\"" ); // open href="typeproperties.html#<typename>" - sAllTypesHTML.appendAscii ( TYPEPROPERTIES_HTML ); - sAllTypesHTML.appendAscii ( "#" ); - sAllTypesHTML.append ( aItem.sName ); - sAllTypesHTML.appendAscii ( "\" target=\"" ); - sAllTypesHTML.appendAscii ( TARGET_PROPERTIES ); - sAllTypesHTML.appendAscii ( "\">" ); - sAllTypesHTML.append ( aItem.sName ); // write name - sAllTypesHTML.appendAscii ( "</a>" ); // close href - sAllTypesHTML.appendAscii ( "</td>\n" ); // close column "name" - sAllTypesHTML.appendAscii ( "\t\t\t</tr>\n" ); // close row - - // write entry in type property table - sTypePropHTML.appendAscii ( "\t\t<a name=\"" ); // set target="#<typename>" to follow table - sTypePropHTML.append ( aItem.sName ); - sTypePropHTML.appendAscii ( "\"></a>" ); - sTypePropHTML.appendAscii ( "\t\t<table border=0>\n" ); // open table - sTypePropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Nr.</td><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\"> " ); // generate row "Nr <value>" - sTypePropHTML.append ( OUString::valueOf( nItem ) ); - sTypePropHTML.appendAscii ( "</td></tr>\n" ); - sTypePropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Name</td><td valign=\"top\" align=\"top\"> " ); // generate row "Name <value>" - sTypePropHTML.append ( aItem.sName ); - sTypePropHTML.appendAscii ( "</td></tr>\n" ); - sTypePropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">UIName</td><td valign=\"top\" align=\"top\">" ); // generate row "UIName <value>" - for( ConstStringHashIterator pUIName=aItem.lUINames.begin() ; - pUIName!=aItem.lUINames.end() ; - ++pUIName ) - { - sTypePropHTML.appendAscii ( " [" ); - sTypePropHTML.append ( pUIName->first ); - sTypePropHTML.appendAscii ( "] \"" ); - sTypePropHTML.append ( pUIName->second ); - sTypePropHTML.appendAscii ( "\"<br>" ); - } - sTypePropHTML.appendAscii ( "</td></tr>\n" ); - sTypePropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">MediaType</td><td valign=\"top\" align=\"top\"> " ); // generate row "MediaType <value>" - sTypePropHTML.append ( aItem.sMediaType ); - sTypePropHTML.appendAscii ( "</td></tr>\n" ); - sTypePropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">ClipboardFormat</td><td valign=\"top\" align=\"top\"> " ); // generate row "ClipboardFormat <value>" - sTypePropHTML.append ( aItem.sClipboardFormat ); - sTypePropHTML.appendAscii ( "</td></tr>\n" ); - sTypePropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">URLPattern</td><td valign=\"top\" align=\"top\">" ); // generate row "URLPattern <value>" - for( ConstStringListIterator pPattern=aItem.lURLPattern.begin() ; - pPattern!=aItem.lURLPattern.end() ; - ++pPattern ) - { - sTypePropHTML.appendAscii ( " \""); - sTypePropHTML.append ( *pPattern ); - sTypePropHTML.appendAscii ( "\"<br>" ); - } - sTypePropHTML.appendAscii ( "</td></tr>\n" ); - sTypePropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Extensions</td><td valign=\"top\" align=\"top\">" ); // generate row "Extensions <value>" - for( ConstStringListIterator pExtension=aItem.lExtensions.begin() ; - pExtension!=aItem.lExtensions.end() ; - ++pExtension ) - { - sTypePropHTML.appendAscii ( " \"" ); - sTypePropHTML.append ( *pExtension ); - sTypePropHTML.appendAscii ( "\"<br>" ); - } - sTypePropHTML.appendAscii ( "</td></tr>\n" ); - sTypePropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">DocumentIconID</td><td valign=\"top\" align=\"top\"> " ); // generate row "DocumentIconID <value>" - sTypePropHTML.append ( OUString::valueOf( aItem.nDocumentIconID ) ); - sTypePropHTML.appendAscii ( "</td></tr>\n" ); - sTypePropHTML.appendAscii ( "\t\t</table>\n" ); // close table - sTypePropHTML.appendAscii ( "\t\t<p>\n" ); // add space between this and following table - } - - sAllTypesHTML.appendAscii( "</table>\n" ); // close table - sAllTypesHTML.appendAscii( "</body>\n</html>\n" ); // close html - - sTypePropHTML.appendAscii( "</body>\n</html>\n" ); // close html - - impl_writeFile( ALLTYPES_HTML , U2B(sAllTypesHTML.makeStringAndClear()) ); - impl_writeFile( TYPEPROPERTIES_HTML , U2B(sTypePropHTML.makeStringAndClear()) ); -} - -//***************************************************************************************************************** -void CFGView::impl_generateFilterListHTML() -{ - //------------------------------------------------------------------------------------------------------------- - // generate frameset for types - OUStringBuffer sFiltersFramesetHTML( 10000 ); - - sFiltersFramesetHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFrameset: Filters\n\t\t</title>\n\t</head>\n" ); // open html - sFiltersFramesetHTML.appendAscii( "\t\t<frameset cols=\"40%,60%\">\n" ); // open frameset for cols - sFiltersFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "list" - sFiltersFramesetHTML.appendAscii( TARGET_LIST ); - sFiltersFramesetHTML.appendAscii( "\" src=\"" ); - sFiltersFramesetHTML.appendAscii( ALLFILTERS_HTML ); - sFiltersFramesetHTML.appendAscii( "\" title=\"List\">\n" ); - sFiltersFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "properties" - sFiltersFramesetHTML.appendAscii( TARGET_PROPERTIES ); - sFiltersFramesetHTML.appendAscii( "\" src=\"" ); - sFiltersFramesetHTML.appendAscii( FILTERPROPERTIES_HTML ); - sFiltersFramesetHTML.appendAscii( "\" title=\"Properties\">\n" ); - sFiltersFramesetHTML.appendAscii( "\t\t</frameset>\n" ); // close frameset cols - sFiltersFramesetHTML.appendAscii( "</html>\n" ); // close html - - impl_writeFile( FRAMESET_FILTERS_HTML, U2B(sFiltersFramesetHTML.makeStringAndClear()) ); - - //------------------------------------------------------------------------------------------------------------- - // generate filter list (names and links only!) - // use same loop to generate filter property list! - OUStringBuffer sAllFiltersHTML( 10000 ); - OUStringBuffer sFilterPropHTML( 10000 ); - - sAllFiltersHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tAll Filters\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - sAllFiltersHTML.appendAscii( "\t\t<table border=0><tr><td bgcolor=#ff8040><strong>Nr.</strong></td><td bgcolor=#ff8040><strong>Filter</strong></td></tr>\n" ); // open table - - sFilterPropHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFilterProperties\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - css::uno::Sequence< ::rtl::OUString > lNames = m_aData.pCache->getAllFilterNames() ; - sal_Int32 nFilterCounter = 0 ; - sal_Int32 nCount = lNames.getLength() ; - Filter aFilter ; - for( nFilterCounter=0; nFilterCounter<nCount; ++nFilterCounter ) - { - aFilter = m_aData.pCache->getFilter( lNames[nFilterCounter] ); - - // write entry in filter list table - sAllFiltersHTML.appendAscii ( "\t\t\t<tr>\n" ); // open row - sAllFiltersHTML.appendAscii ( "\t\t\t\t<td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">" ); // open column "nr" - sAllFiltersHTML.append ( OUString::valueOf( nFilterCounter ) ); // write nr - sAllFiltersHTML.appendAscii ( "</td>\n" ); // close column "nr" - sAllFiltersHTML.appendAscii ( "\t\t\t\t<td>" ); // open column "name" - sAllFiltersHTML.appendAscii ( "<a href=\"" ); // open href="filterproperties.html#<filtername>" - sAllFiltersHTML.appendAscii ( FILTERPROPERTIES_HTML ); - sAllFiltersHTML.appendAscii ( "#" ); - sAllFiltersHTML.append ( aFilter.sName ); - sAllFiltersHTML.appendAscii ( "\" target=\"" ); - sAllFiltersHTML.appendAscii ( TARGET_PROPERTIES ); - sAllFiltersHTML.appendAscii ( "\">" ); - sAllFiltersHTML.append ( aFilter.sName ); // write name - sAllFiltersHTML.appendAscii ( "</a>" ); // close href - sAllFiltersHTML.appendAscii ( "</td>\n" ); // close column "name" - sAllFiltersHTML.appendAscii ( "\t\t\t</tr>\n" ); // close row - - // write entry in filter property table - sFilterPropHTML.appendAscii ( "\t\t<a name=\"" ); // set target="#<typename>" to follow table - sFilterPropHTML.append ( aFilter.sName ); - sFilterPropHTML.appendAscii ( "\"></a>" ); - sFilterPropHTML.appendAscii ( "\t\t<table border=0>\n" ); // open table - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Nr.</td><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\"> "); // generate row "Nr <value>" - sFilterPropHTML.append ( OUString::valueOf( nFilterCounter ) ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Name</td><td valign=\"top\" align=\"top\"> " ); // generate row "Name <value>" - sFilterPropHTML.append ( aFilter.sName ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Order</td><td valign=\"top\" align=\"top\"> \"" ); // generate row "Order <value>" - sFilterPropHTML.append ( aFilter.nOrder ); - sFilterPropHTML.appendAscii ( "\"</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Type</td><td valign=\"top\" align=\"top\"> \"" ); // generate row "Type <value>" - sFilterPropHTML.append ( aFilter.sType ); - sFilterPropHTML.appendAscii ( "\"</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">UIName</td><td valign=\"top\" align=\"top\">" ); // generate row "UIName <value>" - for( ConstStringHashIterator pUIName=aFilter.lUINames.begin() ; - pUIName!=aFilter.lUINames.end() ; - ++pUIName ) - { - sFilterPropHTML.appendAscii ( " [" ); - sFilterPropHTML.append ( pUIName->first ); - sFilterPropHTML.appendAscii ( "] \"" ); - sFilterPropHTML.append ( pUIName->second ); - sFilterPropHTML.appendAscii ( "\"<br>" ); - } - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">DocumentService</td><td valign=\"top\" align=\"top\"> " ); // generate row "DocumentService <value>" - sFilterPropHTML.append ( aFilter.sDocumentService ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">FilterService</td><td valign=\"top\" align=\"top\"> " ); // generate row "FilterService <value>" - sFilterPropHTML.append ( aFilter.sFilterService ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Flags</td><td valign=\"top\" align=\"top\"> " ); // generate row "Flags <value>" - if( aFilter.nFlags & FILTERFLAG_IMPORT ) { sFilterPropHTML.append( FILTERFLAGNAME_IMPORT ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_EXPORT ) { sFilterPropHTML.append( FILTERFLAGNAME_EXPORT ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_TEMPLATE ) { sFilterPropHTML.append( FILTERFLAGNAME_TEMPLATE ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_INTERNAL ) { sFilterPropHTML.append( FILTERFLAGNAME_INTERNAL ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_TEMPLATEPATH ) { sFilterPropHTML.append( FILTERFLAGNAME_TEMPLATEPATH ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_OWN ) { sFilterPropHTML.append( FILTERFLAGNAME_OWN ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_ALIEN ) { sFilterPropHTML.append( FILTERFLAGNAME_ALIEN ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_USESOPTIONS ) { sFilterPropHTML.append( FILTERFLAGNAME_USESOPTIONS ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_DEFAULT ) { sFilterPropHTML.append( FILTERFLAGNAME_DEFAULT ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_NOTINFILEDIALOG ) { sFilterPropHTML.append( FILTERFLAGNAME_NOTINFILEDIALOG ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_NOTINCHOOSER ) { sFilterPropHTML.append( FILTERFLAGNAME_NOTINCHOOSER ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_ASYNCHRON ) { sFilterPropHTML.append( FILTERFLAGNAME_ASYNCHRON ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_READONLY ) { sFilterPropHTML.append( FILTERFLAGNAME_READONLY ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_NOTINSTALLED ) { sFilterPropHTML.append( FILTERFLAGNAME_NOTINSTALLED ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_CONSULTSERVICE ) { sFilterPropHTML.append( FILTERFLAGNAME_CONSULTSERVICE ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_3RDPARTYFILTER ) { sFilterPropHTML.append( FILTERFLAGNAME_3RDPARTYFILTER ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_PACKED ) { sFilterPropHTML.append( FILTERFLAGNAME_PACKED ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_SILENTEXPORT ) { sFilterPropHTML.append( FILTERFLAGNAME_SILENTEXPORT ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_BROWSERPREFERED ) { sFilterPropHTML.append( FILTERFLAGNAME_BROWSERPREFERED ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_PREFERED ) { sFilterPropHTML.append( FILTERFLAGNAME_PREFERED ); sFilterPropHTML.appendAscii( "<br> " ); }; - - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">UserData</td><td valign=\"top\" align=\"top\">" ); // generate row "UserData <value>" - for( ConstStringListIterator pUserData=aFilter.lUserData.begin() ; - pUserData!=aFilter.lUserData.end() ; - ++pUserData ) - { - sFilterPropHTML.appendAscii ( " \"" ); - sFilterPropHTML.append ( *pUserData ); - sFilterPropHTML.appendAscii ( "\"<br>" ); - } - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">FileFormatVersion</td><td valign=\"top\" align=\"top\"> "); // generate row "FileFormatVersion <value>" - sFilterPropHTML.append ( OUString::valueOf( aFilter.nFileFormatVersion ) ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">TemplateName</td><td valign=\"top\" align=\"top\"> " ); // generate row "TemplateName <value>" - sFilterPropHTML.append ( aFilter.sTemplateName ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t</table>\n" ); // close table - sFilterPropHTML.appendAscii ( "\t\t<p>\n" ); // add space between this and following table - } - - sAllFiltersHTML.appendAscii( "</table>\n" ); // close table - sAllFiltersHTML.appendAscii( "</body>\n</html>\n" ); // close html - - sFilterPropHTML.appendAscii( "</body>\n</html>\n" ); // close html - - impl_writeFile( ALLFILTERS_HTML , U2B(sAllFiltersHTML.makeStringAndClear()) ); - impl_writeFile( FILTERPROPERTIES_HTML, U2B(sFilterPropHTML.makeStringAndClear()) ); -} - -//***************************************************************************************************************** -void CFGView::impl_generateFilterModulListHTML() -{ - //------------------------------------------------------------------------------------------------------------- - // generate frameset for filters sorted by modules - OUStringBuffer sFiltersFramesetHTML( 10000 ); - - sFiltersFramesetHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFrameset: Filters sorted by modules\n\t\t</title>\n\t</head>\n" ); // open html - sFiltersFramesetHTML.appendAscii( "\t\t<frameset cols=\"40%,60%\">\n" ); // open frameset for cols - sFiltersFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "list" - sFiltersFramesetHTML.appendAscii( TARGET_LIST ); - sFiltersFramesetHTML.appendAscii( "\" src=\"" ); - sFiltersFramesetHTML.appendAscii( MODULFILTERS_HTML ); - sFiltersFramesetHTML.appendAscii( "\" title=\"List\">\n" ); - sFiltersFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "properties" - sFiltersFramesetHTML.appendAscii( TARGET_PROPERTIES ); - sFiltersFramesetHTML.appendAscii( "\" src=\"" ); - sFiltersFramesetHTML.appendAscii( FILTERPROPERTIES_HTML ); - sFiltersFramesetHTML.appendAscii( "\" title=\"Properties\">\n" ); - sFiltersFramesetHTML.appendAscii( "\t\t</frameset>\n" ); // close frameset cols - sFiltersFramesetHTML.appendAscii( "</html>\n" ); // close html - - impl_writeFile( FRAMESET_FILTERS_HTML, U2B(sFiltersFramesetHTML.makeStringAndClear()) ); - - //------------------------------------------------------------------------------------------------------------- - // generate filter list (names and links only!) - // use same loop to generate filter property list! - OUStringBuffer sAllFiltersHTML( 10000 ); - OUStringBuffer sFilterPropHTML( 10000 ); - - sAllFiltersHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tAll Filters\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - sAllFiltersHTML.appendAscii( "\t\t<table border=0><tr><td bgcolor=#ff8040><strong>Nr.</strong></td><td bgcolor=#ff8040><strong>Filter</strong></td></tr>\n" ); // open table - - sFilterPropHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFilterProperties\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - - css::uno::Sequence< ::rtl::OUString > lWriter ; - css::uno::Sequence< ::rtl::OUString > lWeb ; - css::uno::Sequence< ::rtl::OUString > lGlobal ; - css::uno::Sequence< ::rtl::OUString > lChart ; - css::uno::Sequence< ::rtl::OUString > lCalc ; - css::uno::Sequence< ::rtl::OUString > lImpress; - css::uno::Sequence< ::rtl::OUString > lDraw ; - css::uno::Sequence< ::rtl::OUString > lMath ; - css::uno::Sequence< ::rtl::OUString > lGraphic; - css::uno::Sequence< ::rtl::OUString > lDefault; - css::uno::Sequence< ::rtl::OUString > lNames ; - - m_aData.pCache->queryFilters( FILTERQUERY_TEXTDOCUMENT_WITHDEFAULT ) >>= lWriter ; - m_aData.pCache->queryFilters( FILTERQUERY_WEBDOCUMENT_WITHDEFAULT ) >>= lWeb ; - m_aData.pCache->queryFilters( FILTERQUERY_GLOBALDOCUMENT_WITHDEFAULT ) >>= lGlobal ; - m_aData.pCache->queryFilters( FILTERQUERY_CHARTDOCUMENT_WITHDEFAULT ) >>= lChart ; - m_aData.pCache->queryFilters( FILTERQUERY_SPREADSHEETDOCUMENT_WITHDEFAULT ) >>= lCalc ; - m_aData.pCache->queryFilters( FILTERQUERY_PRESENTATIONDOCUMENT_WITHDEFAULT) >>= lImpress ; - m_aData.pCache->queryFilters( FILTERQUERY_DRAWINGDOCUMENT_WITHDEFAULT ) >>= lDraw ; - m_aData.pCache->queryFilters( FILTERQUERY_FORMULARPROPERTIES_WITHDEFAULT ) >>= lMath ; - m_aData.pCache->queryFilters( FILTERQUERY_GRAPHICFILTERS ) >>= lGraphic ; - m_aData.pCache->queryFilters( FILTERQUERY_DEFAULTFILTERS ) >>= lDefault ; - - sal_Int32 nModuls = 0; - sal_Int32 nFilters = 0; - sal_Int32 nModulCount = 0; - sal_Int32 nFilterCount = 0; - Filter aFilter ; - ::rtl::OString sModul ; - - for( nModuls=0; nModuls<nModulCount; ++nModuls ) - { - switch( nModuls ) - { - case 0: { - lNames = lWriter; - sModul = "Writer"; - } - break; - case 1: { - lNames = lWeb ; - sModul = "Web"; - } - break; - case 2: { - lNames = lGlobal ; - sModul = "GlobalDokument"; - } - break; - case 3: { - lNames = lChart ; - sModul = "Chart"; - } - break; - case 4: { - lNames = lCalc ; - sModul = "Calc"; - } - break; - case 5: { - lNames = lImpress; - sModul = "Impress"; - } - break; - case 6: { - lNames = lDraw ; - sModul = "Draw"; - } - break; - case 7: { - lNames = lMath ; - sModul = "Math"; - } - break; - case 8: { - lNames = lGraphic; - sModul = "Graphic"; - } - break; - case 9: { - lNames = lDefault; - sModul = "Default Filter!"; - } - break; - } - - sAllFiltersHTML.appendAscii ( "\t\t\t<tr>\n" ); - sAllFiltersHTML.appendAscii ( "\t\t\t\t<td bgcolor=#000000 fgcolor=#ffffff valign=\"top\" align=\"top\">-</td>\n" ); - sAllFiltersHTML.appendAscii ( "\t\t\t\t<td bgcolor=#000000 fgcolor=#ffffff valign=\"top\" align=\"top\">" ); - sAllFiltersHTML.appendAscii ( sModul ); - sAllFiltersHTML.appendAscii ( "</td>\n" ); - sAllFiltersHTML.appendAscii ( "\t\t\t</tr>\n" ); - - nFilterCount = lNames.getLength(); - - for( nFilters=0; nFilters<nFilterCount; ++nFilters ) - { - aFilter = m_aData.pCache->getFilter( lNames[nFilters] ); - - // write entry in filter list table - sAllFiltersHTML.appendAscii ( "\t\t\t<tr>\n" ); // open row - sAllFiltersHTML.appendAscii ( "\t\t\t\t<td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">" ); // open column "nr" - sAllFiltersHTML.append ( OUString::valueOf( nFilters ) ); // write nr - sAllFiltersHTML.appendAscii ( "</td>\n" ); // close column "nr" - sAllFiltersHTML.appendAscii ( "\t\t\t\t<td>" ); // open column "name" - sAllFiltersHTML.appendAscii ( "<a href=\"" ); // open href="filterproperties.html#<filtername>" - sAllFiltersHTML.appendAscii ( FILTERPROPERTIES_HTML ); - sAllFiltersHTML.appendAscii ( "#" ); - sAllFiltersHTML.append ( aFilter.sName ); - sAllFiltersHTML.appendAscii ( "\" target=\"" ); - sAllFiltersHTML.appendAscii ( TARGET_PROPERTIES ); - sAllFiltersHTML.appendAscii ( "\">" ); - sAllFiltersHTML.append ( aFilter.sName ); // write name - sAllFiltersHTML.appendAscii ( "</a>" ); // close href - sAllFiltersHTML.appendAscii ( "</td>\n" ); // close column "name" - sAllFiltersHTML.appendAscii ( "\t\t\t</tr>\n" ); // close row - - // write entry in filter property table - sFilterPropHTML.appendAscii ( "\t\t<a name=\"" ); // set target="#<typename>" to follow table - sFilterPropHTML.append ( aFilter.sName ); - sFilterPropHTML.appendAscii ( "\"></a>" ); - sFilterPropHTML.appendAscii ( "\t\t<table border=0>\n" ); // open table - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Nr.</td><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\"> "); // generate row "Nr <value>" - sFilterPropHTML.append ( OUString::valueOf( nFilters ) ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Name</td><td valign=\"top\" align=\"top\"> " ); // generate row "Name <value>" - sFilterPropHTML.append ( aFilter.sName ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Order</td><td valign=\"top\" align=\"top\"> \"" ); // generate row "Order <value>" - sFilterPropHTML.append ( aFilter.nOrder ); - sFilterPropHTML.appendAscii ( "\"</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Type</td><td valign=\"top\" align=\"top\"> \"" ); // generate row "Type <value>" - sFilterPropHTML.append ( aFilter.sType ); - sFilterPropHTML.appendAscii ( "\"</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">UIName</td><td valign=\"top\" align=\"top\">" ); // generate row "UIName <value>" - for( ConstStringHashIterator pUIName=aFilter.lUINames.begin() ; - pUIName!=aFilter.lUINames.end() ; - ++pUIName ) - { - sFilterPropHTML.appendAscii ( " [" ); - sFilterPropHTML.append ( pUIName->first ); - sFilterPropHTML.appendAscii ( "] \"" ); - sFilterPropHTML.append ( pUIName->second ); - sFilterPropHTML.appendAscii ( "\"<br>" ); - } - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">DocumentService</td><td valign=\"top\" align=\"top\"> " ); // generate row "DocumentService <value>" - sFilterPropHTML.append ( aFilter.sDocumentService ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">FilterService</td><td valign=\"top\" align=\"top\"> " ); // generate row "FilterService <value>" - sFilterPropHTML.append ( aFilter.sFilterService ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Flags</td><td valign=\"top\" align=\"top\"> " ); // generate row "Flags <value>" - if( aFilter.nFlags & FILTERFLAG_IMPORT ) { sFilterPropHTML.append( FILTERFLAGNAME_IMPORT ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_EXPORT ) { sFilterPropHTML.append( FILTERFLAGNAME_EXPORT ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_TEMPLATE ) { sFilterPropHTML.append( FILTERFLAGNAME_TEMPLATE ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_INTERNAL ) { sFilterPropHTML.append( FILTERFLAGNAME_INTERNAL ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_TEMPLATEPATH ) { sFilterPropHTML.append( FILTERFLAGNAME_TEMPLATEPATH ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_OWN ) { sFilterPropHTML.append( FILTERFLAGNAME_OWN ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_ALIEN ) { sFilterPropHTML.append( FILTERFLAGNAME_ALIEN ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_USESOPTIONS ) { sFilterPropHTML.append( FILTERFLAGNAME_USESOPTIONS ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_DEFAULT ) { sFilterPropHTML.append( FILTERFLAGNAME_DEFAULT ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_NOTINFILEDIALOG ) { sFilterPropHTML.append( FILTERFLAGNAME_NOTINFILEDIALOG ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_NOTINCHOOSER ) { sFilterPropHTML.append( FILTERFLAGNAME_NOTINCHOOSER ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_ASYNCHRON ) { sFilterPropHTML.append( FILTERFLAGNAME_ASYNCHRON ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_READONLY ) { sFilterPropHTML.append( FILTERFLAGNAME_READONLY ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_NOTINSTALLED ) { sFilterPropHTML.append( FILTERFLAGNAME_NOTINSTALLED ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_CONSULTSERVICE ) { sFilterPropHTML.append( FILTERFLAGNAME_CONSULTSERVICE ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_3RDPARTYFILTER ) { sFilterPropHTML.append( FILTERFLAGNAME_3RDPARTYFILTER ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_PACKED ) { sFilterPropHTML.append( FILTERFLAGNAME_PACKED ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_SILENTEXPORT ) { sFilterPropHTML.append( FILTERFLAGNAME_SILENTEXPORT ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_BROWSERPREFERED ) { sFilterPropHTML.append( FILTERFLAGNAME_BROWSERPREFERED ); sFilterPropHTML.appendAscii( "<br> " ); }; - if( aFilter.nFlags & FILTERFLAG_PREFERED ) { sFilterPropHTML.append( FILTERFLAGNAME_PREFERED ); sFilterPropHTML.appendAscii( "<br> " ); }; - - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">UserData</td><td valign=\"top\" align=\"top\">" ); // generate row "UserData <value>" - for( ConstStringListIterator pUserData=aFilter.lUserData.begin() ; - pUserData!=aFilter.lUserData.end() ; - ++pUserData ) - { - sFilterPropHTML.appendAscii ( " \"" ); - sFilterPropHTML.append ( *pUserData ); - sFilterPropHTML.appendAscii ( "\"<br>" ); - } - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">FileFormatVersion</td><td valign=\"top\" align=\"top\"> "); // generate row "FileFormatVersion <value>" - sFilterPropHTML.append ( OUString::valueOf( aFilter.nFileFormatVersion ) ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">TemplateName</td><td valign=\"top\" align=\"top\"> " ); // generate row "TemplateName <value>" - sFilterPropHTML.append ( aFilter.sTemplateName ); - sFilterPropHTML.appendAscii ( "</td></tr>\n" ); - sFilterPropHTML.appendAscii ( "\t\t</table>\n" ); // close table - sFilterPropHTML.appendAscii ( "\t\t<p>\n" ); // add space between this and following table - } - } - - sAllFiltersHTML.appendAscii( "</table>\n" ); // close table - sAllFiltersHTML.appendAscii( "</body>\n</html>\n" ); // close html - - sFilterPropHTML.appendAscii( "</body>\n</html>\n" ); // close html - - impl_writeFile( ALLFILTERS_HTML , U2B(sAllFiltersHTML.makeStringAndClear()) ); - impl_writeFile( FILTERPROPERTIES_HTML, U2B(sFilterPropHTML.makeStringAndClear()) ); -} - -//***************************************************************************************************************** -void CFGView::impl_generateDetectorListHTML() -{ - //------------------------------------------------------------------------------------------------------------- - // generate frameset for detector services - OUStringBuffer sDetectorsFramesetHTML( 10000 ); - - sDetectorsFramesetHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFrameset: Detector Services\n\t\t</title>\n\t</head>\n" ); // open html - sDetectorsFramesetHTML.appendAscii( "\t\t<frameset cols=\"40%,60%\">\n" ); // open frameset for cols - sDetectorsFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "list" - sDetectorsFramesetHTML.appendAscii( TARGET_LIST ); - sDetectorsFramesetHTML.appendAscii( "\" src=\"" ); - sDetectorsFramesetHTML.appendAscii( ALLDETECTORS_HTML ); - sDetectorsFramesetHTML.appendAscii( "\" title=\"List\">\n" ); - sDetectorsFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "properties" - sDetectorsFramesetHTML.appendAscii( TARGET_PROPERTIES ); - sDetectorsFramesetHTML.appendAscii( "\" src=\"" ); - sDetectorsFramesetHTML.appendAscii( DETECTORPROPERTIES_HTML ); - sDetectorsFramesetHTML.appendAscii( "\" title=\"Properties\">\n" ); - sDetectorsFramesetHTML.appendAscii( "\t\t</frameset>\n" ); // close frameset cols - sDetectorsFramesetHTML.appendAscii( "</html>\n" ); // close html - - impl_writeFile( FRAMESET_DETECTORS_HTML, U2B(sDetectorsFramesetHTML.makeStringAndClear()) ); - - //------------------------------------------------------------------------------------------------------------- - // generate detector list (names and links only!) - // use same loop to generate detector property list! - OUStringBuffer sAllDetectorsHTML( 10000 ); - OUStringBuffer sDetectorPropHTML( 10000 ); - - sAllDetectorsHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tAll Detectors\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - sAllDetectorsHTML.appendAscii( "\t\t<table border=0><tr><td bgcolor=#ff8040><strong>Nr.</strong></td><td bgcolor=#ff8040><strong>Detector</strong></td></tr>\n" ); // open table - - sDetectorPropHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tDetectorProperties\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - - css::uno::Sequence< ::rtl::OUString > lNames = m_aData.pCache->getAllDetectorNames(); - sal_Int32 nCount = lNames.getLength() ; - for( sal_Int32 nItem=0; nItem<nCount; ++nItem ) - { - Detector aDetector = m_aData.pCache->getDetector( lNames[nItem] ); - - // write entry in detector list table - sAllDetectorsHTML.appendAscii ( "\t\t\t<tr>\n" ); // open row - sAllDetectorsHTML.appendAscii ( "\t\t\t\t<td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">" ); // open column "nr" - sAllDetectorsHTML.append ( OUString::valueOf( nItem ) ); // write nr - sAllDetectorsHTML.appendAscii ( "</td>\n" ); // close column "nr" - sAllDetectorsHTML.appendAscii ( "\t\t\t\t<td>" ); // open column "name" - sAllDetectorsHTML.appendAscii ( "<a href=\"" ); // open href="detectorproperties.html#<detectorname>" - sAllDetectorsHTML.appendAscii ( DETECTORPROPERTIES_HTML ); - sAllDetectorsHTML.appendAscii ( "#" ); - sAllDetectorsHTML.append ( aDetector.sName ); - sAllDetectorsHTML.appendAscii ( "\" target=\"" ); - sAllDetectorsHTML.appendAscii ( TARGET_PROPERTIES ); - sAllDetectorsHTML.appendAscii ( "\">" ); - sAllDetectorsHTML.append ( aDetector.sName ); // write name - sAllDetectorsHTML.appendAscii ( "</a>" ); // close href - sAllDetectorsHTML.appendAscii ( "</td>\n" ); // close column "name" - sAllDetectorsHTML.appendAscii ( "\t\t\t</tr>\n" ); // close row - - // write entry in detector property table - sDetectorPropHTML.appendAscii ( "\t\t<a name=\"" ); // set target="#<detectorname>" to follow table - sDetectorPropHTML.append ( aDetector.sName ); - sDetectorPropHTML.appendAscii ( "\"></a>" ); - sDetectorPropHTML.appendAscii ( "\t\t<table border=0>\n" ); // open table - sDetectorPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Nr.</td><td valign=\"top\" align=\"top\"> " ); // generate row "Nr <value>" - sDetectorPropHTML.append ( OUString::valueOf( nItem ) ); - sDetectorPropHTML.appendAscii ( "</td></tr>\n" ); - sDetectorPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Name</td><td valign=\"top\" align=\"top\"> " ); // generate row "Name <value>" - sDetectorPropHTML.append ( aDetector.sName ); - sDetectorPropHTML.appendAscii ( "</td></tr>\n" ); - sDetectorPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Types</td><td valign=\"top\" align=\"top\">" ); // generate row "Types <value>" - for( ConstStringListIterator pType=aDetector.lTypes.begin() ; - pType!=aDetector.lTypes.end() ; - ++pType ) - { - sDetectorPropHTML.appendAscii ( " \""); - sDetectorPropHTML.append ( *pType ); - sDetectorPropHTML.appendAscii ( "\"<br>" ); - } - - sDetectorPropHTML.appendAscii ( "\t\t</table>\n" ); // close table - sDetectorPropHTML.appendAscii ( "\t\t<p>\n" ); // add space between this and following table - } - - sAllDetectorsHTML.appendAscii( "</table>\n" ); // close table - sAllDetectorsHTML.appendAscii( "</body>\n</html>\n" ); // close html - - sDetectorPropHTML.appendAscii( "</body>\n</html>\n" ); // close html - - impl_writeFile( ALLDETECTORS_HTML , U2B(sAllDetectorsHTML.makeStringAndClear()) ); - impl_writeFile( DETECTORPROPERTIES_HTML , U2B(sDetectorPropHTML.makeStringAndClear()) ); -} - -//***************************************************************************************************************** -void CFGView::impl_generateLoaderListHTML() -{ - //------------------------------------------------------------------------------------------------------------- - // generate frameset for loader services - OUStringBuffer sLoadersFramesetHTML( 10000 ); - - sLoadersFramesetHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFrameset: Loader Services\n\t\t</title>\n\t</head>\n" ); // open html - sLoadersFramesetHTML.appendAscii( "\t\t<frameset cols=\"40%,60%\">\n" ); // open frameset for cols - sLoadersFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "list" - sLoadersFramesetHTML.appendAscii( TARGET_LIST ); - sLoadersFramesetHTML.appendAscii( "\" src=\"" ); - sLoadersFramesetHTML.appendAscii( ALLLOADERS_HTML ); - sLoadersFramesetHTML.appendAscii( "\" title=\"List\">\n" ); - sLoadersFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "properties" - sLoadersFramesetHTML.appendAscii( TARGET_PROPERTIES ); - sLoadersFramesetHTML.appendAscii( "\" src=\"" ); - sLoadersFramesetHTML.appendAscii( LOADERPROPERTIES_HTML ); - sLoadersFramesetHTML.appendAscii( "\" title=\"Properties\">\n" ); - sLoadersFramesetHTML.appendAscii( "\t\t</frameset>\n" ); // close frameset cols - sLoadersFramesetHTML.appendAscii( "</html>\n" ); // close html - - impl_writeFile( FRAMESET_LOADERS_HTML, U2B(sLoadersFramesetHTML.makeStringAndClear()) ); - - //------------------------------------------------------------------------------------------------------------- - // generate loader list (names and links only!) - // use same loop to generate loader property list! - OUStringBuffer sAllLoadersHTML( 10000 ); - OUStringBuffer sLoaderPropHTML( 10000 ); - - sAllLoadersHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tAll Loaders\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - sAllLoadersHTML.appendAscii( "\t\t<table border=0><tr><td bgcolor=#ff8040><strong>Nr.</strong></td><td bgcolor=#ff8040><strong>Loader</strong></td></tr>\n" ); // open table - - sLoaderPropHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tLoaderProperties\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - - css::uno::Sequence< ::rtl::OUString > lNames = m_aData.pCache->getAllLoaderNames(); - sal_Int32 nCount = lNames.getLength() ; - for( sal_Int32 nItem=0; nItem<nCount; ++nItem ) - { - Loader aLoader = m_aData.pCache->getLoader( lNames[nItem] ); - - // write entry in loader list table - sAllLoadersHTML.appendAscii ( "\t\t\t<tr>\n" ); // open row - sAllLoadersHTML.appendAscii ( "\t\t\t\t<td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">" ); // open column "nr" - sAllLoadersHTML.append ( OUString::valueOf( nItem ) ); // write nr - sAllLoadersHTML.appendAscii ( "</td>\n" ); // close column "nr" - sAllLoadersHTML.appendAscii ( "\t\t\t\t<td>" ); // open column "name" - sAllLoadersHTML.appendAscii ( "<a href=\"" ); // open href="loaderproperties.html#<loadername>" - sAllLoadersHTML.appendAscii ( LOADERPROPERTIES_HTML ); - sAllLoadersHTML.appendAscii ( "#" ); - sAllLoadersHTML.append ( aLoader.sName ); - sAllLoadersHTML.appendAscii ( "\" target=\"" ); - sAllLoadersHTML.appendAscii ( TARGET_PROPERTIES ); - sAllLoadersHTML.appendAscii ( "\">" ); - sAllLoadersHTML.append ( aLoader.sName ); // write name - sAllLoadersHTML.appendAscii ( "</a>" ); // close href - sAllLoadersHTML.appendAscii ( "</td>\n" ); // close column "name" - sAllLoadersHTML.appendAscii ( "\t\t\t</tr>\n" ); // close row - - // write entry in loader property table - sLoaderPropHTML.appendAscii ( "\t\t<a name=\"" ); // set target="#<loadername>" to follow table - sLoaderPropHTML.append ( aLoader.sName ); - sLoaderPropHTML.appendAscii ( "\"></a>" ); - sLoaderPropHTML.appendAscii ( "\t\t<table border=0>\n" ); // open table - sLoaderPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Nr.</td><td valign=\"top\" align=\"top\"> " ); // generate row "Nr <value>" - sLoaderPropHTML.append ( OUString::valueOf( nItem ) ); - sLoaderPropHTML.appendAscii ( "</td></tr>\n" ); - sLoaderPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Name</td><td valign=\"top\" align=\"top\"> " ); // generate row "Name <value>" - sLoaderPropHTML.append ( aLoader.sName ); - sLoaderPropHTML.appendAscii ( "</td></tr>\n" ); - sLoaderPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">UIName</td><td valign=\"top\" align=\"top\">" ); // generate row "UIName <value>" - for( ConstStringHashIterator pUIName=aLoader.lUINames.begin() ; - pUIName!=aLoader.lUINames.end() ; - ++pUIName ) - { - sLoaderPropHTML.appendAscii ( " [" ); - sLoaderPropHTML.append ( pUIName->first ); - sLoaderPropHTML.appendAscii ( "] \"" ); - sLoaderPropHTML.append ( pUIName->second ); - sLoaderPropHTML.appendAscii ( "\"<br>" ); - } - sLoaderPropHTML.appendAscii ( "</td></tr>\n" ); - sLoaderPropHTML.appendAscii ( "\t\t\t<tr><td bgcolor=#f5f9d5 valign=\"top\" align=\"top\">Types</td><td valign=\"top\" align=\"top\">" ); // generate row "Types <value>" - for( ConstStringListIterator pType=aLoader.lTypes.begin() ; - pType!=aLoader.lTypes.end() ; - ++pType ) - { - sLoaderPropHTML.appendAscii ( " \""); - sLoaderPropHTML.append ( *pType ); - sLoaderPropHTML.appendAscii ( "\"<br>" ); - } - - sLoaderPropHTML.appendAscii ( "\t\t</table>\n" ); // close table - sLoaderPropHTML.appendAscii ( "\t\t<p>\n" ); // add space between this and following table - } - - sAllLoadersHTML.appendAscii( "</table>\n" ); // close table - sAllLoadersHTML.appendAscii( "</body>\n</html>\n" ); // close html - - sLoaderPropHTML.appendAscii( "</body>\n</html>\n" ); // close html - - impl_writeFile( ALLLOADERS_HTML , U2B(sAllLoadersHTML.makeStringAndClear()) ); - impl_writeFile( LOADERPROPERTIES_HTML, U2B(sLoaderPropHTML.makeStringAndClear()) ); -} - -//***************************************************************************************************************** -void CFGView::impl_generateInvalidFiltersHTML() -{ - //------------------------------------------------------------------------------------------------------------- - // generate frameset for invalid filters - OUStringBuffer sInvalidFiltersFramesetHTML( 10000 ); - - sInvalidFiltersFramesetHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFrameset: Invalid Filters\n\t\t</title>\n\t</head>\n" ); // open html - sInvalidFiltersFramesetHTML.appendAscii( "\t\t<frameset cols=\"40%,60%\">\n" ); // open frameset for cols - sInvalidFiltersFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "list" - sInvalidFiltersFramesetHTML.appendAscii( TARGET_LIST ); - sInvalidFiltersFramesetHTML.appendAscii( "\" src=\"" ); - sInvalidFiltersFramesetHTML.appendAscii( INVALIDFILTERS_HTML ); - sInvalidFiltersFramesetHTML.appendAscii( "\" title=\"List\">\n" ); - sInvalidFiltersFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "properties" - sInvalidFiltersFramesetHTML.appendAscii( TARGET_PROPERTIES ); - sInvalidFiltersFramesetHTML.appendAscii( "\" src=\"" ); - sInvalidFiltersFramesetHTML.appendAscii( FILTERPROPERTIES_HTML ); - sInvalidFiltersFramesetHTML.appendAscii( "\" title=\"Properties\">\n" ); - sInvalidFiltersFramesetHTML.appendAscii( "\t\t</frameset>\n" ); // close frameset cols - sInvalidFiltersFramesetHTML.appendAscii( "</html>\n" ); // close html - - impl_writeFile( FRAMESET_INVALIDFILTERS_HTML, U2B(sInvalidFiltersFramesetHTML.makeStringAndClear()) ); - - //------------------------------------------------------------------------------------------------------------- - // Search invalid registered filters! - OUStringBuffer sInvalidFilterHTML( 10000 ); - - sInvalidFilterHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tInvalid Filter\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - sInvalidFilterHTML.appendAscii( "\t\tPlease check follow filter entries in configuration. They are registered for invalid types!<p>\n" ); // write "Note" - sInvalidFilterHTML.appendAscii( "\t\t<table border=0>\n" ); // open table - sInvalidFilterHTML.appendAscii( "\t<tr><td bgcolor=#ff8040><strong>Nr.</strong></td><td bgcolor=#ff8040><strong>Filter</strong></td><td bgcolor=#ff8040><strong>Wrong Type</strong></td></tr>\n" ); // generate table header - - css::uno::Sequence< ::rtl::OUString > lFilters = m_aData.pCache->getAllFilterNames(); - sal_Int32 nFilterCount = lFilters.getLength() ; - css::uno::Sequence< ::rtl::OUString > lTypes = m_aData.pCache->getAllTypeNames() ; - sal_Int32 nTypeCount = lTypes.getLength() ; - FileType aType ; - Filter aFilter; - for( sal_Int32 nFilter=0; nFilter<nFilterCount; ++nFilter ) - { - aFilter = m_aData.pCache->getFilter( lFilters[nFilter] ); - sal_Bool bFound = sal_False; - for( sal_Int32 nType=0; nType<nTypeCount; ++nType ) - { - aType = m_aData.pCache->getType( lTypes[nType] ); - if( aFilter.sType == aType.sName ) - { - bFound = sal_True; - break; - } - } - if( bFound == sal_False ) - { - sInvalidFilterHTML.appendAscii ( "\t<tr><td bgcolor=#ff0000 color=#00ffff>" ); // generate row for invalid filter entry - sInvalidFilterHTML.append ( OUString::valueOf( nFilter ) ); - sInvalidFilterHTML.appendAscii ( "</td><td><a href=\"" ); - sInvalidFilterHTML.appendAscii ( FILTERPROPERTIES_HTML ); - sInvalidFilterHTML.appendAscii ( "#" ); - sInvalidFilterHTML.append ( aFilter.sName ); - sInvalidFilterHTML.appendAscii ( "\" target=\"" ); - sInvalidFilterHTML.appendAscii ( TARGET_PROPERTIES ); - sInvalidFilterHTML.appendAscii ( "\">" ); - sInvalidFilterHTML.append ( aFilter.sName ); - sInvalidFilterHTML.appendAscii ( "\"</a></td><td>\"" ); - sInvalidFilterHTML.append ( aFilter.sType ); - sInvalidFilterHTML.appendAscii ( "\"</td></tr>\n" ); - } - } - sInvalidFilterHTML.appendAscii( "</table>\n" ); // close table - sInvalidFilterHTML.appendAscii( "</body>\n</html>\n" ); // close html - impl_writeFile( INVALIDFILTERS_HTML, U2B(sInvalidFilterHTML.makeStringAndClear()) ); -} - -//***************************************************************************************************************** -void CFGView::impl_generateInvalidDetectorsHTML() -{ - //------------------------------------------------------------------------------------------------------------- - // generate frameset for invalid detectors - OUStringBuffer sInvalidDetectorsFramesetHTML( 10000 ); - - sInvalidDetectorsFramesetHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFrameset: Invalid Detectors\n\t\t</title>\n\t</head>\n" ); // open html - sInvalidDetectorsFramesetHTML.appendAscii( "\t\t<frameset cols=\"40%,60%\">\n" ); // open frameset for cols - sInvalidDetectorsFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "list" - sInvalidDetectorsFramesetHTML.appendAscii( TARGET_LIST ); - sInvalidDetectorsFramesetHTML.appendAscii( "\" src=\"" ); - sInvalidDetectorsFramesetHTML.appendAscii( INVALIDDETECTORS_HTML ); - sInvalidDetectorsFramesetHTML.appendAscii( "\" title=\"List\">\n" ); - sInvalidDetectorsFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "properties" - sInvalidDetectorsFramesetHTML.appendAscii( TARGET_PROPERTIES ); - sInvalidDetectorsFramesetHTML.appendAscii( "\" src=\"" ); - sInvalidDetectorsFramesetHTML.appendAscii( DETECTORPROPERTIES_HTML ); - sInvalidDetectorsFramesetHTML.appendAscii( "\" title=\"Properties\">\n" ); - sInvalidDetectorsFramesetHTML.appendAscii( "\t\t</frameset>\n" ); // close frameset cols - sInvalidDetectorsFramesetHTML.appendAscii( "</html>\n" ); // close html - - impl_writeFile( FRAMESET_INVALIDDETECTORS_HTML, U2B(sInvalidDetectorsFramesetHTML.makeStringAndClear()) ); - - //------------------------------------------------------------------------------------------------------------- - // Search invalid registered detect services! - OUStringBuffer sInvalidDetectorsHTML( 10000 ); - - sInvalidDetectorsHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tInvalid Detector Services\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - sInvalidDetectorsHTML.appendAscii( "\t\tPlease check follow detect service entries in configuration. They are registered for invalid types!<p>\n" ); // write "Note" - sInvalidDetectorsHTML.appendAscii( "\t\t<table border=0>\n" ); // open table - sInvalidDetectorsHTML.appendAscii( "\t<tr><td bgcolor=#ff8040><strong>Nr.</strong></td><td bgcolor=#ff8040><strong>Detector</strong></td></tr>\n" ); // generate table header - - css::uno::Sequence< ::rtl::OUString > lDetectors = m_aData.pCache->getAllDetectorNames(); - sal_Int32 nDetectorCount = lDetectors.getLength() ; - css::uno::Sequence< ::rtl::OUString > lTypes = m_aData.pCache->getAllTypeNames() ; - sal_Int32 nTypeCount = lTypes.getLength() ; - FileType aType ; - Detector aDetector; - for( sal_Int32 nDetector=0; nDetector<nDetectorCount; ++nDetector ) - { - aDetector = m_aData.pCache->getDetector( lDetectors[nDetector] ); - sal_Bool bFound = sal_False; - for( sal_Int32 nType=0; nType<nTypeCount; ++nType ) - { - aType = m_aData.pCache->getType( lTypes[nType] ); - for( ConstStringListIterator pTypeListEntry=aDetector.lTypes.begin(); pTypeListEntry!=aDetector.lTypes.end(); ++pTypeListEntry ) - { - if( *pTypeListEntry == aType.sName ) - { - bFound = sal_True; - break; - } - } - } - if( bFound == sal_False ) - { - sInvalidDetectorsHTML.appendAscii ( "\t<tr><td bgcolor=#ff0000 color=#00ffff>" ); // generate row for invalid detector entry - sInvalidDetectorsHTML.append ( OUString::valueOf( nDetector ) ); - sInvalidDetectorsHTML.appendAscii ( "</td><td><a href=\"" ); - sInvalidDetectorsHTML.appendAscii ( DETECTORPROPERTIES_HTML ); - sInvalidDetectorsHTML.appendAscii ( "#" ); - sInvalidDetectorsHTML.append ( aDetector.sName ); - sInvalidDetectorsHTML.appendAscii ( "\" target=\"" ); - sInvalidDetectorsHTML.appendAscii ( TARGET_PROPERTIES ); - sInvalidDetectorsHTML.appendAscii ( "\">" ); - sInvalidDetectorsHTML.append ( aDetector.sName ); - sInvalidDetectorsHTML.appendAscii ( "\"</a></td></tr>\n" ); - } - } - sInvalidDetectorsHTML.appendAscii( "</table>\n" ); // close table - sInvalidDetectorsHTML.appendAscii( "</body>\n</html>\n" ); // close html - impl_writeFile( INVALIDDETECTORS_HTML, U2B(sInvalidDetectorsHTML.makeStringAndClear()) ); -} - -//***************************************************************************************************************** -void CFGView::impl_generateInvalidLoadersHTML() -{ - //------------------------------------------------------------------------------------------------------------- - // generate frameset for invalid loaders - OUStringBuffer sInvalidLoadersFramesetHTML( 10000 ); - - sInvalidLoadersFramesetHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFrameset: Invalid Loaders\n\t\t</title>\n\t</head>\n" ); // open html - sInvalidLoadersFramesetHTML.appendAscii( "\t\t<frameset cols=\"40%,60%\">\n" ); // open frameset for cols - sInvalidLoadersFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "list" - sInvalidLoadersFramesetHTML.appendAscii( TARGET_LIST ); - sInvalidLoadersFramesetHTML.appendAscii( "\" src=\"" ); - sInvalidLoadersFramesetHTML.appendAscii( INVALIDLOADERS_HTML ); - sInvalidLoadersFramesetHTML.appendAscii( "\" title=\"List\">\n" ); - sInvalidLoadersFramesetHTML.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "properties" - sInvalidLoadersFramesetHTML.appendAscii( TARGET_PROPERTIES ); - sInvalidLoadersFramesetHTML.appendAscii( "\" src=\"" ); - sInvalidLoadersFramesetHTML.appendAscii( LOADERPROPERTIES_HTML ); - sInvalidLoadersFramesetHTML.appendAscii( "\" title=\"Properties\">\n" ); - sInvalidLoadersFramesetHTML.appendAscii( "\t\t</frameset>\n" ); // close frameset cols - sInvalidLoadersFramesetHTML.appendAscii( "</html>\n" ); // close html - - impl_writeFile( FRAMESET_INVALIDLOADERS_HTML, U2B(sInvalidLoadersFramesetHTML.makeStringAndClear()) ); - - //------------------------------------------------------------------------------------------------------------- - // Search invalid registered detect services! - OUStringBuffer sInvalidLoadersHTML( 10000 ); - - sInvalidLoadersHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tInvalid Loader Services\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - sInvalidLoadersHTML.appendAscii( "\t\tPlease check follow loader service entries in configuration. They are registered for invalid types!<p>\n" ); // write "Note" - sInvalidLoadersHTML.appendAscii( "\t\t<table border=0>\n" ); // open table - sInvalidLoadersHTML.appendAscii( "\t<tr><td bgcolor=#ff8040><strong>Nr.</strong></td><td bgcolor=#ff8040><strong>Loader</strong></td></tr>\n" ); // generate table header - - css::uno::Sequence< ::rtl::OUString > lLoaders = m_aData.pCache->getAllLoaderNames(); - sal_Int32 nLoaderCount = lLoaders.getLength() ; - css::uno::Sequence< ::rtl::OUString > lTypes = m_aData.pCache->getAllTypeNames() ; - sal_Int32 nTypeCount = lTypes.getLength() ; - FileType aType ; - Loader aLoader ; - for( sal_Int32 nLoader=0; nLoader<nLoaderCount; ++nLoader ) - { - aLoader = m_aData.pCache->getLoader( lLoaders[nLoader] ); - sal_Bool bFound = sal_False; - for( sal_Int32 nType=0; nType<nTypeCount; ++nType ) - { - aType = m_aData.pCache->getType( lTypes[nType] ); - for( ConstStringListIterator pTypeListEntry=aLoader.lTypes.begin(); pTypeListEntry!=aLoader.lTypes.end(); ++pTypeListEntry ) - { - if( *pTypeListEntry == aType.sName ) - { - bFound = sal_True; - break; - } - } - } - if( bFound == sal_False ) - { - sInvalidLoadersHTML.appendAscii ( "\t<tr><td bgcolor=#ff0000 color=#00ffff>" ); // generate row for invalid loader entry - sInvalidLoadersHTML.append ( OUString::valueOf( nLoader ) ); - sInvalidLoadersHTML.appendAscii ( "</td><td><a href=\"" ); - sInvalidLoadersHTML.appendAscii ( LOADERPROPERTIES_HTML ); - sInvalidLoadersHTML.appendAscii ( "#" ); - sInvalidLoadersHTML.append ( aLoader.sName ); - sInvalidLoadersHTML.appendAscii ( "\" target=\"" ); - sInvalidLoadersHTML.appendAscii ( TARGET_PROPERTIES ); - sInvalidLoadersHTML.appendAscii ( "\">" ); - sInvalidLoadersHTML.append ( aLoader.sName ); - sInvalidLoadersHTML.appendAscii ( "\"</a></td></tr>\n" ); - } - } - sInvalidLoadersHTML.appendAscii( "</table>\n" ); // close table - sInvalidLoadersHTML.appendAscii( "</body>\n</html>\n" ); // close html - impl_writeFile( INVALIDLOADERS_HTML, U2B(sInvalidLoadersHTML.makeStringAndClear()) ); -} - -//***************************************************************************************************************** -void CFGView::impl_generateFilterFlagsHTML() -{ - //------------------------------------------------------------------------------------------------------------- - // Create view of all filters and his flags. - OUStringBuffer sFilterFlagsHTML( 10000 ); - - sFilterFlagsHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFilter and Flags\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - sFilterFlagsHTML.appendAscii( "\t\tThis is a list of all filters and his supported flags!<p>\n" ); // write "Note" - sFilterFlagsHTML.appendAscii( "\t\t<table border=0>\n" ); // open table - sFilterFlagsHTML.appendAscii( "\t<tr><td bgcolor=#ff8040><strong>Nr.</strong></td><td bgcolor=#ff8040><strong>Loader</strong></td></tr>\n" ); // generate table header - - css::uno::Sequence< ::rtl::OUString > lNames = m_aData.pCache->getAllFilterNames(); - sal_Int32 nCount = lNames.getLength(); - for( sal_Int32 nItem=0; nItem!=nCount; ++nItem ) - { - Filter aFilter = m_aData.pCache->getFilter( lNames[nItem] ); - - sFilterFlagsHTML.appendAscii( "\t<tr><td bgcolor=#ff0000 color=#00ffff>" ); - sFilterFlagsHTML.append ( OUString::valueOf( nItem ) ); - sFilterFlagsHTML.appendAscii( "</td><td><a href=\"" ); - sFilterFlagsHTML.appendAscii( LOADERPROPERTIES_HTML ); - sFilterFlagsHTML.appendAscii( "#" ); - sFilterFlagsHTML.append ( aFilter.sName ); - sFilterFlagsHTML.appendAscii( "\" target=\"" ); - sFilterFlagsHTML.appendAscii( TARGET_PROPERTIES ); - sFilterFlagsHTML.appendAscii( "\">" ); - sFilterFlagsHTML.append ( aFilter.sName ); - sFilterFlagsHTML.appendAscii( "\"</a></td><td>" ); - - if( aFilter.nFlags & FILTERFLAG_IMPORT ) { sFilterFlagsHTML.append( FILTERFLAGNAME_IMPORT ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_EXPORT ) { sFilterFlagsHTML.append( FILTERFLAGNAME_EXPORT ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_TEMPLATE ) { sFilterFlagsHTML.append( FILTERFLAGNAME_TEMPLATE ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_INTERNAL ) { sFilterFlagsHTML.append( FILTERFLAGNAME_INTERNAL ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_TEMPLATEPATH ) { sFilterFlagsHTML.append( FILTERFLAGNAME_TEMPLATEPATH ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_OWN ) { sFilterFlagsHTML.append( FILTERFLAGNAME_OWN ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_ALIEN ) { sFilterFlagsHTML.append( FILTERFLAGNAME_ALIEN ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_USESOPTIONS ) { sFilterFlagsHTML.append( FILTERFLAGNAME_USESOPTIONS ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_DEFAULT ) { sFilterFlagsHTML.append( FILTERFLAGNAME_DEFAULT ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_NOTINFILEDIALOG ) { sFilterFlagsHTML.append( FILTERFLAGNAME_NOTINFILEDIALOG ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_NOTINCHOOSER ) { sFilterFlagsHTML.append( FILTERFLAGNAME_NOTINCHOOSER ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_ASYNCHRON ) { sFilterFlagsHTML.append( FILTERFLAGNAME_ASYNCHRON ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_READONLY ) { sFilterFlagsHTML.append( FILTERFLAGNAME_READONLY ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_NOTINSTALLED ) { sFilterFlagsHTML.append( FILTERFLAGNAME_NOTINSTALLED ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_CONSULTSERVICE ) { sFilterFlagsHTML.append( FILTERFLAGNAME_CONSULTSERVICE ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_3RDPARTYFILTER ) { sFilterFlagsHTML.append( FILTERFLAGNAME_3RDPARTYFILTER ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_PACKED ) { sFilterFlagsHTML.append( FILTERFLAGNAME_PACKED ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_SILENTEXPORT ) { sFilterFlagsHTML.append( FILTERFLAGNAME_SILENTEXPORT ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_BROWSERPREFERED ) { sFilterFlagsHTML.append( FILTERFLAGNAME_BROWSERPREFERED ); sFilterFlagsHTML.appendAscii( " | " ); } - if( aFilter.nFlags & FILTERFLAG_PREFERED ) { sFilterFlagsHTML.append( FILTERFLAGNAME_PREFERED ); } - - sFilterFlagsHTML.appendAscii( "</td></tr>\n" ); - } - sFilterFlagsHTML.appendAscii( "</table>\n" ); // close table - sFilterFlagsHTML.appendAscii( "</body>\n</html>\n" ); // close html - impl_writeFile( FILTERFLAGS_HTML, U2B(sFilterFlagsHTML.makeStringAndClear()) ); -} - -//***************************************************************************************************************** -void CFGView::impl_generateDefaultFiltersHTML() -{ -} - -//***************************************************************************************************************** -void CFGView::impl_generateDoubleFilterUINamesHTML() -{ - //------------------------------------------------------------------------------------------------------------- - // generate frameset for double UINames - OUStringBuffer sFrameSet( 10000 ); - - sFrameSet.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tFrameset: Search doubl UINames\n\t\t</title>\n\t</head>\n" ); // open html - sFrameSet.appendAscii( "\t\t<frameset cols=\"40%,60%\">\n" ); // open frameset for cols - sFrameSet.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "list" - sFrameSet.appendAscii( TARGET_LIST ); - sFrameSet.appendAscii( "\" src=\"" ); - sFrameSet.appendAscii( DOUBLEFILTERUINAMES_HTML ); - sFrameSet.appendAscii( "\" title=\"Double UINames\">\n" ); - sFrameSet.appendAscii( "\t\t\t<frame name=\"" ); // generate frame "properties" - sFrameSet.appendAscii( TARGET_PROPERTIES ); - sFrameSet.appendAscii( "\" src=\"" ); - sFrameSet.appendAscii( FILTERPROPERTIES_HTML ); - sFrameSet.appendAscii( "\" title=\"Properties\">\n" ); - sFrameSet.appendAscii( "\t\t</frameset>\n" ); // close frameset cols - sFrameSet.appendAscii( "</html>\n" ); // close html - - impl_writeFile( FRAMESET_DOUBLEFILTERUINAMES_HTML, U2B(sFrameSet.makeStringAndClear()) ); - - //------------------------------------------------------------------------------------------------------------- - // Search invalid registered detect services! - OUStringBuffer sHTML( 10000 ); - - sHTML.appendAscii( "<html>\n\t<head>\n\t\t<title>\n\t\t\tDouble Filter UINames\n\t\t</title>\n\t</head>\n\t<body>\n" ); // open html - sHTML.appendAscii( "\t\tPlease check follow filter entries in configuration. Her UINames are registered twice!<p>\n" ); // write "Note" - sHTML.appendAscii( "\t\t<table border=0>\n" ); // open table - sHTML.appendAscii( "\t<tr><td bgcolor=#ff8040><strong>Nr.</strong></td>\n" ); // generate table header - sHTML.appendAscii( "\t\t<td bgcolor=#ff8040><strong>UIName</strong></td>\n" ); - sHTML.appendAscii( "\t\t<td bgcolor=#ff8040><strong>Filters</strong></td>\n" ); - sHTML.appendAscii( "\t</tr>\n" ); - - StringHash lUINames ; - css::uno::Sequence< ::rtl::OUString > lFilters = m_aData.pCache->getAllFilterNames(); - sal_Int32 nFilterCount = lFilters.getLength() ; - Filter aFilter ; - ::rtl::OUStringBuffer sBuffer ; - ::rtl::OUString sUIName ; - - for( sal_Int32 nFilter=0; nFilter<nFilterCount; ++nFilter ) - { - aFilter = m_aData.pCache->getFilter( lFilters[nFilter] ); - for( ConstStringHashIterator pUIName=aFilter.lUINames.begin(); pUIName!= aFilter.lUINames.end(); ++pUIName ) - { - // Build key value by using localized UIName to register filter name - sBuffer.appendAscii( "[" ); - sBuffer.append ( pUIName->first ); - sBuffer.appendAscii( "] \"" ); - sBuffer.append ( pUIName->second ); - sBuffer.appendAscii( "\"" ); - sUIName = sBuffer.makeStringAndClear(); - - // insert filter into hash table - sBuffer.append ( lUINames[ sUIName ] ); - sBuffer.appendAscii ( "<a href=\"" ); - sBuffer.appendAscii ( FILTERPROPERTIES_HTML ); - sBuffer.appendAscii ( "#" ); - sBuffer.append ( aFilter.sName ); - sBuffer.appendAscii ( "\" target=\"" ); - sBuffer.appendAscii ( TARGET_PROPERTIES ); - sBuffer.appendAscii ( "\">" ); - sBuffer.append ( aFilter.sName ); - sBuffer.appendAscii ( "\"</a><br>\n" ); - lUINames[ sUIName ] = sBuffer.makeStringAndClear(); - } - } - - nFilter = 1; - for( ConstStringHashIterator pIterator=lUINames.begin(); pIterator!=lUINames.end(); ++pIterator ) - { - if( pIterator->second.indexOf( '\n' ) != pIterator->second.lastIndexOf( '\n' ) ) - { - sHTML.appendAscii ( "\t<tr><td bgcolor=#ff0000 color=#00ffff valign=top>" ); // generate row for uiname->filter entry - sHTML.append ( OUString::valueOf( nFilter ) ); - sHTML.appendAscii ( "</td><td valign=top>" ); - sHTML.append ( pIterator->first ); - sHTML.appendAscii ( "</td><td bgcolor=#f0f0f0 valign=top>" ); - sHTML.append ( pIterator->second ); - sHTML.appendAscii ( "</td></tr>\n" ); - - ++nFilter; - } - } - - sHTML.appendAscii( "</table>\n" ); // close table - sHTML.appendAscii( "</body>\n</html>\n" ); // close html - impl_writeFile( DOUBLEFILTERUINAMES_HTML, U2B(sHTML.makeStringAndClear()) ); -} - -//***************************************************************************************************************** -void CFGView::impl_writeFile( const ::rtl::OString& sFile, const ::rtl::OString& sContent ) -{ - ::rtl::OUStringBuffer sFullPath( 1000 ); - sFullPath.append ( m_aData.sDirectory ); - sFullPath.appendAscii ( "\\" ); - sFullPath.appendAscii ( sFile.getStr() ); - - ::rtl::OUString s = sFullPath.makeStringAndClear(); - - WRITE_LOGFILE( U2B(s), sContent ) -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/test/typecfg/typecfg.cxx b/framework/test/typecfg/typecfg.cxx deleted file mode 100644 index 4072b92790a6..000000000000 --- a/framework/test/typecfg/typecfg.cxx +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include <classes/servicemanager.hxx> -#include <classes/filtercache.hxx> -#include <macros/generic.hxx> -#include <macros/debug.hxx> -#include <services.h> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> - -//_________________________________________________________________________________________________________________ -// other includes -//_________________________________________________________________________________________________________________ -#include <comphelper/processfactory.hxx> -#include <osl/process.h> -#include <rtl/ustring.hxx> -#include <rtl/ustrbuf.hxx> - -#include <vcl/event.hxx> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> -#include <stdio.h> - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define RDBFILE DECLARE_ASCII("typecfg.rdb" ) -#define ARGUMENT_GENERATE_CFGVIEW DECLARE_ASCII("-cfgview" ) -#define ARGUMENT_CHECK_FILTERREGISTRATION DECLARE_ASCII("-registerfilter" ) -#define ARGUMENT_GENERATE_TYPEDETECTION_XCD DECLARE_ASCII("-generatexcd" ) - -//_________________________________________________________________________________________________________________ -// namespace -//_________________________________________________________________________________________________________________ - -using namespace ::std ; -using namespace ::rtl ; -using namespace ::framework ; -using namespace ::comphelper ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::container ; -using namespace ::com::sun::star::beans ; - -//_________________________________________________________________________________________________________________ -// defines -//_________________________________________________________________________________________________________________ - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -enum EMode -{ - E_GENERATE_CFGVIEW , - E_CHECK_FILTERREGISTRATION , - E_GENERATE_TYPEDETECTION_XCD -}; - -/*-***************************************************************************************************************/ -class TypeApplication : public Application -{ - //************************************************************************************************************* - public: - - void Main(); - - //************************************************************************************************************* - private: - - void impl_parseCommandLine (); - void impl_generateCFGView (); - void impl_checkFilterRegistration (); - void impl_generateTypeDetectionXCD (); - - //************************************************************************************************************* - private: - - EMode m_eMode ; - Reference< XMultiServiceFactory > m_xServiceManager ; - - FilterCache* m_pCache ; - -}; // class FilterApplication - -//_________________________________________________________________________________________________________________ -// global variables -//_________________________________________________________________________________________________________________ - -TypeApplication gApplication; - -//***************************************************************************************************************** -void TypeApplication::Main() -{ - // Init global servicemanager and set it. - ServiceManager aManager; - m_xServiceManager = aManager.getSharedUNOServiceManager( RDBFILE ); - setProcessServiceFactory( m_xServiceManager ); - - m_pCache = new FilterCache; - - impl_parseCommandLine(); - - switch( m_eMode ) - { - case E_GENERATE_CFGVIEW : impl_generateCFGView(); - break; - case E_CHECK_FILTERREGISTRATION : impl_checkFilterRegistration(); - break; - case E_GENERATE_TYPEDETECTION_XCD : impl_generateTypeDetectionXCD(); - break; - } - - delete m_pCache; - m_pCache = NULL; -} - -//***************************************************************************************************************** -void TypeApplication::impl_parseCommandLine() -{ - OUString sArgument ; - sal_Int32 nArgument = 0 ; - sal_Int32 nCount = osl_getCommandArgCount(); - - while( nArgument<nCount ) - { - osl_getCommandArg( nArgument, &sArgument.pData ); - - if( sArgument == ARGUMENT_GENERATE_CFGVIEW ) - { - m_eMode = E_GENERATE_CFGVIEW; - break; - } - else - if( sArgument == ARGUMENT_CHECK_FILTERREGISTRATION ) - { - m_eMode = E_CHECK_FILTERREGISTRATION; - break; - } - else - if( sArgument == ARGUMENT_GENERATE_TYPEDETECTION_XCD ) - { - m_eMode = E_GENERATE_TYPEDETECTION_XCD; - break; - } - - ++nArgument; - } -} - -//***************************************************************************************************************** -void TypeApplication::impl_generateCFGView() -{ - #ifdef ENABLE_FILTERCACHEDEBUG - // Cache use ref count! - FilterCache aCache; - aCache.impldbg_generateHTMLView(); - #endif //ENABLE_FILTERCACHEDEBUG -} - -//***************************************************************************************************************** -void TypeApplication::impl_checkFilterRegistration() -{ - Reference< XNameContainer > xFilterContainer( m_xServiceManager->createInstance( SERVICENAME_FILTERFACTORY ), UNO_QUERY ); - LOG_ASSERT2( xFilterContainer.is()==sal_False, "TypeApplication::impl_checkFilterRegistration()", "Couldn't create filter factory!" ) - if( xFilterContainer.is() == sal_True ) - { - Sequence< PropertyValue > lProperties( 8 ); - - lProperties[0].Name = DECLARE_ASCII("Type") ; - lProperties[0].Value <<= DECLARE_ASCII("MeinType") ; - - lProperties[1].Name = DECLARE_ASCII("UIName") ; - lProperties[1].Value <<= DECLARE_ASCII("MeinUIName") ; - - lProperties[2].Name = DECLARE_ASCII("UINames") ; - lProperties[2].Value <<= Sequence< PropertyValue >() ; - - lProperties[3].Name = DECLARE_ASCII("DocumentService") ; - lProperties[3].Value <<= DECLARE_ASCII("MeinDocService") ; - - lProperties[4].Name = DECLARE_ASCII("FilterService") ; - lProperties[4].Value <<= DECLARE_ASCII("MeinFilterService") ; - - lProperties[5].Name = DECLARE_ASCII("Flags") ; - lProperties[5].Value <<= (sal_Int32)256 ; - - lProperties[6].Name = DECLARE_ASCII("UserData") ; - lProperties[6].Value <<= Sequence< OUString >() ; - - lProperties[7].Name = DECLARE_ASCII("FileFormatVersion") ; - lProperties[7].Value <<= (sal_Int32)0 ; - - lProperties[8].Name = DECLARE_ASCII("TemplateName") ; - lProperties[8].Value <<= DECLARE_ASCII("MeinTemplate") ; - } -} - -//***************************************************************************************************************** -void TypeApplication::impl_generateTypeDetectionXCD() -{ - #ifdef ENABLE_GENERATEFILTERCACHE - // Cache use ref count! - FilterCache aCache ; - sal_Bool bWriteable = sal_True; - sal_Unicode cSeparator = ',' ; - aCache.impldbg_generateXCD( "org.openoffice.Office.TypeDetection.xcd", bWriteable, cSeparator ); - #endif //ENABLE_GENERATEFILTERCACHE -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/test/typecfg/xml2xcd.cxx b/framework/test/typecfg/xml2xcd.cxx deleted file mode 100644 index 38b54ac19520..000000000000 --- a/framework/test/typecfg/xml2xcd.cxx +++ /dev/null @@ -1,2295 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ - -#define VCL_NEED_BASETSD -#include <tools/presys.h> -#include <windows.h> -#include <tools/postsys.h> -#include <classes/servicemanager.hxx> -#include <classes/filtercache.hxx> -#include <macros/generic.hxx> -#include <macros/debug.hxx> -#include <services.h> -#include <filterflags.h> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -//_________________________________________________________________________________________________________________ -// other includes -//_________________________________________________________________________________________________________________ -#include <comphelper/processfactory.hxx> -#include <unotools/processfactory.hxx> -#include <osl/process.h> -#include <rtl/ustring.hxx> -#include <rtl/ustrbuf.hxx> - -#include <vcl/event.hxx> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> - -//_________________________________________________________________________________________________________________ -// namespace -//_________________________________________________________________________________________________________________ - -using namespace ::framework ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -//_________________________________________________________________________________________________________________ -// defines -//_________________________________________________________________________________________________________________ - -/* - Versions: 1) first revision - - one entry for every property - - full loclized values - 2) new property "Order" for filters ... but not right set! - all values are 0 - 3) decrease size of xml file - - don't write full localized values - - use own formated string for all non localized values - - seperate "Installed" flag for filters - 4) set right values for "Order" property of filters - 5) support for ContentHandler - draft 6) reactivate old filter names - ??? draft 7) split xml into standard/optional => use DRAFT_SPLIT_VERSION till this version is well known! - */ -#define DRAFT_SPLIT_VERSION 7 - -#define ARGUMENT_PACKAGE_STANDARD DECLARE_ASCII("-pas=") // argument for package name of standard filters -#define ARGUMENT_PACKAGE_ADDITIONAL DECLARE_ASCII("-paa=") // argument for package name of additional filters -#define ARGUMENT_WRITEABLE DECLARE_ASCII("-wri=") // argument for "writeable" [true|false] -#define ARGUMENT_VERSION_INPUT DECLARE_ASCII("-vin=") // argument for file version to read [1|2|3] -#define ARGUMENT_VERSION_OUTPUT DECLARE_ASCII("-vou=") // argument for file version to write [1|2|3] - -#define ARGUMENTLENGTH 5 // All arguments should have the same lenght ... it's better to detect it! -#define ARGUMENTFOUND 0 // OUString::compareTo returns 0 if searched string match given one - -#define WRITEABLE_ON DECLARE_ASCII("true" ) -#define WRITEABLE_OFF DECLARE_ASCII("false") - -#define MINARGUMENTCOUNT 5 // no optional arguments allowed yet! - -#define LISTFILE_STANDARDTYPES "typelist_standard.txt" -#define LISTFILE_ADDITIONALTYPES "typelist_additional.txt" -#define LISTFILE_STANDARDFILTER "filterlist_standard.txt" -#define LISTFILE_ADDITIONALFILTER "filterlist_additional.txt" -#define SCPFILE_STANDARD "scp_standard.txt" -#define SCPFILE_ADDITIONAL "scp_additional.txt" - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-***************************************************************************************************************/ -struct AppMember -{ - FilterCache* pFilterCache ; // pointer to configuration - StringHash aOldFilterNamesHash ; // converter tabel to restaurate old filter names - EFilterPackage ePackage ; // specify which package should be used => specify using of file name and buffer too! -// ::rtl::OUString sFileNameStandard ; // file name of our standard filter cfg -// ::rtl::OUString sFileNameAdditional ; // file name of our additional filter cfg - ::rtl::OUString sPackageStandard ; // package name of our standard filter cfg - ::rtl::OUString sPackageAdditional ; // package name of our additional filter cfg - ::rtl::OUStringBuffer sBufferStandard ; // buffer of our standard filter cfg - ::rtl::OUStringBuffer sBufferAdditional ; // buffer of our standard filter cfg - ::rtl::OUStringBuffer sNew2OldSCPStandard ; // setup script to convert new to old filternames (standard filter) - ::rtl::OUStringBuffer sNew2OldSCPAdditional ; // setup script to convert new to old filternames (additional filter) - ::rtl::OUStringBuffer sStandardFilterList ; - ::rtl::OUStringBuffer sAdditionalFilterList ; - ::rtl::OUStringBuffer sStandardTypeList ; - ::rtl::OUStringBuffer sAdditionalTypeList ; - sal_Bool bWriteable ; // enable/disable writable configuration items - sal_Int32 nVersionInput ; // format version of input xml file - sal_Int32 nVersionOutput ; // format version of output xcd file - - sal_Int32 nOriginalTypes ; - sal_Int32 nOriginalFilters ; - sal_Int32 nOriginalDetectors ; - sal_Int32 nOriginalLoaders ; - sal_Int32 nOriginalContentHandlers ; - - sal_Int32 nWrittenTypes ; - sal_Int32 nWrittenFilters ; - sal_Int32 nWrittenDetectors ; - sal_Int32 nWrittenLoaders ; - sal_Int32 nWrittenContentHandlers ; -}; - -/*-***************************************************************************************************************/ -class XCDGenerator : public Application -{ - //************************************************************************************************************* - public: - void Main(); - - //************************************************************************************************************* - private: - void impl_printCopyright ( ); // print copyright to stdout :-) - void impl_printSyntax ( ); // print help to stout for user - void impl_parseCommandLine ( AppMember& rMember ); // parse command line arguments and fill given struct - - void impl_generateXCD ( ); // generate all xcd files by using current configuration - void impl_generateCopyright ( ); // generate copyrights - void impl_generateTypeTemplate ( ); // generate templates ... - void impl_generateFilterTemplate ( ); - void impl_generateDetectorTemplate ( ); - void impl_generateLoaderTemplate ( ); - void impl_generateTypeSet ( ); // generate sets - void impl_generateFilterSet ( ); - void impl_generateDetectorSet ( ); - void impl_generateLoaderSet ( ); - void impl_generateDefaults ( ); // generate defaults - void impl_generateContentHandlerTemplate ( ); - void impl_generateContentHandlerSet ( ); - void impl_generateFilterFlagTemplate ( const ::rtl::OUString& sName , // helper to write atomic elements - sal_Int32 nValue , - const ::rtl::OString& sDescription = ::rtl::OString() ); - void impl_generateIntProperty ( ::rtl::OUStringBuffer& sXCD , - const ::rtl::OUString& sName , - sal_Int32 nValue ); - void impl_generateBoolProperty ( ::rtl::OUStringBuffer& sXCD , - const ::rtl::OUString& sName , - sal_Bool bValue ); - void impl_generateStringProperty ( ::rtl::OUStringBuffer& sXCD , - const ::rtl::OUString& sName , - const ::rtl::OUString& sValue ); - void impl_generateStringListProperty ( ::rtl::OUStringBuffer& sXCD , - const ::rtl::OUString& sName , - const ::framework::StringList& lValue ); - void impl_generateUINamesProperty ( ::rtl::OUStringBuffer& sXCD , - const ::rtl::OUString& sName , - const StringHash& lUINames ); - ::rtl::OUString impl_getOldFilterName ( const ::rtl::OUString& sNewName ); // convert filter names to old format - - static void impl_classifyType ( const AppMember& rData , - const ::rtl::OUString& sTypeName , - EFilterPackage& ePackage ); // classify type as STANDARD or ADDITIONAL one - static void impl_classifyFilter ( const AppMember& rData , - const ::rtl::OUString& sFilterName , - EFilterPackage& ePackage , - sal_Int32& nOrder ); // classify filter as STANDARD or ADDITIONAL filter, set order of standard filter too - static ::rtl::OUString impl_encodeSpecialSigns ( const ::rtl::OUString& sValue ); // encode strings for xml - static sal_Unicode impl_defineSeperator ( const ::framework::StringList& lList ); // search seperator for lists - static void impl_initFilterHashNew2Old ( StringHash& aHash ); // initialize converter table to restaurate old filter names - static void impl_orderAlphabetical ( css::uno::Sequence< ::rtl::OUString >& lList ); // sort stringlist of internal type-, filter- ... names in alphabetical order to generate xcd files everytime in the same way - static sal_Bool impl_isUsAsciiAlphaDigit ( sal_Unicode c , - sal_Bool bDigitAllowed = sal_True ); - static ::rtl::OUString impl_encodeSetName ( const ::rtl::OUString& rSource ); - - //************************************************************************************************************* - private: - AppMember m_aData; - -}; // class XCDGenerator - -//_________________________________________________________________________________________________________________ -// global variables -//_________________________________________________________________________________________________________________ - -XCDGenerator gGenerator; - -//***************************************************************************************************************** -void XCDGenerator::Main() -{ - - // Init global servicemanager and set it. - // It's neccessary for other services ... e.g. configuration. - ServiceManager aManager; - ::comphelper::setProcessServiceFactory( aManager.getGlobalUNOServiceManager() ); - ::utl::setProcessServiceFactory ( aManager.getGlobalUNOServiceManager() ); - - // Get optional commands from command line. - impl_parseCommandLine( m_aData ); - - // initialize converter table to match new to old filter names! - if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 ) - { - XCDGenerator::impl_initFilterHashNew2Old( m_aData.aOldFilterNamesHash ); - } - - // Create access to current set filter configuration. - // Attention: Please use it for a full fat office installation only!! - // We need an installation with ALL filters. - // Member m_pData is used in some impl-methods directly ... - m_aData.pFilterCache = new FilterCache( m_aData.nVersionInput, CONFIG_MODE_ALL_LOCALES ); - - // Get some statistic informations of current filled filter cache ... (e.g. count of current activae filters) - // because we need it to check if all filters are converted and written to disk. - // May be it's possible to lose some of them during convertion!!! - m_aData.nOriginalTypes = m_aData.pFilterCache->getAllTypeNames().getLength() ; - m_aData.nOriginalFilters = m_aData.pFilterCache->getAllFilterNames().getLength() ; - m_aData.nOriginalDetectors = m_aData.pFilterCache->getAllDetectorNames().getLength() ; - m_aData.nOriginalLoaders = m_aData.pFilterCache->getAllLoaderNames().getLength() ; - if( m_aData.nVersionInput >= 5 ) - { - m_aData.nOriginalContentHandlers = m_aData.pFilterCache->getAllContentHandlerNames().getLength() ; - } - - // Start generation of xcd file(s). - impl_generateXCD(); - - // Warn programmer if some items couldn't written to file! - LOG_ASSERT2( m_aData.nOriginalTypes != m_aData.nWrittenTypes , "XCDGenerator::Main()", "Generated xcd file could be invalid ... because I miss some types!" ) - LOG_ASSERT2( m_aData.nOriginalFilters != m_aData.nWrittenFilters , "XCDGenerator::Main()", "Generated xcd file could be invalid ... because I miss some filters!" ) - LOG_ASSERT2( m_aData.nOriginalDetectors!= m_aData.nWrittenDetectors, "XCDGenerator::Main()", "Generated xcd file could be invalid ... because I miss some detectors!" ) - LOG_ASSERT2( m_aData.nOriginalLoaders != m_aData.nWrittenLoaders , "XCDGenerator::Main()", "Generated xcd file could be invalid ... because I miss some loaders!" ) - - // Free memory. - delete m_aData.pFilterCache; - m_aData.pFilterCache = NULL; -} - -/*-************************************************************************************************************//** - @short print some info messages to stderr - @descr We must show an copyright or help for using this file. - This two methods do that. - - @seealso - - - @param - - @return - - - @onerror - -*//*-*************************************************************************************************************/ -void XCDGenerator::impl_printCopyright() -{ - fprintf( stderr, "\n(c) Copyright 2000, 2010 Oracle and/or its affiliates.\n" ); -} - -//***************************************************************************************************************** -void XCDGenerator::impl_printSyntax() -{ - // It's not possible to print it out to stdout in a svdem binary :-( - // So we show an assert. - ::rtl::OStringBuffer sBuffer( 500 ); - sBuffer.append( "\nusing: xml2xcd -fis=<file standard filter> -fia=<file additional filter> -pas=<package standard filter> -paa=<package additional filter> -vin=<version input> -vou=<version output> [-wri=<true|false>]\n\n" ); - sBuffer.append( "\tneccessary parameters:\n" ); - sBuffer.append( "\t\t-fis\tname of output file in system notation\n" ); - sBuffer.append( "\t\t-fia\tname of output file in system notation\n" ); - sBuffer.append( "\t\t-pas\tpackage of standard filters\n" ); - sBuffer.append( "\t\t-paa\tpackage of additional filters\n" ); - sBuffer.append( "\t\t-vin\tformat version of input xml file\n" ); - sBuffer.append( "\t\t-vou\tformat version of generated xcd file\n\n" ); - sBuffer.append( "\toptional parameters:\n" ); - sBuffer.append( "\t\t-wri\tconfig items should be writeable ... [true|false]\n" ); - LOG_ERROR( "", sBuffer.makeStringAndClear() ) -} - -/*-************************************************************************************************************//** - @short analyze command line arguments - @descr Created binary accept different command line arguments. These parameters - regulate creation of xcd file. Follow arguments are supported: - "-fis=<filename of standard xcd>" - "-fia=<filename of additional xcd>" - "-wri=<writeable>[true|false]" - "-vin=<version of input file>[1|2|3]" - "-vou=<version of output file>[1|2|3]" - - @seealso - - - @param "rMember", reference to struct of global application member to fill arguments in it - @return right filled member struct or unchanged struct if an error occure! - - @onerror We do nothing - or warn programmer! -*//*-*************************************************************************************************************/ -void XCDGenerator::impl_parseCommandLine( AppMember& rMember ) -{ - ::rtl::OUString sArgument ; - sal_Int32 nArgument = 0 ; - sal_Int32 nCount = osl_getCommandArgCount(); - sal_Int32 nMinCount = 0 ; - - while( nArgument<nCount ) - { - osl_getCommandArg( nArgument, &sArgument.pData ); - //_____________________________________________________________________________________________________ - // look for "-pas=..." - if( sArgument.compareTo( ARGUMENT_PACKAGE_STANDARD, ARGUMENTLENGTH ) == ARGUMENTFOUND ) - { - rMember.sPackageStandard = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH ); - ++nMinCount; - } - else - //_____________________________________________________________________________________________________ - // look for "-paa=..." - if( sArgument.compareTo( ARGUMENT_PACKAGE_ADDITIONAL, ARGUMENTLENGTH ) == ARGUMENTFOUND ) - { - rMember.sPackageAdditional = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH ); - ++nMinCount; - } - else - //_____________________________________________________________________________________________________ - // look for "-wri=..." - if( sArgument.compareTo( ARGUMENT_WRITEABLE, ARGUMENTLENGTH ) == ARGUMENTFOUND ) - { - ::rtl::OUString sWriteable = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH ); - if( sWriteable == WRITEABLE_ON ) - { - rMember.bWriteable = sal_True; - } - else - { - rMember.bWriteable = sal_False; - } - ++nMinCount; - } - //_____________________________________________________________________________________________________ - // look for "-vin=..." - if( sArgument.compareTo( ARGUMENT_VERSION_INPUT, ARGUMENTLENGTH ) == ARGUMENTFOUND ) - { - ::rtl::OUString sVersion = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH ); - rMember.nVersionInput = sVersion.toInt32(); - ++nMinCount; - } - //_____________________________________________________________________________________________________ - // look for "-vou=..." - if( sArgument.compareTo( ARGUMENT_VERSION_OUTPUT, ARGUMENTLENGTH ) == ARGUMENTFOUND ) - { - ::rtl::OUString sVersion = sArgument.copy( ARGUMENTLENGTH, sArgument.getLength()-ARGUMENTLENGTH ); - rMember.nVersionOutput = sVersion.toInt32(); - ++nMinCount; - } - - ++nArgument; - } - - // Show help if user don't call us right! - if( nMinCount != MINARGUMENTCOUNT ) - { - impl_printSyntax(); - exit(-1); - } -} - -/*-************************************************************************************************************//** - @short regulate generation of complete xcd file(s) - @descr This method is the toppest one and implement the global structure of generated xcd file(s). - We create a unicode string buffer for complete xcd file in memory ... - use different helper methods to fill it ... - and write it to disk at the end of this method! - - @seealso struct AppMember - - @param - - @return - - - @onerror - -*//*-*************************************************************************************************************/ -void XCDGenerator::impl_generateXCD() -{ - impl_generateCopyright(); - - // Write header - m_aData.sBufferStandard.appendAscii ( "\n<!-- PLEASE DON'T CHANGE TEMPLATES OR FILE FORMAT BY HAND! USE \"XML2XCD.EXE\" TO DO THAT. THANKS. -->\n\n" ); - m_aData.sBufferStandard.appendAscii ( "<!DOCTYPE schema:component SYSTEM \"../../../../schema/schema.description.dtd\">\n" ); - m_aData.sBufferStandard.appendAscii ( "<schema:component cfg:name=\"" ); - m_aData.sBufferStandard.append ( m_aData.sPackageStandard ); - m_aData.sBufferStandard.appendAscii ( "\" cfg:package=\"org.openoffice.Office\" xml:lang=\"en-US\" xmlns:schema=\"http://openoffice.org/2000/registry/schema/description\" xmlns:default=\"http://openoffice.org/2000/registry/schema/default\" xmlns:cfg=\"http://openoffice.org/2000/registry/instance\">\n" ); - m_aData.sBufferStandard.appendAscii ( "\t<schema:templates>\n" ); - - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - m_aData.sBufferAdditional.appendAscii ( "\n<!-- PLEASE DON'T CHANGE TEMPLATES OR FILE FORMAT BY HAND! USE \"XML2XCD.EXE\" TO DO THAT. THANKS. -->\n\n" ); - m_aData.sBufferAdditional.appendAscii ( "<!DOCTYPE schema:component SYSTEM \"../../../../schema/schema.description.dtd\">\n" ); - m_aData.sBufferAdditional.appendAscii ( "<schema:component cfg:name=\"" ); - m_aData.sBufferAdditional.append ( m_aData.sPackageAdditional ); - m_aData.sBufferAdditional.appendAscii ( "\" cfg:package=\"org.openoffice.Office\" xml:lang=\"en-US\" xmlns:schema=\"http://openoffice.org/2000/registry/schema/description\" xmlns:default=\"http://openoffice.org/2000/registry/schema/default\" xmlns:cfg=\"http://openoffice.org/2000/registry/instance\">\n" ); - m_aData.sBufferAdditional.appendAscii ( "\t<schema:import cfg:name=\"" ); - m_aData.sBufferAdditional.append ( m_aData.sPackageStandard ); - m_aData.sBufferAdditional.appendAscii ( "\"/>\n" ); - } - - // Follow ...generate... methods to nothing for additional filters! - impl_generateTypeTemplate (); - impl_generateFilterTemplate (); - impl_generateDetectorTemplate(); - if( m_aData.nVersionOutput >= 5 ) - { - impl_generateContentHandlerTemplate (); - } - impl_generateLoaderTemplate (); - - m_aData.sBufferStandard.appendAscii ( "\t</schema:templates>\n" ); - m_aData.sBufferStandard.appendAscii ( "<schema:schema cfg:localized=\"false\">\n" ); - - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - m_aData.sBufferAdditional.appendAscii( "\t<schema:schema cfg:localized=\"false\">\n" ); - } - - impl_generateTypeSet (); - impl_generateFilterSet (); - impl_generateDetectorSet (); - if( m_aData.nVersionInput >= 5 ) - { - impl_generateContentHandlerSet (); - } - impl_generateLoaderSet (); - impl_generateDefaults (); - - m_aData.sBufferStandard.appendAscii ( "\t</schema:schema>\n" ); - m_aData.sBufferStandard.appendAscii ( "</schema:component>\n" ); - - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - m_aData.sBufferAdditional.appendAscii ( "\t</schema:schema>\n" ); - m_aData.sBufferAdditional.appendAscii ( "</schema:component>\n" ); - } - - ::rtl::OUString sFileName = m_aData.sPackageStandard ; - sFileName += DECLARE_ASCII(".xcd") ; - - WRITE_LOGFILE( U2B( sFileName ) , U2B(m_aData.sBufferStandard.makeStringAndClear() )) - WRITE_LOGFILE( LISTFILE_STANDARDFILTER , U2B(m_aData.sStandardFilterList.makeStringAndClear() )) - WRITE_LOGFILE( LISTFILE_STANDARDTYPES , U2B(m_aData.sStandardTypeList.makeStringAndClear() )) - WRITE_LOGFILE( SCPFILE_STANDARD , U2B(m_aData.sNew2OldSCPStandard.makeStringAndClear() )) - - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - sFileName = m_aData.sPackageAdditional ; - sFileName += DECLARE_ASCII(".xcd") ; - - WRITE_LOGFILE( U2B(sFileName) , U2B(m_aData.sBufferAdditional.makeStringAndClear() )) - WRITE_LOGFILE( LISTFILE_ADDITIONALFILTER, U2B(m_aData.sAdditionalFilterList.makeStringAndClear() )) - WRITE_LOGFILE( LISTFILE_ADDITIONALTYPES , U2B(m_aData.sAdditionalTypeList.makeStringAndClear() )) - WRITE_LOGFILE( SCPFILE_ADDITIONAL , U2B(m_aData.sNew2OldSCPAdditional.makeStringAndClear() )) - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateCopyright() -{ - m_aData.sBufferStandard.appendAscii( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" ); - m_aData.sBufferStandard.appendAscii( "<!-- \n" ); - m_aData.sBufferStandard.appendAscii( " DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" ); - m_aData.sBufferStandard.appendAscii( "\n" ); - m_aData.sBufferStandard.appendAscii( " Copyright 2000, 2010 Oracle and/or its affiliates.\n" ); - m_aData.sBufferStandard.appendAscii( "\n" ); - m_aData.sBufferStandard.appendAscii( " OpenOffice.org - a multi-platform office productivity suite\n" ); - m_aData.sBufferStandard.appendAscii( "\n" ); - m_aData.sBufferStandard.appendAscii( " This file is part of OpenOffice.org.\n" ); - m_aData.sBufferStandard.appendAscii( "\n" ); - m_aData.sBufferStandard.appendAscii( " OpenOffice.org is free software: you can redistribute it and/or modify\n" ); - m_aData.sBufferStandard.appendAscii( " it under the terms of the GNU Lesser General Public License version 3\n" ); - m_aData.sBufferStandard.appendAscii( " only, as published by the Free Software Foundation.\n" ); - m_aData.sBufferStandard.appendAscii( "\n" ); - m_aData.sBufferStandard.appendAscii( " OpenOffice.org is distributed in the hope that it will be useful,\n" ); - m_aData.sBufferStandard.appendAscii( " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" ); - m_aData.sBufferStandard.appendAscii( " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" ); - m_aData.sBufferStandard.appendAscii( " GNU Lesser General Public License version 3 for more details\n" ); - m_aData.sBufferStandard.appendAscii( " (a copy is included in the LICENSE file that accompanied this code).\n" ); - m_aData.sBufferStandard.appendAscii( "\n" ); - m_aData.sBufferStandard.appendAscii( " You should have received a copy of the GNU Lesser General Public License\n"); - m_aData.sBufferStandard.appendAscii( " version 3 along with OpenOffice.org. If not, see\n" ); - m_aData.sBufferStandard.appendAscii( " <http://www.openoffice.org/license.html>\n" ); - m_aData.sBufferStandard.appendAscii( " for a copy of the LGPLv3 License.\n" ); - m_aData.sBufferStandard.appendAscii( "\n" ); - m_aData.sBufferStandard.appendAscii( "-->\n" ); - - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - m_aData.sBufferAdditional.appendAscii( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" ); - m_aData.sBufferAdditional.appendAscii( "<!-- \n" ); - m_aData.sBufferAdditional.appendAscii( "\n" ); - m_aData.sBufferAdditional.appendAscii( " DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n" ); - m_aData.sBufferAdditional.appendAscii( "\n" ); - m_aData.sBufferAdditional.appendAscii( " Copyright 2000, 2010 Oracle and/or its affiliates.\n" ); - m_aData.sBufferAdditional.appendAscii( "\n" ); - m_aData.sBufferAdditional.appendAscii( " OpenOffice.org - a multi-platform office productivity suite\n" ); - m_aData.sBufferAdditional.appendAscii( "\n" ); - m_aData.sBufferAdditional.appendAscii( " This file is part of OpenOffice.org.\n" ); - m_aData.sBufferAdditional.appendAscii( "\n" ); - m_aData.sBufferAdditional.appendAscii( " OpenOffice.org is free software: you can redistribute it and/or modify\n" ); - m_aData.sBufferAdditional.appendAscii( " it under the terms of the GNU Lesser General Public License version 3\n" ); - m_aData.sBufferAdditional.appendAscii( " only, as published by the Free Software Foundation.\n" ); - m_aData.sBufferAdditional.appendAscii( "\n" ); - m_aData.sBufferAdditional.appendAscii( " OpenOffice.org is distributed in the hope that it will be useful,\n" ); - m_aData.sBufferAdditional.appendAscii( " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" ); - m_aData.sBufferAdditional.appendAscii( " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" ); - m_aData.sBufferAdditional.appendAscii( " GNU Lesser General Public License version 3 for more details\n" ); - m_aData.sBufferAdditional.appendAscii( " (a copy is included in the LICENSE file that accompanied this code).\n" ); - m_aData.sBufferAdditional.appendAscii( "\n" ); - m_aData.sBufferAdditional.appendAscii( " You should have received a copy of the GNU Lesser General Public License\n"); - m_aData.sBufferAdditional.appendAscii( " version 3 along with OpenOffice.org. If not, see\n" ); - m_aData.sBufferAdditional.appendAscii( " <http://www.openoffice.org/license.html>\n" ); - m_aData.sBufferAdditional.appendAscii( " for a copy of the LGPLv3 License.\n" ); - m_aData.sBufferAdditional.appendAscii( "\n" ); - m_aData.sBufferAdditional.appendAscii( "-->\n" ); - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateTypeTemplate() -{ - //_________________________________________________________________________________________________________________ - if( m_aData.nVersionOutput==1 || m_aData.nVersionOutput==2 ) - { - m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"Type\">\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Preferred\" cfg:type=\"boolean\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii("\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the preferred type for an extension if more then one match given URL</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>false</default:data>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UIName\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the external name of this type</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"MediaType\" cfg:type=\"string\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the mime type </schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"ClipboardFormat\" cfg:type=\"string\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the clipboard format name</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"URLPattern\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the patterns used for URLs. This type is only relevant for HTTP, FTP etc. and is used for internal URL formats like private:factory etc.</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Extensions\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the possible file extensions.</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"DocumentIconID\" cfg:type=\"int\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the document icon ID of this type</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>0</default:data>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n" ); - } - //_________________________________________________________________________________________________________________ - else if( m_aData.nVersionOutput>=3 ) - { - m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"Type\">\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UIName\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the external name of this type</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Data\" cfg:type=\"string\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii("\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Containes all data of a type as an own formated string.{Preferred, MediaType, ClipboardFormat, URLPattern, Extensions, DocumentIconID}</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>false</default:data>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n" ); - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateFilterTemplate() -{ - //_________________________________________________________________________________________________________________ - if( m_aData.nVersionOutput==1 || m_aData.nVersionOutput==2 ) - { - m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"Filter\">\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Installed\" cfg:type=\"boolean\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Make it possible to enable or disable filter by setup!</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>false</default:data>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - if( m_aData.nVersionOutput==2 ) - { - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Order\" cfg:type=\"int\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies order of filters for relevant module; don't used for default filter!</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>0</default:data>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - } - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UIName\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the external name of the filter which is displayed at the user interface (dialog).</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Type\" cfg:type=\"string\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the relative type key name of the filter, e.g. Type/T1</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"DocumentService\" cfg:type=\"string\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the name of the UNO service to implement the document.</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"FilterService\" cfg:type=\"string\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the name of the UNO service for importing the document.</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Flags\" cfg:type=\"int\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the properties of the filter</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:type-info>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:value-names>\n" ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_IMPORT , FILTERFLAG_IMPORT , "mark filter for import" ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_EXPORT , FILTERFLAG_EXPORT , "mark filter for export" ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_TEMPLATE , FILTERFLAG_TEMPLATE ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_INTERNAL , FILTERFLAG_INTERNAL ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_TEMPLATEPATH , FILTERFLAG_TEMPLATEPATH ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_OWN , FILTERFLAG_OWN ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_ALIEN , FILTERFLAG_ALIEN ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_USESOPTIONS , FILTERFLAG_USESOPTIONS ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_DEFAULT , FILTERFLAG_DEFAULT , "most important filter, if more then ones available" ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_NOTINFILEDIALOG , FILTERFLAG_NOTINFILEDIALOG, "don't show it in file dialogs!" ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_NOTINCHOOSER , FILTERFLAG_NOTINCHOOSER , "don't show it in chooser!" ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_ASYNCHRON , FILTERFLAG_ASYNCHRON ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_NOTINSTALLED , FILTERFLAG_NOTINSTALLED , "set, if the filter is not installed, but available on CD" ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_CONSULTSERVICE , FILTERFLAG_CONSULTSERVICE , "set, if the filter is not installed and not available an CD" ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_3RDPARTYFILTER , FILTERFLAG_3RDPARTYFILTER , "must set, if the filter is an external one" ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_PACKED , FILTERFLAG_PACKED ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_SILENTEXPORT , FILTERFLAG_SILENTEXPORT ); - impl_generateFilterFlagTemplate( FILTERFLAGNAME_PREFERED , FILTERFLAG_PREFERED ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t</schema:value-names>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:constraints xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\"/>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:type-info>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>0</default:data>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UserData\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the user-defined data</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data/>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"FileFormatVersion\" cfg:type=\"int\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<!--This should be removed to UserData later-->\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the file format version of the filter</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>0</default:data>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"TemplateName\" cfg:type=\"string\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<!--This should be removed to UserData later-->\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the template used for importing the file with the specified filter.</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n" ); - //_________________________________________________________________________________________________________________ - } - else if( m_aData.nVersionOutput>=3 ) - { - m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"Filter\">\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Installed\" cfg:type=\"boolean\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Make it possible to enable or disable filter by setup!</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<default:data>false</default:data>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UIName\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the external name of the filter which is displayed at the user interface (dialog).</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Data\" cfg:type=\"string\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>All data of filter written in own format. {Order, OldName, Type, DocumentService, FilterService, Flags, UserData, FilteFormatVersion, TemplateName}</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - - m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n" ); - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateFilterFlagTemplate( const ::rtl::OUString& sName, sal_Int32 nValue, const ::rtl::OString& sDescription ) -{ - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t\t<schema:named-value name=\"" ); - m_aData.sBufferStandard.append ( sName ); - m_aData.sBufferStandard.appendAscii( "\" value=\"" ); - m_aData.sBufferStandard.append ( nValue ); - m_aData.sBufferStandard.appendAscii( "\"" ); - - if( sDescription.getLength() > 0 ) - { - m_aData.sBufferStandard.appendAscii( ">\n\t\t\t\t\t\t\t<schema:description>" ); - m_aData.sBufferStandard.appendAscii( sDescription ); - m_aData.sBufferStandard.appendAscii( "</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t\t</schema:named-value>\n" ); - } - else - { - m_aData.sBufferStandard.appendAscii( "/>\n" ); - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateDetectorTemplate() -{ - m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"DetectService\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Types\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>List of types which the service has registered for.</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n" ); -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateLoaderTemplate() -{ - m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"FrameLoader\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"UIName\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>Specifies the external name of the filter which is displayed at the user interface (dialog).</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Types\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>List of types which the service has registered for.</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n" ); -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateContentHandlerTemplate() -{ - m_aData.sBufferStandard.appendAscii( "\t\t<schema:group cfg:name=\"ContentHandler\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t<schema:value cfg:name=\"Types\" cfg:type=\"string\" cfg:derivedBy=\"list\" cfg:writable=\"" ); - m_aData.sBufferStandard.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t<schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t\t<schema:description>List of types which could be handled by this service.</schema:description>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t\t</schema:documentation>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t</schema:value>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t</schema:group>\n" ); -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateTypeSet() -{ - if( m_aData.pFilterCache->hasTypes() == sal_False ) - { - // generate empty set! - m_aData.sBufferStandard.appendAscii ( "\t<schema:set cfg:name=\"Types\" cfg:element-type=\"Type\"/>\n" ); - - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - m_aData.sBufferAdditional.appendAscii( "\t<schema:set cfg:name=\"Types\" cfg:element-type=\"Type\" cfg:component=\"" ); - m_aData.sBufferAdditional.append ( m_aData.sPackageStandard ); - m_aData.sBufferAdditional.appendAscii( "\"/>\n" ); - } - } - else - { - // generate filled set - // open set - m_aData.sBufferStandard.appendAscii ( "\t<schema:set cfg:name=\"Types\" cfg:element-type=\"Type\">\n" ); - - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - m_aData.sBufferAdditional.appendAscii( "\t<schema:set cfg:name=\"Types\" cfg:element-type=\"Type\" cfg:component=\"" ); - m_aData.sBufferAdditional.append ( m_aData.sPackageStandard ); - m_aData.sBufferAdditional.appendAscii( "\">\n" ); - } - - css::uno::Sequence< ::rtl::OUString > lNames = m_aData.pFilterCache->getAllTypeNames(); - css::uno::Sequence< ::rtl::OUString > lEncNames ( lNames ) ; - sal_Int32 nCount = lNames.getLength() ; - sal_Int32 nItem = 0 ; - - XCDGenerator::impl_orderAlphabetical( lNames ); - - if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 ) - { - ::rtl::OUString sName ; - ::rtl::OUString sEncName; - for( nItem=0; nItem<nCount; ++nItem ) - { - sName = lNames[nItem] ; - lEncNames[nItem] = impl_encodeSetName( sName ); - } - } - - for( nItem=0; nItem<nCount; ++nItem ) - { - ::rtl::OUString sName = lNames[nItem] ; - FileType aItem = m_aData.pFilterCache->getType( sName ); - EFilterPackage ePackage ; - - ++m_aData.nWrittenTypes; - - if( m_aData.nVersionOutput==1 || m_aData.nVersionOutput==2 ) - { - // open set entry by using name - m_aData.sBufferStandard.appendAscii( "\t\t<default:group cfg:name=\"" ); - m_aData.sBufferStandard.append ( sName ); - m_aData.sBufferStandard.appendAscii( "\">\n" ); - - // write properties - impl_generateBoolProperty ( m_aData.sBufferStandard, SUBKEY_PREFERRED , aItem.bPreferred ); - impl_generateUINamesProperty ( m_aData.sBufferStandard, SUBKEY_UINAME , aItem.lUINames ); - impl_generateStringProperty ( m_aData.sBufferStandard, SUBKEY_MEDIATYPE , aItem.sMediaType ); - impl_generateStringProperty ( m_aData.sBufferStandard, SUBKEY_CLIPBOARDFORMAT , aItem.sClipboardFormat ); - impl_generateStringListProperty ( m_aData.sBufferStandard, SUBKEY_URLPATTERN , aItem.lURLPattern ); - impl_generateStringListProperty ( m_aData.sBufferStandard, SUBKEY_EXTENSIONS , aItem.lExtensions ); - impl_generateIntProperty ( m_aData.sBufferStandard, SUBKEY_DOCUMENTICONID , aItem.nDocumentIconID ); - - // close set node - m_aData.sBufferStandard.appendAscii( "\t\t</default:group>\n" ); - } - else if( m_aData.nVersionOutput >= 3 ) - { - ::rtl::OUString sPath = DECLARE_ASCII("org.openoffice.Office."); - ::rtl::OUStringBuffer* pXCDBuffer = &(m_aData.sBufferStandard ); - ::rtl::OUStringBuffer* pSCPBuffer = &(m_aData.sNew2OldSCPStandard ); - ::rtl::OUStringBuffer* pListBuffer = &(m_aData.sStandardTypeList ); - - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - XCDGenerator::impl_classifyType( m_aData, sName, ePackage ); - switch( ePackage ) - { - case E_ADDITIONAL : { - sPath += m_aData.sPackageAdditional ; - pXCDBuffer = &(m_aData.sBufferAdditional ); - pSCPBuffer = &(m_aData.sNew2OldSCPAdditional); - pListBuffer = &(m_aData.sAdditionalTypeList ); - } - } - } - else - { - sPath += m_aData.sPackageStandard; - } - - sPath += CFG_PATH_SEPERATOR ; - sPath += DECLARE_ASCII( "Types" ); - sPath += CFG_PATH_SEPERATOR ; - - pListBuffer->append ( sName ); - pListBuffer->appendAscii( "\n" ); - - if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 ) - { - pSCPBuffer->appendAscii( "\"" ); - pSCPBuffer->append ( sPath ); - pSCPBuffer->append ( lNames[nItem] ); - pSCPBuffer->appendAscii( "\"\t\"" ); - pSCPBuffer->append ( sPath ); - pSCPBuffer->appendAscii( "Type" ); - pSCPBuffer->append ( CFG_ENCODING_OPEN ); - pSCPBuffer->append ( lNames[nItem] ); - pSCPBuffer->append ( CFG_ENCODING_CLOSE ); - pSCPBuffer->appendAscii( "\"\n" ); - - sName = lEncNames[nItem]; - aItem.sName = sName; - } - - // open set entry by using name - pXCDBuffer->appendAscii( "\t\t<default:group cfg:name=\"" ); - pXCDBuffer->append ( sName ); - pXCDBuffer->appendAscii( "\">\n" ); - - // write properties - impl_generateUINamesProperty( *pXCDBuffer, SUBKEY_UINAME, aItem.lUINames ); - impl_generateStringProperty ( *pXCDBuffer, SUBKEY_DATA , FilterCFGAccess::encodeTypeData( aItem ) ); - - // close set node - pXCDBuffer->appendAscii( "\t\t</default:group>\n" ); - } - } - - // close set - m_aData.sBufferStandard.appendAscii( "\t</schema:set>\n" ); - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - m_aData.sBufferAdditional.appendAscii( "\t</schema:set>\n" ); - } - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateFilterSet() -{ - if( m_aData.pFilterCache->hasFilters() == sal_False ) - { - // write empty filter set. - m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"Filters\" cfg:element-type=\"Filter\"/>\n" ); - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - m_aData.sBufferAdditional.appendAscii( "\t<schema:set cfg:name=\"Filters\" cfg:element-type=\"Filter\" cfg:component=\"" ); - m_aData.sBufferAdditional.append ( m_aData.sPackageStandard ); - m_aData.sBufferAdditional.appendAscii( "\"/>\n" ); - } - } - else - { - // open set - m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"Filters\" cfg:element-type=\"Filter\">\n" ); - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - m_aData.sBufferAdditional.appendAscii( "\t<schema:set cfg:name=\"Filters\" cfg:element-type=\"Filter\" cfg:component=\"" ); - m_aData.sBufferAdditional.append ( m_aData.sPackageStandard ); - m_aData.sBufferAdditional.appendAscii( "\">\n" ); - } - - css::uno::Sequence< ::rtl::OUString > lNewNames = m_aData.pFilterCache->getAllFilterNames(); - css::uno::Sequence< ::rtl::OUString > lOldNames ( lNewNames ) ; - css::uno::Sequence< ::rtl::OUString > lEncNames ( lNewNames ) ; - sal_Int32 nCount = lNewNames.getLength() ; - sal_Int32 nItem = 0 ; - - XCDGenerator::impl_orderAlphabetical( lNewNames ); - - if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 ) - { - ::rtl::OUString sNewName; - ::rtl::OUString sOldName; - for( nItem=0; nItem<nCount; ++nItem ) - { - sNewName = lNewNames[nItem] ; - sOldName = impl_getOldFilterName ( sNewName ); - lOldNames[nItem] = sOldName ; - lEncNames[nItem] = impl_encodeSetName ( sOldName ); - } - } - - for( nItem=0; nItem<nCount; ++nItem ) - { - ::rtl::OUString sName = lNewNames[nItem] ; - Filter aItem = m_aData.pFilterCache->getFilter( lNewNames[nItem] ) ; - EFilterPackage ePackage ; - - ++m_aData.nWrittenFilters; - - if( m_aData.nVersionOutput==1 || m_aData.nVersionOutput==2 ) - { - // open set node by using name - m_aData.sBufferStandard.appendAscii( "\t\t<default:group cfg:name=\"" ); - m_aData.sBufferStandard.append ( sName ); - m_aData.sBufferStandard.appendAscii( "\">\n" ); - - // write properties - // Attention: - // We generate "Installed=false" for all entries ... because it's the default for all filters. - // You must work with a full office installation and change this to "true" in generated XML file!!! - impl_generateBoolProperty ( m_aData.sBufferStandard, SUBKEY_INSTALLED , sal_False ); - impl_generateIntProperty ( m_aData.sBufferStandard, SUBKEY_ORDER , aItem.nOrder ); - impl_generateStringProperty ( m_aData.sBufferStandard, SUBKEY_TYPE , aItem.sType ); - impl_generateUINamesProperty ( m_aData.sBufferStandard, SUBKEY_UINAME , aItem.lUINames ); - impl_generateStringProperty ( m_aData.sBufferStandard, SUBKEY_DOCUMENTSERVICE , aItem.sDocumentService ); - impl_generateStringProperty ( m_aData.sBufferStandard, SUBKEY_FILTERSERVICE , aItem.sFilterService ); - impl_generateIntProperty ( m_aData.sBufferStandard, SUBKEY_FLAGS , aItem.nFlags ); - impl_generateStringListProperty ( m_aData.sBufferStandard, SUBKEY_USERDATA , aItem.lUserData ); - impl_generateIntProperty ( m_aData.sBufferStandard, SUBKEY_FILEFORMATVERSION, aItem.nFileFormatVersion ); - impl_generateStringProperty ( m_aData.sBufferStandard, SUBKEY_TEMPLATENAME , aItem.sTemplateName ); - - // close set node - m_aData.sBufferStandard.appendAscii( "\t\t</default:group>\n" ); - } - else if( m_aData.nVersionOutput>=3 ) - { - ::rtl::OUString sPath = DECLARE_ASCII("org.openoffice.Office."); - ::rtl::OUStringBuffer* pXCDBuffer = &(m_aData.sBufferStandard ); - ::rtl::OUStringBuffer* pSCPBuffer = &(m_aData.sNew2OldSCPStandard ); - ::rtl::OUStringBuffer* pListBuffer = &(m_aData.sStandardFilterList ); - - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - XCDGenerator::impl_classifyFilter( m_aData, sName, ePackage, aItem.nOrder ); - switch( ePackage ) - { - case E_ADDITIONAL : { - sPath += m_aData.sPackageAdditional ; - pXCDBuffer = &(m_aData.sBufferAdditional ); - pSCPBuffer = &(m_aData.sNew2OldSCPAdditional); - pListBuffer = &(m_aData.sAdditionalFilterList); - } - } - } - else - { - sPath += m_aData.sPackageStandard; - } - - sPath += CFG_PATH_SEPERATOR ; - sPath += DECLARE_ASCII( "Filters" ); - sPath += CFG_PATH_SEPERATOR ; - - pListBuffer->append ( sName ); - pListBuffer->appendAscii( "\n" ); - - if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 ) - { - pSCPBuffer->appendAscii( "\"" ); - pSCPBuffer->append ( sPath ); - pSCPBuffer->append ( lNewNames[nItem] ); - pSCPBuffer->appendAscii( "\"\t\"" ); - pSCPBuffer->append ( sPath ); - pSCPBuffer->appendAscii( "Filter" ); - pSCPBuffer->append ( CFG_ENCODING_OPEN ); - pSCPBuffer->append ( lOldNames[nItem] ); - pSCPBuffer->append ( CFG_ENCODING_CLOSE ); - pSCPBuffer->appendAscii( "\"\n" ); - - sName = lEncNames[nItem]; - aItem.sName = sName; - } - - // open set node by using name - pXCDBuffer->appendAscii( "\t\t<default:group cfg:name=\"" ); - pXCDBuffer->append ( sName ); - pXCDBuffer->appendAscii( "\">\n" ); - - // write properties - // Attention: - // We generate "Installed=false" for all entries ... because it's the default for all filters. - // You must work with a full office installation and change this to "true" in generated XML file!!! - impl_generateBoolProperty ( *pXCDBuffer, SUBKEY_INSTALLED, sal_False ); - impl_generateUINamesProperty( *pXCDBuffer, SUBKEY_UINAME , aItem.lUINames ); - impl_generateStringProperty ( *pXCDBuffer, SUBKEY_DATA , FilterCFGAccess::encodeFilterData( aItem ) ); - - // close set node - pXCDBuffer->appendAscii( "\t\t</default:group>\n" ); - } - } - - // close set - m_aData.sBufferStandard.appendAscii( "\t</schema:set>\n" ); - if( m_aData.nVersionOutput >= DRAFT_SPLIT_VERSION ) - { - m_aData.sBufferAdditional.appendAscii( "\t</schema:set>\n" ); - } - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateDetectorSet() -{ - if( m_aData.pFilterCache->hasDetectors() == sal_False ) - { - // write empty detector set! - m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"DetectServices\" cfg:element-type=\"DetectService\"/>\n" ); - } - else - { - // open set - m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"DetectServices\" cfg:element-type=\"DetectService\">\n" ); - - css::uno::Sequence< ::rtl::OUString > lNames = m_aData.pFilterCache->getAllDetectorNames(); - css::uno::Sequence< ::rtl::OUString > lEncNames ( lNames ) ; - sal_Int32 nCount = lNames.getLength() ; - sal_Int32 nItem = 0 ; - - XCDGenerator::impl_orderAlphabetical( lNames ); - - if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 ) - { - ::rtl::OUString sName ; - ::rtl::OUString sEncName; - for( nItem=0; nItem<nCount; ++nItem ) - { - sName = lNames[nItem] ; - lEncNames[nItem] = impl_encodeSetName( sName ); - - m_aData.sNew2OldSCPStandard.appendAscii ( "org.openoffice.Office." ); - m_aData.sNew2OldSCPStandard.append ( m_aData.sPackageStandard ); - m_aData.sNew2OldSCPStandard.append ( CFG_PATH_SEPERATOR ); - m_aData.sNew2OldSCPStandard.append ( sName ); - m_aData.sNew2OldSCPStandard.appendAscii ( "\torg.openoffice.Office."); - m_aData.sNew2OldSCPStandard.append ( m_aData.sPackageStandard ); - m_aData.sNew2OldSCPStandard.append ( CFG_PATH_SEPERATOR ); - m_aData.sNew2OldSCPStandard.appendAscii ( "DetectService" ); - m_aData.sNew2OldSCPStandard.append ( CFG_ENCODING_OPEN ); - m_aData.sNew2OldSCPStandard.append ( sName ); - m_aData.sNew2OldSCPStandard.append ( CFG_ENCODING_CLOSE ); - m_aData.sNew2OldSCPStandard.appendAscii ( "\n" ); - } - } - - for( nItem=0; nItem<nCount; ++nItem ) - { - ::rtl::OUString sName = lNames[nItem] ; - Detector aItem = m_aData.pFilterCache->getDetector( sName ); - - if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 ) - { - sName = lEncNames[nItem]; - } - - ++m_aData.nWrittenDetectors; - - // open set node by using name - m_aData.sBufferStandard.appendAscii( "\t\t<default:group cfg:name=\"" ); - m_aData.sBufferStandard.append ( sName ); - m_aData.sBufferStandard.appendAscii( "\">\n" ); - - // write properties - impl_generateStringListProperty ( m_aData.sBufferStandard, SUBKEY_TYPES, aItem.lTypes ); - - // close set node - m_aData.sBufferStandard.appendAscii( "\t\t</default:group>\n" ); - } - - // close set - m_aData.sBufferStandard.appendAscii( "\t</schema:set>\n" ); - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateLoaderSet() -{ - if( m_aData.pFilterCache->hasLoaders() == sal_False ) - { - // write empty loader set! - m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"FrameLoaders\" cfg:element-type=\"FrameLoader\"/>\n" ); - } - else - { - // open set - m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"FrameLoaders\" cfg:element-type=\"FrameLoader\">\n" ); - - css::uno::Sequence< ::rtl::OUString > lNames = m_aData.pFilterCache->getAllLoaderNames(); - css::uno::Sequence< ::rtl::OUString > lEncNames ( lNames ) ; - sal_Int32 nCount = lNames.getLength() ; - sal_Int32 nItem = 0 ; - - XCDGenerator::impl_orderAlphabetical( lNames ); - - if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 ) - { - ::rtl::OUString sName ; - ::rtl::OUString sEncName; - for( nItem=0; nItem<nCount; ++nItem ) - { - sName = lNames[nItem] ; - lEncNames[nItem] = impl_encodeSetName( sName ); - - m_aData.sNew2OldSCPStandard.appendAscii ( "org.openoffice.Office." ); - m_aData.sNew2OldSCPStandard.append ( m_aData.sPackageStandard ); - m_aData.sNew2OldSCPStandard.append ( CFG_PATH_SEPERATOR ); - m_aData.sNew2OldSCPStandard.append ( sName ); - m_aData.sNew2OldSCPStandard.appendAscii ( "\torg.openoffice.Office."); - m_aData.sNew2OldSCPStandard.append ( m_aData.sPackageStandard ); - m_aData.sNew2OldSCPStandard.append ( CFG_PATH_SEPERATOR ); - m_aData.sNew2OldSCPStandard.appendAscii ( "FrameLoader" ); - m_aData.sNew2OldSCPStandard.append ( CFG_ENCODING_OPEN ); - m_aData.sNew2OldSCPStandard.append ( sName ); - m_aData.sNew2OldSCPStandard.append ( CFG_ENCODING_CLOSE ); - m_aData.sNew2OldSCPStandard.appendAscii ( "\n" ); - } - } - - for( nItem=0; nItem<nCount; ++nItem ) - { - ::rtl::OUString sName = lNames[nItem] ; - Loader aItem = m_aData.pFilterCache->getLoader( sName ); - - if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 ) - { - sName = lEncNames[nItem]; - } - - ++m_aData.nWrittenLoaders; - - // open set node by using name - m_aData.sBufferStandard.appendAscii( "\t\t<default:group cfg:name=\"" ); - m_aData.sBufferStandard.append ( sName ); - m_aData.sBufferStandard.appendAscii( "\">\n" ); - - // write properties - impl_generateUINamesProperty ( m_aData.sBufferStandard, SUBKEY_UINAME, aItem.lUINames ); - impl_generateStringListProperty ( m_aData.sBufferStandard, SUBKEY_TYPES , aItem.lTypes ); - - // close set node - m_aData.sBufferStandard.appendAscii( "\t\t</default:group>\n" ); - } - - // close set - m_aData.sBufferStandard.appendAscii( "\t</schema:set>\n" ); - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateDefaults() -{ - // open group - m_aData.sBufferStandard.appendAscii( "\t<schema:group cfg:name=\"Defaults\">\n" ); - - // write generic loader - m_aData.sBufferStandard.appendAscii( "\t\t<schema:value cfg:name=\"FrameLoader\" cfg:type=\"string\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t<default:data>" ); - m_aData.sBufferStandard.append ( m_aData.pFilterCache->getDefaultLoader() ); - m_aData.sBufferStandard.appendAscii( "</default:data>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t</schema:value>\n" ); - - // write default detector - m_aData.sBufferStandard.appendAscii( "\t\t<schema:value cfg:name=\"DetectService\" cfg:type=\"string\">\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t\t<default:data>" ); - m_aData.sBufferStandard.append ( m_aData.pFilterCache->getDefaultDetector() ); - m_aData.sBufferStandard.appendAscii( "</default:data>\n" ); - m_aData.sBufferStandard.appendAscii( "\t\t</schema:value>\n" ); - - // close group - m_aData.sBufferStandard.appendAscii( "\t</schema:group>\n" ); -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateContentHandlerSet() -{ - if( m_aData.pFilterCache->hasContentHandlers() == sal_False ) - { - // write empty handler set! - m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"ContentHandlers\" cfg:element-type=\"ContentHandler\"/>\n" ); - } - else - { - // open set - m_aData.sBufferStandard.appendAscii( "\t<schema:set cfg:name=\"ContentHandlers\" cfg:element-type=\"ContentHandler\">\n" ); - - css::uno::Sequence< ::rtl::OUString > lNames = m_aData.pFilterCache->getAllContentHandlerNames(); - css::uno::Sequence< ::rtl::OUString > lEncNames ( lNames ) ; - sal_Int32 nCount = lNames.getLength() ; - sal_Int32 nItem = 0 ; - - XCDGenerator::impl_orderAlphabetical( lNames ); - - if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 ) - { - ::rtl::OUString sName ; - ::rtl::OUString sEncName; - for( nItem=0; nItem<nCount; ++nItem ) - { - sName = lNames[nItem] ; - lEncNames[nItem] = impl_encodeSetName( sName ); - - m_aData.sNew2OldSCPStandard.appendAscii ( "org.openoffice.Office." ); - m_aData.sNew2OldSCPStandard.append ( m_aData.sPackageStandard ); - m_aData.sNew2OldSCPStandard.append ( CFG_PATH_SEPERATOR ); - m_aData.sNew2OldSCPStandard.append ( sName ); - m_aData.sNew2OldSCPStandard.appendAscii ( "\torg.openoffice.Office."); - m_aData.sNew2OldSCPStandard.append ( m_aData.sPackageStandard ); - m_aData.sNew2OldSCPStandard.append ( CFG_PATH_SEPERATOR ); - m_aData.sNew2OldSCPStandard.appendAscii ( "ContentHandler" ); - m_aData.sNew2OldSCPStandard.append ( CFG_ENCODING_OPEN ); - m_aData.sNew2OldSCPStandard.append ( sName ); - m_aData.sNew2OldSCPStandard.append ( CFG_ENCODING_CLOSE ); - m_aData.sNew2OldSCPStandard.appendAscii ( "\n" ); - } - } - - for( nItem=0; nItem<nCount; ++nItem ) - { - ::rtl::OUString sName = lNames[nItem] ; - ContentHandler aItem = m_aData.pFilterCache->getContentHandler( sName ); - - if( m_aData.nVersionOutput == 6 && m_aData.nVersionInput < 6 ) - { - sName = lEncNames[nItem]; - } - - ++m_aData.nWrittenContentHandlers; - - // open set node by using name - m_aData.sBufferStandard.appendAscii( "\t\t<default:group cfg:name=\"" ); - m_aData.sBufferStandard.append ( sName ); - m_aData.sBufferStandard.appendAscii( "\">\n" ); - - // write properties - impl_generateStringListProperty( m_aData.sBufferStandard, SUBKEY_TYPES, aItem.lTypes ); - - // close set node - m_aData.sBufferStandard.appendAscii( "\t\t</default:group>\n" ); - } - - // close set - m_aData.sBufferStandard.appendAscii( "\t</schema:set>\n" ); - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateIntProperty( ::rtl::OUStringBuffer& sXCD , - const ::rtl::OUString& sName , - sal_Int32 nValue ) -{ - sXCD.appendAscii( "\t\t\t<default:value cfg:name=\"" ); - sXCD.append ( sName ); - sXCD.appendAscii( "\" cfg:type=\"int\" cfg:writable=\"" ); - sXCD.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - sXCD.appendAscii( "\t\t\t\t<default:data>" ); - sXCD.append ( (sal_Int32)(nValue) ); - sXCD.appendAscii( "</default:data>\n\t\t\t</default:value>\n" ); -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateBoolProperty( ::rtl::OUStringBuffer& sXCD , - const ::rtl::OUString& sName , - sal_Bool bValue ) -{ - sXCD.appendAscii( "\t\t\t<default:value cfg:name=\"" ); - sXCD.append ( sName ); - sXCD.appendAscii( "\" cfg:type=\"boolean\" cfg:writable=\"" ); - sXCD.appendAscii( m_aData.bWriteable==sal_True ? "true\">\n" : "false\">\n" ); - sXCD.appendAscii( "\t\t\t\t<default:data>" ); - sXCD.appendAscii( bValue==sal_True ? "true" : "false" ); - sXCD.appendAscii( "</default:data>\n\t\t\t</default:value>\n" ); -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateStringProperty( ::rtl::OUStringBuffer& sXCD , - const ::rtl::OUString& sName , - const ::rtl::OUString& sValue ) -{ - sXCD.appendAscii( "\t\t\t<default:value cfg:name=\"" ); - sXCD.append ( sName ); - sXCD.appendAscii( "\" cfg:type=\"string\" cfg:writable=\"" ); - sXCD.appendAscii( m_aData.bWriteable==sal_True ? "true\"" : "false\"" ); - if( sValue.getLength() > 0 ) - { - sXCD.appendAscii( ">\n\t\t\t\t<default:data>" ); - sXCD.append ( XCDGenerator::impl_encodeSpecialSigns( sValue ) ); - sXCD.appendAscii( "</default:data>\n\t\t\t</default:value>\n" ); - } - else - { - sXCD.appendAscii( "/>\n" ); - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateStringListProperty( ::rtl::OUStringBuffer& sXCD , - const ::rtl::OUString& sName , - const ::framework::StringList& lValue ) -{ - sXCD.appendAscii( "\t\t\t<default:value cfg:name=\"" ); - sXCD.append ( sName ); - sXCD.appendAscii( "\" cfg:type=\"string\" cfg:derivedBy=\"list\"" ); - - sal_Unicode cSeperator = XCDGenerator::impl_defineSeperator( lValue ); - if( cSeperator != ' ' ) - { - sXCD.appendAscii( " cfg:separator=\"" ); - sXCD.append ( cSeperator ); - sXCD.appendAscii( "\"" ); - } - - sXCD.appendAscii( " cfg:writable=\"" ); - sXCD.appendAscii( m_aData.bWriteable==sal_True ? "true\"" : "false\"" ); - - sal_Int32 nCount = (sal_Int32)(lValue.size()); - sal_Int32 nPosition = 1; - - if( nCount > 0 ) - { - sXCD.appendAscii( ">\n\t\t\t\t<default:data>" ); - for( ConstStringListIterator pEntry=lValue.begin(); pEntry!=lValue.end(); ++pEntry ) - { - sXCD.append( *pEntry ); - if( nPosition < nCount ) - { - // Seperator for lists allowed only between two values! - // Don't write leading or leaving seperators ... - sXCD.append( cSeperator ); - } - ++nPosition; - } - sXCD.appendAscii( "</default:data>\n\t\t\t</default:value>\n" ); - } - else - { - sXCD.appendAscii( "/>\n" ); - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_generateUINamesProperty( ::rtl::OUStringBuffer& sXCD , - const ::rtl::OUString& sName , - const StringHash& lUINames ) -{ - sXCD.appendAscii( "\t\t\t<default:value cfg:name=\"" ); - sXCD.append ( sName ); - sXCD.appendAscii( "\" cfg:type=\"string\" cfg:localized=\"true\" cfg:writable=\"" ); - sXCD.appendAscii( m_aData.bWriteable==sal_True ? "true\"" : "false\"" ); - - if( lUINames.size() > 0 ) - { - sXCD.appendAscii( ">\n" ); - - // Search for localized values, which doesn't need full localized set ... - // because all values for all locales are the same! - sal_Bool bDifferent = sal_False ; - ConstStringHashIterator pUIName = lUINames.begin(); - ::rtl::OUString sUIName = pUIName->second ; - while( pUIName!=lUINames.end() ) - { - if( sUIName != pUIName->second ) - { - bDifferent = sal_True; - break; - } - ++pUIName; - } - - // Generate full localized set, if some values are realy loclaized. - if( bDifferent == sal_True ) - { - for( ConstStringHashIterator pUIName=lUINames.begin(); pUIName!=lUINames.end(); ++pUIName ) - { - sXCD.appendAscii( "\t\t\t\t<default:data xml:lang=\"" ); - sXCD.append ( pUIName->first ); - sXCD.appendAscii( "\">" ); - sXCD.append ( XCDGenerator::impl_encodeSpecialSigns( pUIName->second ) ); - sXCD.appendAscii( "</default:data>\n" ); - } - } - // Generate ONE entry as default for our configuration if all localized values are equal! - else - { - sXCD.appendAscii( "\t\t\t\t<default:data xml:lang=\"" ); - sXCD.appendAscii( "en-US" ); - sXCD.appendAscii( "\">" ); - sXCD.append ( XCDGenerator::impl_encodeSpecialSigns( lUINames.find(DECLARE_ASCII("en-US"))->second )); - sXCD.appendAscii( "</default:data>\n" ); - } - sXCD.appendAscii( "\t\t\t</default:value>\n" ); - } - else - { - sXCD.appendAscii( "/>\n" ); - } -} - -//***************************************************************************************************************** -::rtl::OUString XCDGenerator::impl_encodeSpecialSigns( const ::rtl::OUString& sValue ) -{ - ::rtl::OUStringBuffer sSource ( sValue ); - ::rtl::OUStringBuffer sDestination( 10000 ); - sal_Int32 nCount = sValue.getLength(); - sal_Int32 i = 0; - - for( i=0; i<nCount; ++i ) - { - sal_Unicode cSign = sSource.charAt(i); - switch( cSign ) - { - // code &, ", ', <, > ... - case '&' : sDestination.appendAscii( "&" ); - break; - case '<' : sDestination.appendAscii( "<" ); - break; - case '>' : sDestination.appendAscii( ">" ); - break; - case '\'': sDestination.appendAscii( "’" ); - break; - case '\"': sDestination.appendAscii( """ ); - break; - // copy all other letters - default : sDestination.append( cSign ); - break; - } - } - - return sDestination.makeStringAndClear(); -} - -//***************************************************************************************************************** -// Step over all elements of list to find one seperator, which isn't used for any value in list. -// We return an empty string if list contains no elements - because we must disable writing of -// "... cfg:seperator="<seperatorvalue> ..." -// => Otherwise we get a Sequence< OUString > with one empty element from configuration!!! -sal_Unicode XCDGenerator::impl_defineSeperator( const ::framework::StringList& lList ) -{ - static cSeperator1 = ' '; - static cSeperator2 = ';'; - static cSeperator3 = '+'; - static cSeperator4 = '-'; - static cSeperator5 = '*'; - - // Start with first seperator. - // Step over all list items. - // If one item contains this seperator - try next one! - // If no new one avaliable (5 tests failed!) - show an error message for user. - // => File will be wrong then! - // If seperator was changed start search during list again ... because - // new seperator could exist at already compared elements! - - sal_Unicode cSeperator = cSeperator1 ; - sal_Bool bOK = sal_False ; - ConstStringListIterator pItem = lList.begin(); - - while( bOK == sal_False ) - { - if( pItem == lList.end() ) - { - bOK = sal_True; - } - else - { - while( pItem!=lList.end() ) - { - if( pItem->indexOf( cSeperator, 0 ) != -1 ) - { - if( cSeperator == cSeperator1 ) - { - cSeperator = cSeperator2; - pItem = lList.begin(); - break; - } - else - if( cSeperator == cSeperator2 ) - { - cSeperator = cSeperator3; - pItem = lList.begin(); - break; - } - else - if( cSeperator == cSeperator3 ) - { - cSeperator = cSeperator4; - pItem = lList.begin(); - break; - } - else - if( cSeperator == cSeperator4 ) - { - cSeperator = cSeperator5; - pItem = lList.begin(); - break; - } - else - if( cSeperator == cSeperator5 ) - { - LOG_ERROR( "XCDGenerator::impl_defineSeperator()", "Can't find seperator for given list! Generated XCD file will be wrong!" ) - exit(-1); - } - } - else - { - ++pItem; - } - } - } - } - - return cSeperator; -} - -//***************************************************************************************************************** -void XCDGenerator::impl_initFilterHashNew2Old( StringHash& aHash ) -{ - // key = new filter name, value = old name - aHash[DECLARE_ASCII("writer_StarOffice_XML_Writer" )] = DECLARE_ASCII("swriter: StarOffice XML (Writer)" ); - aHash[DECLARE_ASCII("writer_StarWriter_50" )] = DECLARE_ASCII("swriter: StarWriter 5.0" ); - aHash[DECLARE_ASCII("writer_StarWriter_50_VorlageTemplate" )] = DECLARE_ASCII("swriter: StarWriter 5.0 Vorlage/Template" ); - aHash[DECLARE_ASCII("writer_StarWriter_40" )] = DECLARE_ASCII("swriter: StarWriter 4.0" ); - aHash[DECLARE_ASCII("writer_StarWriter_40_VorlageTemplate" )] = DECLARE_ASCII("swriter: StarWriter 4.0 Vorlage/Template" ); - aHash[DECLARE_ASCII("writer_StarWriter_30" )] = DECLARE_ASCII("swriter: StarWriter 3.0" ); - aHash[DECLARE_ASCII("writer_StarWriter_30_VorlageTemplate" )] = DECLARE_ASCII("swriter: StarWriter 3.0 Vorlage/Template" ); - aHash[DECLARE_ASCII("writer_StarWriter_20" )] = DECLARE_ASCII("swriter: StarWriter 2.0" ); - aHash[DECLARE_ASCII("writer_StarWriter_10" )] = DECLARE_ASCII("swriter: StarWriter 1.0" ); - aHash[DECLARE_ASCII("writer_StarWriter_DOS" )] = DECLARE_ASCII("swriter: StarWriter DOS" ); - aHash[DECLARE_ASCII("writer_HTML_StarWriter" )] = DECLARE_ASCII("swriter: HTML (StarWriter)" ); - aHash[DECLARE_ASCII("writer_Text" )] = DECLARE_ASCII("swriter: Text" ); - aHash[DECLARE_ASCII("writer_Text_Unix" )] = DECLARE_ASCII("swriter: Text Unix" ); - aHash[DECLARE_ASCII("writer_Text_Mac" )] = DECLARE_ASCII("swriter: Text Mac" ); - aHash[DECLARE_ASCII("writer_Text_DOS" )] = DECLARE_ASCII("swriter: Text DOS" ); - aHash[DECLARE_ASCII("writer_Rich_Text_Format" )] = DECLARE_ASCII("swriter: Rich Text Format" ); - aHash[DECLARE_ASCII("writer_MS_Word_97" )] = DECLARE_ASCII("swriter: MS Word 97" ); - aHash[DECLARE_ASCII("writer_MS_Word_95" )] = DECLARE_ASCII("swriter: MS Word 95" ); - aHash[DECLARE_ASCII("writer_MS_Word_97_Vorlage" )] = DECLARE_ASCII("swriter: MS Word 97 Vorlage" ); - aHash[DECLARE_ASCII("writer_MS_Word_95_Vorlage" )] = DECLARE_ASCII("swriter: MS Word 95 Vorlage" ); - aHash[DECLARE_ASCII("writer_MS_WinWord_60" )] = DECLARE_ASCII("swriter: MS WinWord 6.0" ); - aHash[DECLARE_ASCII("writer_MS_Word_6x_W4W" )] = DECLARE_ASCII("swriter: MS Word 6.x (W4W)" ); - aHash[DECLARE_ASCII("writer_MS_WinWord_5" )] = DECLARE_ASCII("swriter: MS WinWord 5" ); - aHash[DECLARE_ASCII("writer_MS_WinWord_2x_W4W" )] = DECLARE_ASCII("swriter: MS WinWord 2.x (W4W)" ); - aHash[DECLARE_ASCII("writer_MS_MacWord_5x_W4W" )] = DECLARE_ASCII("swriter: MS MacWord 5.x (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_Win_61_W4W" )] = DECLARE_ASCII("swriter: WordPerfect (Win) 6.1 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_Win_70_W4W" )] = DECLARE_ASCII("swriter: WordPerfect (Win) 7.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordStar_Win_1x_20_W4W" )] = DECLARE_ASCII("swriter: WordStar (Win) 1.x-2.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordStar_70_W4W" )] = DECLARE_ASCII("swriter: WordStar 7.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_Ami_Pro_11_12_W4W" )] = DECLARE_ASCII("swriter: Ami Pro 1.1-1.2 (W4W)" ); - aHash[DECLARE_ASCII("writer_Ami_Pro_20_31_W4W" )] = DECLARE_ASCII("swriter: Ami Pro 2.0-3.1 (W4W)" ); - aHash[DECLARE_ASCII("writer_MS_Excel_40_StarWriter" )] = DECLARE_ASCII("swriter: MS Excel 4.0 (StarWriter)" ); - aHash[DECLARE_ASCII("writer_MS_Excel_50_StarWriter" )] = DECLARE_ASCII("swriter: MS Excel 5.0 (StarWriter)" ); - aHash[DECLARE_ASCII("writer_MS_Excel_95_StarWriter" )] = DECLARE_ASCII("swriter: MS Excel 95 (StarWriter)" ); - aHash[DECLARE_ASCII("writer_MS_Works_20_DOS_W4W" )] = DECLARE_ASCII("swriter: MS Works 2.0 DOS (W4W)" ); - aHash[DECLARE_ASCII("writer_MS_Works_30_Win_W4W" )] = DECLARE_ASCII("swriter: MS Works 3.0 Win (W4W)" ); - aHash[DECLARE_ASCII("writer_Lotus_1_2_3_10_DOS_StarWriter" )] = DECLARE_ASCII("swriter: Lotus 1-2-3 1.0 (DOS) (StarWriter)" ); - aHash[DECLARE_ASCII("writer_Lotus_1_2_3_10_WIN_StarWriter" )] = DECLARE_ASCII("swriter: Lotus 1-2-3 1.0 (WIN) (StarWriter)" ); - aHash[DECLARE_ASCII("writer_Frame_Maker_MIF_50_W4W" )] = DECLARE_ASCII("swriter: Frame Maker MIF 5.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_Win_Write_3x_W4W" )] = DECLARE_ASCII("swriter: Win Write 3.x (W4W)" ); - aHash[DECLARE_ASCII("writer_Text_encoded" )] = DECLARE_ASCII("swriter: Text (encoded)" ); - aHash[DECLARE_ASCII("writer_MS_WinWord_1x_W4W" )] = DECLARE_ASCII("swriter: MS WinWord 1.x (W4W)" ); - aHash[DECLARE_ASCII("writer_MS_Word_5x_W4W" )] = DECLARE_ASCII("swriter: MS Word 5.x (W4W)" ); - aHash[DECLARE_ASCII("writer_MS_Word_4x_W4W" )] = DECLARE_ASCII("swriter: MS Word 4.x (W4W)" ); - aHash[DECLARE_ASCII("writer_MS_Word_3x_W4W" )] = DECLARE_ASCII("swriter: MS Word 3.x (W4W)" ); - aHash[DECLARE_ASCII("writer_MS_MacWord_40_W4W" )] = DECLARE_ASCII("swriter: MS MacWord 4.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_MS_MacWord_30_W4W" )] = DECLARE_ASCII("swriter: MS MacWord 3.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_Mac_1_W4W" )] = DECLARE_ASCII("swriter: WordPerfect Mac 1 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_Mac_2_W4W" )] = DECLARE_ASCII("swriter: WordPerfect Mac 2 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_Mac_3_W4W" )] = DECLARE_ASCII("swriter: WordPerfect Mac 3 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_Win_51_52_W4W" )] = DECLARE_ASCII("swriter: WordPerfect (Win) 5.1-5.2 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_Win_60_W4W" )] = DECLARE_ASCII("swriter: WordPerfect (Win) 6.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_41_W4W" )] = DECLARE_ASCII("swriter: WordPerfect 4.1 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_42_W4W" )] = DECLARE_ASCII("swriter: WordPerfect 4.2 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_50_W4W" )] = DECLARE_ASCII("swriter: WordPerfect 5.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_51_W4W" )] = DECLARE_ASCII("swriter: WordPerfect 5.1 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_60_W4W" )] = DECLARE_ASCII("swriter: WordPerfect 6.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordPerfect_61_W4W" )] = DECLARE_ASCII("swriter: WordPerfect 6.1 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordStar_2000_Rel_30_W4W" )] = DECLARE_ASCII("swriter: WordStar 2000 Rel. 3.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordStar_2000_Rel_35_W4W" )] = DECLARE_ASCII("swriter: WordStar 2000 Rel. 3.5 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordStar_33x_W4W" )] = DECLARE_ASCII("swriter: WordStar 3.3x (W4W)" ); - aHash[DECLARE_ASCII("writer_WordStar_345_W4W" )] = DECLARE_ASCII("swriter: WordStar 3.45 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordStar_40_W4W" )] = DECLARE_ASCII("swriter: WordStar 4.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordStar_50_W4W" )] = DECLARE_ASCII("swriter: WordStar 5.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordStar_55_W4W" )] = DECLARE_ASCII("swriter: WordStar 5.5 (W4W)" ); - aHash[DECLARE_ASCII("writer_WordStar_60_W4W" )] = DECLARE_ASCII("swriter: WordStar 6.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_MS_Works_40_Mac_W4W" )] = DECLARE_ASCII("swriter: MS Works 4.0 Mac (W4W)" ); - aHash[DECLARE_ASCII("writer_Mac_Write_4x_50_W4W" )] = DECLARE_ASCII("swriter: Mac Write 4.x 5.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_Mac_Write_II_W4W" )] = DECLARE_ASCII("swriter: Mac Write II (W4W)" ); - aHash[DECLARE_ASCII("writer_Mac_Write_Pro_W4W" )] = DECLARE_ASCII("swriter: Mac Write Pro (W4W)" ); - aHash[DECLARE_ASCII("writer_Lotus_Manuscript_W4W" )] = DECLARE_ASCII("swriter: Lotus Manuscript (W4W)" ); - aHash[DECLARE_ASCII("writer_MASS_11_Rel_80_83_W4W" )] = DECLARE_ASCII("swriter: MASS 11 Rel. 8.0-8.3 (W4W)" ); - aHash[DECLARE_ASCII("writer_MASS_11_Rel_85_90_W4W" )] = DECLARE_ASCII("swriter: MASS 11 Rel. 8.5-9.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_Claris_Works_W4W" )] = DECLARE_ASCII("swriter: Claris Works (W4W)" ); - aHash[DECLARE_ASCII("writer_CTOS_DEF_W4W" )] = DECLARE_ASCII("swriter: CTOS DEF (W4W)" ); - aHash[DECLARE_ASCII("writer_OfficeWriter_40_W4W" )] = DECLARE_ASCII("swriter: OfficeWriter 4.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_OfficeWriter_50_W4W" )] = DECLARE_ASCII("swriter: OfficeWriter 5.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_OfficeWriter_6x_W4W" )] = DECLARE_ASCII("swriter: OfficeWriter 6.x (W4W)" ); - aHash[DECLARE_ASCII("writer_XyWrite_III_W4W" )] = DECLARE_ASCII("swriter: XyWrite III ( W4W)" ); - aHash[DECLARE_ASCII("writer_XyWrite_IIIP_W4W" )] = DECLARE_ASCII("swriter: XyWrite III+ ( W4W)" ); - aHash[DECLARE_ASCII("writer_XyWrite_Signature_W4W" )] = DECLARE_ASCII("swriter: XyWrite Signature (W4W)" ); - aHash[DECLARE_ASCII("writer_XyWrite_Sig_Win_W4W" )] = DECLARE_ASCII("swriter: XyWrite Sig. (Win) (W4W)" ); - aHash[DECLARE_ASCII("writer_XyWrite_IV_W4W" )] = DECLARE_ASCII("swriter: XyWrite IV (W4W)" ); - aHash[DECLARE_ASCII("writer_XyWrite_Win_10_W4W" )] = DECLARE_ASCII("swriter: XyWrite (Win) 1.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_XEROX_XIF_50_W4W" )] = DECLARE_ASCII("swriter: XEROX XIF 5.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_XEROX_XIF_50_Illustrator_W4W" )] = DECLARE_ASCII("swriter: XEROX XIF 5.0 (Illustrator) (W4W)" ); - aHash[DECLARE_ASCII("writer_XEROX_XIF_60_Color_Bitmap_W4W" )] = DECLARE_ASCII("swriter: XEROX XIF 6.0 (Color Bitmap) (W4W)" ); - aHash[DECLARE_ASCII("writer_XEROX_XIF_60_Res_Graphic_W4W" )] = DECLARE_ASCII("swriter: XEROX XIF 6.0 (Res Graphic) (W4W)" ); - aHash[DECLARE_ASCII("writer_WriteNow_30_Macintosh_W4W" )] = DECLARE_ASCII("swriter: WriteNow 3.0 (Macintosh) (W4W)" ); - aHash[DECLARE_ASCII("writer_Writing_Assistant_W4W" )] = DECLARE_ASCII("swriter: Writing Assistant (W4W)" ); - aHash[DECLARE_ASCII("writer_VolksWriter_Deluxe_W4W" )] = DECLARE_ASCII("swriter: VolksWriter Deluxe (W4W)" ); - aHash[DECLARE_ASCII("writer_VolksWriter_3_and_4_W4W" )] = DECLARE_ASCII("swriter: VolksWriter 3 and 4 (W4W)" ); - aHash[DECLARE_ASCII("writer_MultiMate_33_W4W" )] = DECLARE_ASCII("swriter: MultiMate 3.3 (W4W)" ); - aHash[DECLARE_ASCII("writer_MultiMate_Adv_36_W4W" )] = DECLARE_ASCII("swriter: MultiMate Adv. 3.6 (W4W)" ); - aHash[DECLARE_ASCII("writer_MultiMate_Adv_II_37_W4W" )] = DECLARE_ASCII("swriter: MultiMate Adv. II 3.7 (W4W)" ); - aHash[DECLARE_ASCII("writer_MultiMate_4_W4W" )] = DECLARE_ASCII("swriter: MultiMate 4 (W4W)" ); - aHash[DECLARE_ASCII("writer_NAVY_DIF_W4W" )] = DECLARE_ASCII("swriter: NAVY DIF (W4W)" ); - aHash[DECLARE_ASCII("writer_PFS_Write_W4W" )] = DECLARE_ASCII("swriter: PFS Write (W4W)" ); - aHash[DECLARE_ASCII("writer_PFS_First_Choice_10_W4W" )] = DECLARE_ASCII("swriter: PFS First Choice 1.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_PFS_First_Choice_20_W4W" )] = DECLARE_ASCII("swriter: PFS First Choice 2.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_PFS_First_Choice_30_W4W" )] = DECLARE_ASCII("swriter: PFS First Choice 3.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_Professional_Write_10_W4W" )] = DECLARE_ASCII("swriter: Professional Write 1.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_Professional_Write_2x_W4W" )] = DECLARE_ASCII("swriter: Professional Write 2.x (W4W)" ); - aHash[DECLARE_ASCII("writer_Professional_Write_Plus_W4W" )] = DECLARE_ASCII("swriter: Professional Write Plus (W4W)" ); - aHash[DECLARE_ASCII("writer_Peach_Text_W4W" )] = DECLARE_ASCII("swriter: Peach Text (W4W)" ); - aHash[DECLARE_ASCII("writer_DCA_Revisable_Form_Text_W4W" )] = DECLARE_ASCII("swriter: DCA Revisable Form Text (W4W)" ); - aHash[DECLARE_ASCII("writer_DCA_with_Display_Write_5_W4W" )] = DECLARE_ASCII("swriter: DCA with Display Write 5 (W4W)" ); - aHash[DECLARE_ASCII("writer_DCAFFT_Final_Form_Text_W4W" )] = DECLARE_ASCII("swriter: DCA/FFT-Final Form Text (W4W)" ); - aHash[DECLARE_ASCII("writer_DEC_DX_W4W" )] = DECLARE_ASCII("swriter: DEC DX (W4W)" ); - aHash[DECLARE_ASCII("writer_DEC_WPS_PLUS_W4W" )] = DECLARE_ASCII("swriter: DEC WPS-PLUS (W4W)" ); - aHash[DECLARE_ASCII("writer_DisplayWrite_20_4x_W4W" )] = DECLARE_ASCII("swriter: DisplayWrite 2.0-4.x (W4W)" ); - aHash[DECLARE_ASCII("writer_DisplayWrite_5x_W4W" )] = DECLARE_ASCII("swriter: DisplayWrite 5.x (W4W)" ); - aHash[DECLARE_ASCII("writer_DataGeneral_CEO_Write_W4W" )] = DECLARE_ASCII("swriter: DataGeneral CEO Write (W4W)" ); - aHash[DECLARE_ASCII("writer_EBCDIC_W4W" )] = DECLARE_ASCII("swriter: EBCDIC (W4W)" ); - aHash[DECLARE_ASCII("writer_Enable_W4W" )] = DECLARE_ASCII("swriter: Enable (W4W)" ); - aHash[DECLARE_ASCII("writer_Frame_Maker_MIF_30_W4W" )] = DECLARE_ASCII("swriter: Frame Maker MIF 3.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_Frame_Maker_MIF_40_W4W" )] = DECLARE_ASCII("swriter: Frame Maker MIF 4.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_Frame_Work_III_W4W" )] = DECLARE_ASCII("swriter: Frame Work III (W4W)" ); - aHash[DECLARE_ASCII("writer_Frame_Work_IV_W4W" )] = DECLARE_ASCII("swriter: Frame Work IV (W4W)" ); - aHash[DECLARE_ASCII("writer_HP_AdvanceWrite_Plus_W4W" )] = DECLARE_ASCII("swriter: HP AdvanceWrite Plus (W4W)" ); - aHash[DECLARE_ASCII("writer_ICL_Office_Power_6_W4W" )] = DECLARE_ASCII("swriter: ICL Office Power 6 (W4W)" ); - aHash[DECLARE_ASCII("writer_ICL_Office_Power_7_W4W" )] = DECLARE_ASCII("swriter: ICL Office Power 7 (W4W)" ); - aHash[DECLARE_ASCII("writer_Interleaf_W4W" )] = DECLARE_ASCII("swriter: Interleaf (W4W)" ); - aHash[DECLARE_ASCII("writer_Interleaf_5_6_W4W" )] = DECLARE_ASCII("swriter: Interleaf 5 - 6 (W4W)" ); - aHash[DECLARE_ASCII("writer_Legacy_Winstar_onGO_W4W" )] = DECLARE_ASCII("swriter: Legacy Winstar onGO (W4W)" ); - aHash[DECLARE_ASCII("writer_QA_Write_10_30_W4W" )] = DECLARE_ASCII("swriter: Q&A Write 1.0-3.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_QA_Write_40_W4W" )] = DECLARE_ASCII("swriter: Q&A Write 4.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_Rapid_File_10_W4W" )] = DECLARE_ASCII("swriter: Rapid File 1.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_Rapid_File_12_W4W" )] = DECLARE_ASCII("swriter: Rapid File 1.2 (W4W)" ); - aHash[DECLARE_ASCII("writer_Samna_Word_IV_IV_Plus_W4W" )] = DECLARE_ASCII("swriter: Samna Word IV-IV Plus (W4W)" ); - aHash[DECLARE_ASCII("writer_Total_Word_W4W" )] = DECLARE_ASCII("swriter: Total Word (W4W)" ); - aHash[DECLARE_ASCII("writer_Uniplex_onGO_W4W" )] = DECLARE_ASCII("swriter: Uniplex onGO (W4W)" ); - aHash[DECLARE_ASCII("writer_Uniplex_V7_V8_W4W" )] = DECLARE_ASCII("swriter: Uniplex V7-V8 (W4W)" ); - aHash[DECLARE_ASCII("writer_Wang_PC_W4W" )] = DECLARE_ASCII("swriter: Wang PC (W4W)" ); - aHash[DECLARE_ASCII("writer_Wang_II_SWP_W4W" )] = DECLARE_ASCII("swriter: Wang II SWP (W4W)" ); - aHash[DECLARE_ASCII("writer_Wang_WP_Plus_W4W" )] = DECLARE_ASCII("swriter: Wang WP Plus (W4W)" ); - aHash[DECLARE_ASCII("writer_WITA_W4W" )] = DECLARE_ASCII("swriter: WITA (W4W)" ); - aHash[DECLARE_ASCII("writer_WiziWord_30_W4W" )] = DECLARE_ASCII("swriter: WiziWord 3.0 (W4W)" ); - aHash[DECLARE_ASCII("writer_web_HTML" )] = DECLARE_ASCII("swriter/web: HTML" ); - aHash[DECLARE_ASCII("writer_web_StarWriterWeb_50_VorlageTemplate" )] = DECLARE_ASCII("swriter/web: StarWriter/Web 5.0 Vorlage/Template" ); - aHash[DECLARE_ASCII("writer_web_StarWriterWeb_40_VorlageTemplate" )] = DECLARE_ASCII("swriter/web: StarWriter/Web 4.0 Vorlage/Template" ); - aHash[DECLARE_ASCII("writer_web_Text_StarWriterWeb" )] = DECLARE_ASCII("swriter/web: Text (StarWriter/Web)" ); - aHash[DECLARE_ASCII("writer_web_Text_DOS_StarWriterWeb" )] = DECLARE_ASCII("swriter/web: Text DOS (StarWriter/Web)" ); - aHash[DECLARE_ASCII("writer_web_Text_Mac_StarWriterWeb" )] = DECLARE_ASCII("swriter/web: Text Mac (StarWriter/Web)" ); - aHash[DECLARE_ASCII("writer_web_Text_Unix_StarWriterWeb" )] = DECLARE_ASCII("swriter/web: Text Unix (StarWriter/Web)" ); - aHash[DECLARE_ASCII("writer_web_StarWriter_50" )] = DECLARE_ASCII("swriter/web: StarWriter 5.0" ); - aHash[DECLARE_ASCII("writer_web_StarWriter_40" )] = DECLARE_ASCII("swriter/web: StarWriter 4.0" ); - aHash[DECLARE_ASCII("writer_web_StarWriter_30" )] = DECLARE_ASCII("swriter/web: StarWriter 3.0" ); - aHash[DECLARE_ASCII("writer_web_Text_encoded" )] = DECLARE_ASCII("swriter/web: Text (encoded)" ); - aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_60GlobalDocument" )] = DECLARE_ASCII("swriter/GlobalDocument: StarOffice XML (GlobalDocument)" ); - aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_50GlobalDocument" )] = DECLARE_ASCII("swriter/GlobalDocument: StarWriter 5.0/GlobalDocument" ); - aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_40GlobalDocument" )] = DECLARE_ASCII("swriter/GlobalDocument: StarWriter 4.0/GlobalDocument" ); - aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_50" )] = DECLARE_ASCII("swriter/GlobalDocument: StarWriter 5.0" ); - aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_40" )] = DECLARE_ASCII("swriter/GlobalDocument: StarWriter 4.0" ); - aHash[DECLARE_ASCII("writer_globaldocument_StarWriter_30" )] = DECLARE_ASCII("swriter/GlobalDocument: StarWriter 3.0" ); - aHash[DECLARE_ASCII("writer_globaldocument_Text_encoded" )] = DECLARE_ASCII("swriter/GlobalDocument: Text (encoded)" ); - aHash[DECLARE_ASCII("chart_StarOffice_XML_Chart" )] = DECLARE_ASCII("schart: StarOffice XML (Chart)" ); - aHash[DECLARE_ASCII("chart_StarChart_50" )] = DECLARE_ASCII("schart: StarChart 5.0" ); - aHash[DECLARE_ASCII("chart_StarChart_40" )] = DECLARE_ASCII("schart: StarChart 4.0" ); - aHash[DECLARE_ASCII("chart_StarChart_30" )] = DECLARE_ASCII("schart: StarChart 3.0" ); - aHash[DECLARE_ASCII("calc_StarOffice_XML_Calc" )] = DECLARE_ASCII("scalc: StarOffice XML (Calc)" ); - aHash[DECLARE_ASCII("calc_StarCalc_50" )] = DECLARE_ASCII("scalc: StarCalc 5.0" ); - aHash[DECLARE_ASCII("calc_StarCalc_50_VorlageTemplate" )] = DECLARE_ASCII("scalc: StarCalc 5.0 Vorlage/Template" ); - aHash[DECLARE_ASCII("calc_StarCalc_40" )] = DECLARE_ASCII("scalc: StarCalc 4.0" ); - aHash[DECLARE_ASCII("calc_StarCalc_40_VorlageTemplate" )] = DECLARE_ASCII("scalc: StarCalc 4.0 Vorlage/Template" ); - aHash[DECLARE_ASCII("calc_StarCalc_30" )] = DECLARE_ASCII("scalc: StarCalc 3.0" ); - aHash[DECLARE_ASCII("calc_StarCalc_30_VorlageTemplate" )] = DECLARE_ASCII("scalc: StarCalc 3.0 Vorlage/Template" ); - aHash[DECLARE_ASCII("calc_MS_Excel_97" )] = DECLARE_ASCII("scalc: MS Excel 97" ); - aHash[DECLARE_ASCII("calc_MS_Excel_97_VorlageTemplate" )] = DECLARE_ASCII("scalc: MS Excel 97 Vorlage/Template" ); - aHash[DECLARE_ASCII("calc_MS_Excel_95" )] = DECLARE_ASCII("scalc: MS Excel 95" ); - aHash[DECLARE_ASCII("calc_MS_Excel_95_VorlageTemplate" )] = DECLARE_ASCII("scalc: MS Excel 95 Vorlage/Template" ); - aHash[DECLARE_ASCII("calc_MS_Excel_5095" )] = DECLARE_ASCII("scalc: MS Excel 5.0/95" ); - aHash[DECLARE_ASCII("calc_MS_Excel_5095_VorlageTemplate" )] = DECLARE_ASCII("scalc: MS Excel 5.0/95 Vorlage/Template" ); - aHash[DECLARE_ASCII("calc_MS_Excel_40" )] = DECLARE_ASCII("scalc: MS Excel 4.0" ); - aHash[DECLARE_ASCII("calc_MS_Excel_40_VorlageTemplate" )] = DECLARE_ASCII("scalc: MS Excel 4.0 Vorlage/Template" ); - aHash[DECLARE_ASCII("calc_Rich_Text_Format_StarCalc" )] = DECLARE_ASCII("scalc: Rich Text Format (StarCalc)" ); - aHash[DECLARE_ASCII("calc_SYLK" )] = DECLARE_ASCII("scalc: SYLK" ); - aHash[DECLARE_ASCII("calc_DIF" )] = DECLARE_ASCII("scalc: DIF" ); - aHash[DECLARE_ASCII("calc_HTML_StarCalc" )] = DECLARE_ASCII("scalc: HTML (StarCalc)" ); - aHash[DECLARE_ASCII("calc_dBase" )] = DECLARE_ASCII("scalc: dBase" ); - aHash[DECLARE_ASCII("calc_Lotus" )] = DECLARE_ASCII("scalc: Lotus" ); - aHash[DECLARE_ASCII("calc_StarCalc_10" )] = DECLARE_ASCII("scalc: StarCalc 1.0" ); - aHash[DECLARE_ASCII("calc_Text_txt_csv_StarCalc" )] = DECLARE_ASCII("scalc: Text - txt - csv (StarCalc)" ); - aHash[DECLARE_ASCII("impress_StarOffice_XML_Impress" )] = DECLARE_ASCII("simpress: StarOffice XML (Impress)" ); - aHash[DECLARE_ASCII("impress_StarImpress_50" )] = DECLARE_ASCII("simpress: StarImpress 5.0" ); - aHash[DECLARE_ASCII("impress_StarImpress_50_Vorlage" )] = DECLARE_ASCII("simpress: StarImpress 5.0 Vorlage" ); - aHash[DECLARE_ASCII("impress_StarImpress_40" )] = DECLARE_ASCII("simpress: StarImpress 4.0" ); - aHash[DECLARE_ASCII("impress_StarImpress_40_Vorlage" )] = DECLARE_ASCII("simpress: StarImpress 4.0 Vorlage" ); - aHash[DECLARE_ASCII("impress_StarDraw_50_StarImpress" )] = DECLARE_ASCII("simpress: StarDraw 5.0 (StarImpress)" ); - aHash[DECLARE_ASCII("impress_StarDraw_50_Vorlage_StarImpress" )] = DECLARE_ASCII("simpress: StarDraw 5.0 Vorlage (StarImpress)" ); - aHash[DECLARE_ASCII("impress_StarDraw_30_StarImpress" )] = DECLARE_ASCII("simpress: StarDraw 3.0 (StarImpress)" ); - aHash[DECLARE_ASCII("impress_StarDraw_30_Vorlage_StarImpress" )] = DECLARE_ASCII("simpress: StarDraw 3.0 Vorlage (StarImpress)" ); - aHash[DECLARE_ASCII("impress_MS_PowerPoint_97" )] = DECLARE_ASCII("simpress: MS PowerPoint 97" ); - aHash[DECLARE_ASCII("impress_MS_PowerPoint_97_Vorlage" )] = DECLARE_ASCII("simpress: MS PowerPoint 97 Vorlage" ); - aHash[DECLARE_ASCII("impress_CGM_Computer_Graphics_Metafile" )] = DECLARE_ASCII("simpress: CGM - Computer Graphics Metafile" ); - aHash[DECLARE_ASCII("impress_StarImpress_50_packed" )] = DECLARE_ASCII("simpress: StarImpress 5.0 (packed)" ); - aHash[DECLARE_ASCII("draw_StarOffice_XML_Draw" )] = DECLARE_ASCII("sdraw: StarOffice XML (Draw)" ); - aHash[DECLARE_ASCII("draw_GIF_Graphics_Interchange" )] = DECLARE_ASCII("sdraw: GIF - Graphics Interchange" ); - aHash[DECLARE_ASCII("draw_PCD_Photo_CD" )] = DECLARE_ASCII("sdraw: PCD - Photo CD" ); - aHash[DECLARE_ASCII("draw_PCX_Zsoft_Paintbrush" )] = DECLARE_ASCII("sdraw: PCX - Zsoft Paintbrush" ); - aHash[DECLARE_ASCII("draw_PSD_Adobe_Photoshop" )] = DECLARE_ASCII("sdraw: PSD - Adobe Photoshop" ); - aHash[DECLARE_ASCII("draw_PNG_Portable_Network_Graphic" )] = DECLARE_ASCII("sdraw: PNG - Portable Network Graphic" ); - aHash[DECLARE_ASCII("draw_StarDraw_50" )] = DECLARE_ASCII("sdraw: StarDraw 5.0" ); - aHash[DECLARE_ASCII("draw_PBM_Portable_Bitmap" )] = DECLARE_ASCII("sdraw: PBM - Portable Bitmap" ); - aHash[DECLARE_ASCII("draw_PGM_Portable_Graymap" )] = DECLARE_ASCII("sdraw: PGM - Portable Graymap" ); - aHash[DECLARE_ASCII("draw_PPM_Portable_Pixelmap" )] = DECLARE_ASCII("sdraw: PPM - Portable Pixelmap" ); - aHash[DECLARE_ASCII("draw_RAS_Sun_Rasterfile" )] = DECLARE_ASCII("sdraw: RAS - Sun Rasterfile" ); - aHash[DECLARE_ASCII("draw_TGA_Truevision_TARGA" )] = DECLARE_ASCII("sdraw: TGA - Truevision TARGA" ); - aHash[DECLARE_ASCII("draw_SGV_StarDraw_20" )] = DECLARE_ASCII("sdraw: SGV - StarDraw 2.0" ); - aHash[DECLARE_ASCII("draw_TIF_Tag_Image_File" )] = DECLARE_ASCII("sdraw: TIF - Tag Image File" ); - aHash[DECLARE_ASCII("draw_SGF_StarOffice_Writer_SGF" )] = DECLARE_ASCII("sdraw: SGF - StarOffice Writer SGF" ); - aHash[DECLARE_ASCII("draw_XPM" )] = DECLARE_ASCII("sdraw: XPM" ); - aHash[DECLARE_ASCII("gif_Graphics_Interchange" )] = DECLARE_ASCII("sdraw: GIF - Graphics Interchange" ); - aHash[DECLARE_ASCII("pcd_Photo_CD" )] = DECLARE_ASCII("sdraw: PCD - Photo CD" ); - aHash[DECLARE_ASCII("pcx_Zsoft_Paintbrush" )] = DECLARE_ASCII("sdraw: PCX - Zsoft Paintbrush" ); - aHash[DECLARE_ASCII("psd_Adobe_Photoshop" )] = DECLARE_ASCII("sdraw: PSD - Adobe Photoshop" ); - aHash[DECLARE_ASCII("png_Portable_Network_Graphic" )] = DECLARE_ASCII("sdraw: PNG - Portable Network Graphic" ); - aHash[DECLARE_ASCII("pbm_Portable_Bitmap" )] = DECLARE_ASCII("sdraw: PBM - Portable Bitmap" ); - aHash[DECLARE_ASCII("pgm_Portable_Graymap" )] = DECLARE_ASCII("sdraw: PGM - Portable Graymap" ); - aHash[DECLARE_ASCII("ppm_Portable_Pixelmap" )] = DECLARE_ASCII("sdraw: PPM - Portable Pixelmap" ); - aHash[DECLARE_ASCII("ras_Sun_Rasterfile" )] = DECLARE_ASCII("sdraw: RAS - Sun Rasterfile" ); - aHash[DECLARE_ASCII("tga_Truevision_TARGA" )] = DECLARE_ASCII("sdraw: TGA - Truevision TARGA" ); - aHash[DECLARE_ASCII("sgv_StarDraw_20" )] = DECLARE_ASCII("sdraw: SGV - StarDraw 2.0" ); - aHash[DECLARE_ASCII("tif_Tag_Image_File" )] = DECLARE_ASCII("sdraw: TIF - Tag Image File" ); - aHash[DECLARE_ASCII("sgf_StarOffice_Writer_SGF" )] = DECLARE_ASCII("sdraw: SGF - StarOffice Writer SGF" ); - aHash[DECLARE_ASCII("xpm_XPM" )] = DECLARE_ASCII("sdraw: XPM" ); - aHash[DECLARE_ASCII("draw_StarDraw_50_Vorlage" )] = DECLARE_ASCII("sdraw: StarDraw 5.0 Vorlage" ); - aHash[DECLARE_ASCII("draw_StarImpress_50_StarDraw" )] = DECLARE_ASCII("sdraw: StarImpress 5.0 (StarDraw)" ); - aHash[DECLARE_ASCII("draw_StarImpress_50_Vorlage_StarDraw" )] = DECLARE_ASCII("sdraw: StarImpress 5.0 Vorlage (StarDraw)" ); - aHash[DECLARE_ASCII("draw_StarImpress_40_StarDraw" )] = DECLARE_ASCII("sdraw: StarImpress 4.0 (StarDraw)" ); - aHash[DECLARE_ASCII("draw_StarImpress_40_Vorlage_StarDraw" )] = DECLARE_ASCII("sdraw: StarImpress 4.0 Vorlage (StarDraw)" ); - aHash[DECLARE_ASCII("draw_StarDraw_30" )] = DECLARE_ASCII("sdraw: StarDraw 3.0" ); - aHash[DECLARE_ASCII("draw_StarDraw_30_Vorlage" )] = DECLARE_ASCII("sdraw: StarDraw 3.0 Vorlage" ); - aHash[DECLARE_ASCII("draw_EMF_MS_Windows_Metafile" )] = DECLARE_ASCII("sdraw: EMF - MS Windows Metafile" ); - aHash[DECLARE_ASCII("draw_MET_OS2_Metafile" )] = DECLARE_ASCII("sdraw: MET - OS/2 Metafile" ); - aHash[DECLARE_ASCII("draw_DXF_AutoCAD_Interchange" )] = DECLARE_ASCII("sdraw: DXF - AutoCAD Interchange" ); - aHash[DECLARE_ASCII("draw_EPS_Encapsulated_PostScript" )] = DECLARE_ASCII("sdraw: EPS - Encapsulated PostScript" ); - aHash[DECLARE_ASCII("draw_WMF_MS_Windows_Metafile" )] = DECLARE_ASCII("sdraw: WMF - MS Windows Metafile" ); - aHash[DECLARE_ASCII("draw_PCT_Mac_Pict" )] = DECLARE_ASCII("sdraw: PCT - Mac Pict" ); - aHash[DECLARE_ASCII("draw_SVM_StarView_Metafile" )] = DECLARE_ASCII("sdraw: SVM - StarView Metafile" ); - aHash[DECLARE_ASCII("draw_BMP_MS_Windows" )] = DECLARE_ASCII("sdraw: BMP - MS Windows" ); - aHash[DECLARE_ASCII("draw_JPG_JPEG" )] = DECLARE_ASCII("sdraw: JPG - JPEG" ); - aHash[DECLARE_ASCII("draw_XBM_X_Consortium" )] = DECLARE_ASCII("sdraw: XBM - X-Consortium" ); - aHash[DECLARE_ASCII("emf_MS_Windows_Metafile" )] = DECLARE_ASCII("sdraw: EMF - MS Windows Metafile" ); - aHash[DECLARE_ASCII("met_OS2_Metafile" )] = DECLARE_ASCII("sdraw: MET - OS/2 Metafile" ); - aHash[DECLARE_ASCII("dxf_AutoCAD_Interchange" )] = DECLARE_ASCII("sdraw: DXF - AutoCAD Interchange" ); - aHash[DECLARE_ASCII("eps_Encapsulated_PostScript" )] = DECLARE_ASCII("sdraw: EPS - Encapsulated PostScript" ); - aHash[DECLARE_ASCII("wmf_MS_Windows_Metafile" )] = DECLARE_ASCII("sdraw: WMF - MS Windows Metafile" ); - aHash[DECLARE_ASCII("pct_Mac_Pict" )] = DECLARE_ASCII("sdraw: PCT - Mac Pict" ); - aHash[DECLARE_ASCII("svm_StarView_Metafile" )] = DECLARE_ASCII("sdraw: SVM - StarView Metafile" ); - aHash[DECLARE_ASCII("bmp_MS_Windows" )] = DECLARE_ASCII("sdraw: BMP - MS Windows" ); - aHash[DECLARE_ASCII("jpg_JPEG" )] = DECLARE_ASCII("sdraw: JPG - JPEG" ); - aHash[DECLARE_ASCII("xbm_X_Consortium" )] = DECLARE_ASCII("sdraw: XBM - X-Consortium" ); - aHash[DECLARE_ASCII("math_StarOffice_XML_Math" )] = DECLARE_ASCII("smath: StarOffice XML (Math)" ); - aHash[DECLARE_ASCII("math_MathML_XML_Math" )] = DECLARE_ASCII("smath: MathML XML (Math)" ); - aHash[DECLARE_ASCII("math_StarMath_50" )] = DECLARE_ASCII("smath: StarMath 5.0" ); - aHash[DECLARE_ASCII("math_StarMath_40" )] = DECLARE_ASCII("smath: StarMath 4.0" ); - aHash[DECLARE_ASCII("math_StarMath_30" )] = DECLARE_ASCII("smath: StarMath 3.0" ); - aHash[DECLARE_ASCII("math_StarMath_20" )] = DECLARE_ASCII("smath: StarMath 2.0" ); - aHash[DECLARE_ASCII("math_MathType_3x" )] = DECLARE_ASCII("smath: MathType 3.x" ); -} - -//***************************************************************************************************************** -::rtl::OUString XCDGenerator::impl_getOldFilterName( const ::rtl::OUString& sNewName ) -{ - ::rtl::OUString sOldName; - ConstStringHashIterator pEntry = m_aData.aOldFilterNamesHash.find(sNewName); - if( pEntry==m_aData.aOldFilterNamesHash.end() ) - { - sOldName = sNewName; - } - else - { - sOldName = m_aData.aOldFilterNamesHash[sNewName]; - } - return sOldName; -} - -//***************************************************************************************************************** -void XCDGenerator::impl_classifyType( const AppMember& rData, const ::rtl::OUString& sTypeName, EFilterPackage& ePackage ) -{ - ePackage = E_STANDARD; - - // Step over all registered filters for this type ... - // Classify all of these filters. If one of them a standard filter ... - // type must be a standard type too - otherwise not! - - CheckedStringListIterator pIterator ; - ::rtl::OUString sFilterName ; - sal_Int32 nOrder ; - while( rData.pFilterCache->searchFilterForType( sTypeName, pIterator, sFilterName ) == sal_True ) - { - EFilterPackage eFilterPackage; - XCDGenerator::impl_classifyFilter( rData, sFilterName, eFilterPackage, nOrder ); - if( eFilterPackage == E_STANDARD ) - { - ePackage = E_STANDARD; - break; - } - } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_classifyFilter( const AppMember& rData, const ::rtl::OUString& sFilterName, EFilterPackage& ePackage, sal_Int32& nOrder ) -{ - // a) For versions less then 4 => use hard coded list of filter names to differ between standard or additional filters. - // Why? This version don't support the order flag or hasn't set it right! - // b) For version greater then 3 => use order of currently cached types in FilterCache! - - ePackage = E_STANDARD; - nOrder = 0; - - // writer - if( sFilterName == DECLARE_ASCII("writer_StarOffice_XML_Writer" ) ) { ePackage = E_STANDARD; nOrder = 1; } else - if( sFilterName == DECLARE_ASCII("writer_StarOffice_XML_Writer_Template" ) ) { ePackage = E_STANDARD; nOrder = 2; } else - if( sFilterName == DECLARE_ASCII("writer_StarWriter_50" ) ) { ePackage = E_STANDARD; nOrder = 3; } else - if( sFilterName == DECLARE_ASCII("writer_StarWriter_50_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 4; } else - if( sFilterName == DECLARE_ASCII("writer_StarWriter_40" ) ) { ePackage = E_STANDARD; nOrder = 5; } else - if( sFilterName == DECLARE_ASCII("writer_StarWriter_40_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 6; } else - if( sFilterName == DECLARE_ASCII("writer_StarWriter_30" ) ) { ePackage = E_STANDARD; nOrder = 7; } else - if( sFilterName == DECLARE_ASCII("writer_StarWriter_30_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 8; } else - if( sFilterName == DECLARE_ASCII("writer_StarWriter_20" ) ) { ePackage = E_STANDARD; nOrder = 9; } else - if( sFilterName == DECLARE_ASCII("writer_MS_Word_97" ) ) { ePackage = E_STANDARD; nOrder = 10; } else - if( sFilterName == DECLARE_ASCII("writer_MS_Word_97_Vorlage" ) ) { ePackage = E_STANDARD; nOrder = 11; } else - if( sFilterName == DECLARE_ASCII("writer_MS_Word_95" ) ) { ePackage = E_STANDARD; nOrder = 12; } else - if( sFilterName == DECLARE_ASCII("writer_MS_Word_95_Vorlage" ) ) { ePackage = E_STANDARD; nOrder = 13; } else - if( sFilterName == DECLARE_ASCII("writer_MS_WinWord_2x_W4W" ) ) { ePackage = E_STANDARD; nOrder = 14; } else - if( sFilterName == DECLARE_ASCII("writer_MS_WinWord_1x_W4W" ) ) { ePackage = E_STANDARD; nOrder = 15; } else - if( sFilterName == DECLARE_ASCII("writer_MS_Word_6x_W4W" ) ) { ePackage = E_STANDARD; nOrder = 16; } else - if( sFilterName == DECLARE_ASCII("writer_MS_Word_5x_W4W" ) ) { ePackage = E_STANDARD; nOrder = 17; } else - if( sFilterName == DECLARE_ASCII("writer_MS_Word_4x_W4W" ) ) { ePackage = E_STANDARD; nOrder = 18; } else - if( sFilterName == DECLARE_ASCII("writer_MS_Word_3x_W4W" ) ) { ePackage = E_STANDARD; nOrder = 19; } else - if( sFilterName == DECLARE_ASCII("writer_WordPerfect_Win_70_W4W" ) ) { ePackage = E_STANDARD; nOrder = 20; } else - if( sFilterName == DECLARE_ASCII("writer_WordPerfect_Win_61_W4W" ) ) { ePackage = E_STANDARD; nOrder = 21; } else - if( sFilterName == DECLARE_ASCII("writer_WordPerfect_Win_60_W4W" ) ) { ePackage = E_STANDARD; nOrder = 22; } else - if( sFilterName == DECLARE_ASCII("writer_WordPerfect_Win_51_52_W4W" ) ) { ePackage = E_STANDARD; nOrder = 23; } else - if( sFilterName == DECLARE_ASCII("writer_HTML_StarWriter" ) ) { ePackage = E_STANDARD; nOrder = 24; } else - if( sFilterName == DECLARE_ASCII("writer_Text" ) ) { ePackage = E_STANDARD; nOrder = 25; } else - if( sFilterName == DECLARE_ASCII("writer_Text_encoded" ) ) { ePackage = E_STANDARD; nOrder = 26; } else - if( sFilterName == DECLARE_ASCII("writer_Text_DOS" ) ) { ePackage = E_STANDARD; nOrder = 27; } else - if( sFilterName == DECLARE_ASCII("writer_Text_Unix" ) ) { ePackage = E_STANDARD; nOrder = 28; } else - if( sFilterName == DECLARE_ASCII("writer_Text_Mac" ) ) { ePackage = E_STANDARD; nOrder = 29; } else - if( sFilterName == DECLARE_ASCII("writer_Rich_Text_Format" ) ) { ePackage = E_STANDARD; nOrder = 30; } - - // writer web - if( sFilterName == DECLARE_ASCII("writer_web_HTML" ) ) { ePackage = E_STANDARD; nOrder = 1; } else - if( sFilterName == DECLARE_ASCII("writer_web_StarOffice_XML_Writer" ) ) { ePackage = E_STANDARD; nOrder = 2; } else - if( sFilterName == DECLARE_ASCII("writer_web_StarOffice_XML_Writer_Web_Template" ) ) { ePackage = E_STANDARD; nOrder = 3; } else - if( sFilterName == DECLARE_ASCII("writer_web_StarWriter_50" ) ) { ePackage = E_STANDARD; nOrder = 4; } else - if( sFilterName == DECLARE_ASCII("writer_web_StarWriterWeb_50_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 5; } else - if( sFilterName == DECLARE_ASCII("writer_web_StarWriter_40" ) ) { ePackage = E_STANDARD; nOrder = 6; } else - if( sFilterName == DECLARE_ASCII("writer_web_StarWriterWeb_40_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 7; } else - if( sFilterName == DECLARE_ASCII("writer_web_StarWriter_30" ) ) { ePackage = E_STANDARD; nOrder = 8; } else - if( sFilterName == DECLARE_ASCII("writer_web_Text_StarWriterWeb" ) ) { ePackage = E_STANDARD; nOrder = 9; } else - if( sFilterName == DECLARE_ASCII("writer_web_Text_encoded" ) ) { ePackage = E_STANDARD; nOrder = 10; } else - if( sFilterName == DECLARE_ASCII("writer_web_Text_DOS_StarWriterWeb" ) ) { ePackage = E_STANDARD; nOrder = 11; } else - if( sFilterName == DECLARE_ASCII("writer_web_Text_Unix_StarWriterWeb" ) ) { ePackage = E_STANDARD; nOrder = 12; } else - if( sFilterName == DECLARE_ASCII("writer_web_Text_Mac_StarWriterWeb" ) ) { ePackage = E_STANDARD; nOrder = 13; } - - // global document - if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarOffice_XML_Writer_GlobalDocument" ) ) { ePackage = E_STANDARD; nOrder = 1; } else - if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarOffice_XML_Writer" ) ) { ePackage = E_STANDARD; nOrder = 2; } else - if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarWriter_50" ) ) { ePackage = E_STANDARD; nOrder = 3; } else - if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarWriter_50GlobalDocument" ) ) { ePackage = E_STANDARD; nOrder = 4; } else - if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarWriter_40" ) ) { ePackage = E_STANDARD; nOrder = 5; } else - if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarWriter_40GlobalDocument" ) ) { ePackage = E_STANDARD; nOrder = 6; } else - if( sFilterName == DECLARE_ASCII("writer_globaldocument_StarWriter_30" ) ) { ePackage = E_STANDARD; nOrder = 7; } else - if( sFilterName == DECLARE_ASCII("writer_globaldocument_Text_encoded" ) ) { ePackage = E_STANDARD; nOrder = 8; } - - // calc - if( sFilterName == DECLARE_ASCII("calc_StarOffice_XML_Calc" ) ) { ePackage = E_STANDARD; nOrder = 1; } else - if( sFilterName == DECLARE_ASCII("calc_StarOffice_XML_Calc_Template" ) ) { ePackage = E_STANDARD; nOrder = 2; } else - if( sFilterName == DECLARE_ASCII("calc_StarCalc_50" ) ) { ePackage = E_STANDARD; nOrder = 3; } else - if( sFilterName == DECLARE_ASCII("calc_StarCalc_50_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 4; } else - if( sFilterName == DECLARE_ASCII("calc_StarCalc_40" ) ) { ePackage = E_STANDARD; nOrder = 5; } else - if( sFilterName == DECLARE_ASCII("calc_StarCalc_40_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 6; } else - if( sFilterName == DECLARE_ASCII("calc_StarCalc_30" ) ) { ePackage = E_STANDARD; nOrder = 7; } else - if( sFilterName == DECLARE_ASCII("calc_StarCalc_30_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 8; } else - if( sFilterName == DECLARE_ASCII("calc_StarCalc_10" ) ) { ePackage = E_STANDARD; nOrder = 9; } else - if( sFilterName == DECLARE_ASCII("calc_MS_Excel_97" ) ) { ePackage = E_STANDARD; nOrder = 10; } else - if( sFilterName == DECLARE_ASCII("calc_MS_Excel_97_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 11; } else - if( sFilterName == DECLARE_ASCII("calc_MS_Excel_95" ) ) { ePackage = E_STANDARD; nOrder = 12; } else - if( sFilterName == DECLARE_ASCII("calc_MS_Excel_95_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 13; } else - if( sFilterName == DECLARE_ASCII("calc_MS_Excel_5095" ) ) { ePackage = E_STANDARD; nOrder = 14; } else - if( sFilterName == DECLARE_ASCII("calc_MS_Excel_5095_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 15; } else - if( sFilterName == DECLARE_ASCII("calc_MS_Excel_40" ) ) { ePackage = E_STANDARD; nOrder = 16; } else - if( sFilterName == DECLARE_ASCII("calc_MS_Excel_40_VorlageTemplate" ) ) { ePackage = E_STANDARD; nOrder = 17; } else - if( sFilterName == DECLARE_ASCII("calc_HTML_StarCalc" ) ) { ePackage = E_STANDARD; nOrder = 18; } else - if( sFilterName == DECLARE_ASCII("calc_HTML_WebQuery" ) ) { ePackage = E_STANDARD; nOrder = 19; } else - if( sFilterName == DECLARE_ASCII("calc_Rich_Text_Format_StarCalc" ) ) { ePackage = E_STANDARD; nOrder = 20; } else - if( sFilterName == DECLARE_ASCII("calc_Text_txt_csv_StarCalc" ) ) { ePackage = E_STANDARD; nOrder = 21; } else - if( sFilterName == DECLARE_ASCII("calc_dBase" ) ) { ePackage = E_STANDARD; nOrder = 22; } else - if( sFilterName == DECLARE_ASCII("calc_Lotus" ) ) { ePackage = E_STANDARD; nOrder = 23; } else - if( sFilterName == DECLARE_ASCII("calc_SYLK" ) ) { ePackage = E_STANDARD; nOrder = 24; } else - if( sFilterName == DECLARE_ASCII("calc_DIF" ) ) { ePackage = E_STANDARD; nOrder = 25; } - - // impress - if( sFilterName == DECLARE_ASCII("impress_StarOffice_XML_Impress" ) ) { ePackage = E_STANDARD; nOrder = 1; } else - if( sFilterName == DECLARE_ASCII("impress_StarOffice_XML_Impress_Template" ) ) { ePackage = E_STANDARD; nOrder = 2; } else - if( sFilterName == DECLARE_ASCII("impress_StarImpress_50" ) ) { ePackage = E_STANDARD; nOrder = 3; } else - if( sFilterName == DECLARE_ASCII("impress_StarImpress_50_Vorlage" ) ) { ePackage = E_STANDARD; nOrder = 4; } else - if( sFilterName == DECLARE_ASCII("impress_StarImpress_50_packed" ) ) { ePackage = E_STANDARD; nOrder = 5; } else - if( sFilterName == DECLARE_ASCII("impress_StarImpress_40" ) ) { ePackage = E_STANDARD; nOrder = 6; } else - if( sFilterName == DECLARE_ASCII("impress_StarImpress_40_Vorlage" ) ) { ePackage = E_STANDARD; nOrder = 7; } else - if( sFilterName == DECLARE_ASCII("impress_MS_PowerPoint_97" ) ) { ePackage = E_STANDARD; nOrder = 8; } else - if( sFilterName == DECLARE_ASCII("impress_MS_PowerPoint_97_Vorlage" ) ) { ePackage = E_STANDARD; nOrder = 9; } else - if( sFilterName == DECLARE_ASCII("impress_StarOffice_XML_Draw" ) ) { ePackage = E_STANDARD; nOrder = 10; } else - if( sFilterName == DECLARE_ASCII("impress_StarDraw_50_StarImpress" ) ) { ePackage = E_STANDARD; nOrder = 11; } else - if( sFilterName == DECLARE_ASCII("impress_StarDraw_50_Vorlage_StarImpress" ) ) { ePackage = E_STANDARD; nOrder = 12; } else - if( sFilterName == DECLARE_ASCII("impress_StarDraw_30_StarImpress" ) ) { ePackage = E_STANDARD; nOrder = 13; } else - if( sFilterName == DECLARE_ASCII("impress_StarDraw_30_Vorlage_StarImpress" ) ) { ePackage = E_STANDARD; nOrder = 14; } else - if( sFilterName == DECLARE_ASCII("impress_CGM_Computer_Graphics_Metafile" ) ) { ePackage = E_STANDARD; nOrder = 15; } - - // draw - if( sFilterName == DECLARE_ASCII("draw_StarOffice_XML_Draw" ) ) { ePackage = E_STANDARD; nOrder = 1; } else - if( sFilterName == DECLARE_ASCII("draw_StarOffice_XML_Draw_Template" ) ) { ePackage = E_STANDARD; nOrder = 2; } else - if( sFilterName == DECLARE_ASCII("draw_StarDraw_50" ) ) { ePackage = E_STANDARD; nOrder = 3; } else - if( sFilterName == DECLARE_ASCII("draw_StarDraw_50_Vorlage" ) ) { ePackage = E_STANDARD; nOrder = 4; } else - if( sFilterName == DECLARE_ASCII("draw_StarDraw_30" ) ) { ePackage = E_STANDARD; nOrder = 5; } else - if( sFilterName == DECLARE_ASCII("draw_StarDraw_30_Vorlage" ) ) { ePackage = E_STANDARD; nOrder = 6; } else - if( sFilterName == DECLARE_ASCII("draw_StarOffice_XML_Impress" ) ) { ePackage = E_STANDARD; nOrder = 7; } else - if( sFilterName == DECLARE_ASCII("draw_StarImpress_50_StarDraw" ) ) { ePackage = E_STANDARD; nOrder = 8; } else - if( sFilterName == DECLARE_ASCII("draw_StarImpress_50_Vorlage_StarDraw" ) ) { ePackage = E_STANDARD; nOrder = 9; } else - if( sFilterName == DECLARE_ASCII("draw_StarImpress_40_StarDraw" ) ) { ePackage = E_STANDARD; nOrder = 10; } else - if( sFilterName == DECLARE_ASCII("draw_StarImpress_40_Vorlage_StarDraw" ) ) { ePackage = E_STANDARD; nOrder = 11; } else - if( sFilterName == DECLARE_ASCII("draw_SGV_StarDraw_20" ) ) { ePackage = E_STANDARD; nOrder = 12; } else - if( sFilterName == DECLARE_ASCII("draw_SGF_StarOffice_Writer_SGF" ) ) { ePackage = E_STANDARD; nOrder = 13; } else - if( sFilterName == DECLARE_ASCII("draw_SVM_StarView_Metafile" ) ) { ePackage = E_STANDARD; nOrder = 14; } else - if( sFilterName == DECLARE_ASCII("draw_WMF_MS_Windows_Metafile" ) ) { ePackage = E_STANDARD; nOrder = 15; } else - if( sFilterName == DECLARE_ASCII("draw_EMF_MS_Windows_Metafile" ) ) { ePackage = E_STANDARD; nOrder = 16; } else - if( sFilterName == DECLARE_ASCII("draw_EPS_Encapsulated_PostScript" ) ) { ePackage = E_STANDARD; nOrder = 17; } else - if( sFilterName == DECLARE_ASCII("draw_DXF_AutoCAD_Interchange" ) ) { ePackage = E_STANDARD; nOrder = 18; } else - if( sFilterName == DECLARE_ASCII("draw_BMP_MS_Windows" ) ) { ePackage = E_STANDARD; nOrder = 19; } else - if( sFilterName == DECLARE_ASCII("draw_GIF_Graphics_Interchange" ) ) { ePackage = E_STANDARD; nOrder = 20; } else - if( sFilterName == DECLARE_ASCII("draw_JPG_JPEG" ) ) { ePackage = E_STANDARD; nOrder = 21; } else - if( sFilterName == DECLARE_ASCII("draw_MET_OS2_Metafile" ) ) { ePackage = E_STANDARD; nOrder = 22; } else - if( sFilterName == DECLARE_ASCII("draw_PBM_Portable_Bitmap" ) ) { ePackage = E_STANDARD; nOrder = 23; } else - if( sFilterName == DECLARE_ASCII("draw_PCD_Photo_CD_Base" ) ) { ePackage = E_STANDARD; nOrder = 24; } else - if( sFilterName == DECLARE_ASCII("draw_PCD_Photo_CD_Base4" ) ) { ePackage = E_STANDARD; nOrder = 25; } else - if( sFilterName == DECLARE_ASCII("draw_PCD_Photo_CD_Base16" ) ) { ePackage = E_STANDARD; nOrder = 26; } else - if( sFilterName == DECLARE_ASCII("draw_PCT_Mac_Pict" ) ) { ePackage = E_STANDARD; nOrder = 27; } else - if( sFilterName == DECLARE_ASCII("draw_PCX_Zsoft_Paintbrush" ) ) { ePackage = E_STANDARD; nOrder = 28; } else - if( sFilterName == DECLARE_ASCII("draw_PGM_Portable_Graymap" ) ) { ePackage = E_STANDARD; nOrder = 29; } else - if( sFilterName == DECLARE_ASCII("draw_PNG_Portable_Network_Graphic" ) ) { ePackage = E_STANDARD; nOrder = 30; } else - if( sFilterName == DECLARE_ASCII("draw_PPM_Portable_Pixelmap" ) ) { ePackage = E_STANDARD; nOrder = 31; } else - if( sFilterName == DECLARE_ASCII("draw_PSD_Adobe_Photoshop" ) ) { ePackage = E_STANDARD; nOrder = 32; } else - if( sFilterName == DECLARE_ASCII("draw_RAS_Sun_Rasterfile" ) ) { ePackage = E_STANDARD; nOrder = 33; } else - if( sFilterName == DECLARE_ASCII("draw_TGA_Truevision_TARGA" ) ) { ePackage = E_STANDARD; nOrder = 34; } else - if( sFilterName == DECLARE_ASCII("draw_TIF_Tag_Image_File" ) ) { ePackage = E_STANDARD; nOrder = 35; } else - if( sFilterName == DECLARE_ASCII("draw_XBM_X_Consortium" ) ) { ePackage = E_STANDARD; nOrder = 36; } else - if( sFilterName == DECLARE_ASCII("draw_XPM" ) ) { ePackage = E_STANDARD; nOrder = 37; } - - // chart - if( sFilterName == DECLARE_ASCII("chart_StarOffice_XML_Chart" ) ) { ePackage = E_STANDARD; nOrder = 1; } else - if( sFilterName == DECLARE_ASCII("chart_StarChart_50" ) ) { ePackage = E_STANDARD; nOrder = 2; } else - if( sFilterName == DECLARE_ASCII("chart_StarChart_40" ) ) { ePackage = E_STANDARD; nOrder = 3; } else - if( sFilterName == DECLARE_ASCII("chart_StarChart_30" ) ) { ePackage = E_STANDARD; nOrder = 4; } - - // math - if( sFilterName == DECLARE_ASCII("math_StarOffice_XML_Math" ) ) { ePackage = E_STANDARD; nOrder = 1; } else - if( sFilterName == DECLARE_ASCII("math_StarMath_50" ) ) { ePackage = E_STANDARD; nOrder = 2; } else - if( sFilterName == DECLARE_ASCII("math_StarMath_40" ) ) { ePackage = E_STANDARD; nOrder = 3; } else - if( sFilterName == DECLARE_ASCII("math_StarMath_30" ) ) { ePackage = E_STANDARD; nOrder = 4; } else - if( sFilterName == DECLARE_ASCII("math_StarMath_20" ) ) { ePackage = E_STANDARD; nOrder = 5; } else - if( sFilterName == DECLARE_ASCII("math_MathML_XML_Math" ) ) { ePackage = E_STANDARD; nOrder = 6; } else - if( sFilterName == DECLARE_ASCII("math_MathType_3x" ) ) { ePackage = E_STANDARD; nOrder = 7; } - - // graphics - if( sFilterName == DECLARE_ASCII("bmp_Import" ) ) { ePackage = E_STANDARD; nOrder = 1; } else - if( sFilterName == DECLARE_ASCII("bmp_Export" ) ) { ePackage = E_STANDARD; nOrder = 2; } else - if( sFilterName == DECLARE_ASCII("dxf_Import" ) ) { ePackage = E_STANDARD; nOrder = 3; } else - if( sFilterName == DECLARE_ASCII("emf_Import" ) ) { ePackage = E_STANDARD; nOrder = 4; } else - if( sFilterName == DECLARE_ASCII("emf_Export" ) ) { ePackage = E_STANDARD; nOrder = 5; } else - if( sFilterName == DECLARE_ASCII("eps_Import" ) ) { ePackage = E_STANDARD; nOrder = 6; } else - if( sFilterName == DECLARE_ASCII("eps_Export" ) ) { ePackage = E_STANDARD; nOrder = 7; } else - if( sFilterName == DECLARE_ASCII("gif_Import" ) ) { ePackage = E_STANDARD; nOrder = 8; } else - if( sFilterName == DECLARE_ASCII("gif_Export" ) ) { ePackage = E_STANDARD; nOrder = 9; } else - if( sFilterName == DECLARE_ASCII("jpg_Import" ) ) { ePackage = E_STANDARD; nOrder = 10; } else - if( sFilterName == DECLARE_ASCII("jpg_Export" ) ) { ePackage = E_STANDARD; nOrder = 11; } else - if( sFilterName == DECLARE_ASCII("met_Import" ) ) { ePackage = E_STANDARD; nOrder = 12; } else - if( sFilterName == DECLARE_ASCII("met_Export" ) ) { ePackage = E_STANDARD; nOrder = 13; } else - if( sFilterName == DECLARE_ASCII("pbm_Import" ) ) { ePackage = E_STANDARD; nOrder = 14; } else - if( sFilterName == DECLARE_ASCII("pbm_Export" ) ) { ePackage = E_STANDARD; nOrder = 15; } else - if( sFilterName == DECLARE_ASCII("pcd_Import_Base16" ) ) { ePackage = E_STANDARD; nOrder = 16; } else - if( sFilterName == DECLARE_ASCII("pcd_Import_Base4" ) ) { ePackage = E_STANDARD; nOrder = 17; } else - if( sFilterName == DECLARE_ASCII("pcd_Import_Base" ) ) { ePackage = E_STANDARD; nOrder = 18; } else - if( sFilterName == DECLARE_ASCII("pct_Import" ) ) { ePackage = E_STANDARD; nOrder = 19; } else - if( sFilterName == DECLARE_ASCII("pct_Export" ) ) { ePackage = E_STANDARD; nOrder = 20; } else - if( sFilterName == DECLARE_ASCII("pcx_Import" ) ) { ePackage = E_STANDARD; nOrder = 21; } else - if( sFilterName == DECLARE_ASCII("pgm_Import" ) ) { ePackage = E_STANDARD; nOrder = 22; } else - if( sFilterName == DECLARE_ASCII("pgm_Export" ) ) { ePackage = E_STANDARD; nOrder = 23; } else - if( sFilterName == DECLARE_ASCII("png_Import" ) ) { ePackage = E_STANDARD; nOrder = 24; } else - if( sFilterName == DECLARE_ASCII("png_Export" ) ) { ePackage = E_STANDARD; nOrder = 25; } else - if( sFilterName == DECLARE_ASCII("ppm_Import" ) ) { ePackage = E_STANDARD; nOrder = 26; } else - if( sFilterName == DECLARE_ASCII("ppm_Export" ) ) { ePackage = E_STANDARD; nOrder = 27; } else - if( sFilterName == DECLARE_ASCII("psd_Import" ) ) { ePackage = E_STANDARD; nOrder = 28; } else - if( sFilterName == DECLARE_ASCII("ras_Import" ) ) { ePackage = E_STANDARD; nOrder = 29; } else - if( sFilterName == DECLARE_ASCII("ras_Export" ) ) { ePackage = E_STANDARD; nOrder = 30; } else - if( sFilterName == DECLARE_ASCII("sgf_Import" ) ) { ePackage = E_STANDARD; nOrder = 31; } else - if( sFilterName == DECLARE_ASCII("sgv_Import" ) ) { ePackage = E_STANDARD; nOrder = 32; } else - if( sFilterName == DECLARE_ASCII("svg_Export" ) ) { ePackage = E_STANDARD; nOrder = 33; } else - if( sFilterName == DECLARE_ASCII("svm_Import" ) ) { ePackage = E_STANDARD; nOrder = 34; } else - if( sFilterName == DECLARE_ASCII("svm_Export" ) ) { ePackage = E_STANDARD; nOrder = 35; } else - if( sFilterName == DECLARE_ASCII("tga_Import" ) ) { ePackage = E_STANDARD; nOrder = 36; } else - if( sFilterName == DECLARE_ASCII("tif_Import" ) ) { ePackage = E_STANDARD; nOrder = 37; } else - if( sFilterName == DECLARE_ASCII("tif_Export" ) ) { ePackage = E_STANDARD; nOrder = 38; } else - if( sFilterName == DECLARE_ASCII("wmf_Import" ) ) { ePackage = E_STANDARD; nOrder = 39; } else - if( sFilterName == DECLARE_ASCII("wmf_Export" ) ) { ePackage = E_STANDARD; nOrder = 40; } else - if( sFilterName == DECLARE_ASCII("xbm_Import" ) ) { ePackage = E_STANDARD; nOrder = 41; } else - if( sFilterName == DECLARE_ASCII("xpm_Import" ) ) { ePackage = E_STANDARD; nOrder = 42; } else - if( sFilterName == DECLARE_ASCII("xpm_Export" ) ) { ePackage = E_STANDARD; nOrder = 43; } -} - -//***************************************************************************************************************** -void XCDGenerator::impl_orderAlphabetical( css::uno::Sequence< ::rtl::OUString >& lList ) -{ - ::std::vector< ::rtl::OUString > lSortedList; - sal_Int32 nCount ; - sal_Int32 nItem ; - - // Copy sequence to vector - nCount = lList.getLength(); - for( nItem=0; nItem<nCount; ++nItem ) - { - lSortedList.push_back( lList[nItem] ); - } - - // sort in a alphabetical order - ::std::sort( lSortedList.begin(), lSortedList.end() ); - - // copy sorted list back to sequence - nItem = 0; - for( ::std::vector< ::rtl::OUString >::iterator pIterator=lSortedList.begin(); pIterator!=lSortedList.end(); ++pIterator ) - { - lList[nItem] = *pIterator; - ++nItem; - } -} - -//***************************************************************************************************************** -class ModifiedUTF7Buffer -{ - rtl::OUStringBuffer & m_rBuffer; - sal_uInt32 m_nValue; - int m_nFilled; - -public: - ModifiedUTF7Buffer(rtl::OUStringBuffer * pTheBuffer): - m_rBuffer(*pTheBuffer), m_nFilled(0) {} - - inline void write(sal_Unicode c); - - void flush(); -}; - -inline void ModifiedUTF7Buffer::write(sal_Unicode c) -{ - switch (m_nFilled) - { - case 0: - m_nValue = sal_uInt32(c) << 8; - m_nFilled = 2; - break; - - case 1: - m_nValue |= sal_uInt32(c); - m_nFilled = 3; - flush(); - break; - - case 2: - m_nValue |= sal_uInt32(c) >> 8; - m_nFilled = 3; - flush(); - m_nValue = (sal_uInt32(c) & 0xFF) << 16; - m_nFilled = 1; - break; - } -} - -void ModifiedUTF7Buffer::flush() -{ - static sal_Unicode const aModifiedBase64[64] - = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', - 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', - 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', - 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '.' }; - switch (m_nFilled) - { - case 1: - m_rBuffer.append(aModifiedBase64[m_nValue >> 18]); - m_rBuffer.append(aModifiedBase64[m_nValue >> 12 & 63]); - break; - - case 2: - m_rBuffer.append(aModifiedBase64[m_nValue >> 18]); - m_rBuffer.append(aModifiedBase64[m_nValue >> 12 & 63]); - m_rBuffer.append(aModifiedBase64[m_nValue >> 6 & 63]); - break; - - case 3: - m_rBuffer.append(aModifiedBase64[m_nValue >> 18]); - m_rBuffer.append(aModifiedBase64[m_nValue >> 12 & 63]); - m_rBuffer.append(aModifiedBase64[m_nValue >> 6 & 63]); - m_rBuffer.append(aModifiedBase64[m_nValue & 63]); - break; - } - m_nFilled = 0; - m_nValue = 0; -} - - -sal_Bool XCDGenerator::impl_isUsAsciiAlphaDigit(sal_Unicode c, sal_Bool bDigitAllowed) -{ - return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' - || bDigitAllowed && c >= '0' && c <= '9'; -} - -::rtl::OUString XCDGenerator::impl_encodeSetName( const ::rtl::OUString& rSource ) -{ - return impl_encodeSpecialSigns( rSource ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/util/lomenubar.component b/framework/util/lomenubar.component index 628bcb7cc7a2..279ab3a7b5eb 100755 --- a/framework/util/lomenubar.component +++ b/framework/util/lomenubar.component @@ -27,7 +27,7 @@ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable * instead of those above. *--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="lomenubar" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="org.libreoffice.comp.framework.lomenubar.FrameJob"> <service name="com.sun.star.task.Job"/> |