diff options
-rw-r--r-- | linguistic/source/hyphdsp.cxx | 14 | ||||
-rw-r--r-- | linguistic/source/spelldsp.cxx | 11 | ||||
-rw-r--r-- | linguistic/source/thesdsp.cxx | 8 | ||||
-rw-r--r-- | sfx2/inc/sfx2/mnuitem.hxx | 9 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/doc/makefile.mk | 8 | ||||
-rwxr-xr-x | sfx2/source/doc/sfxacldetect.cxx | 108 | ||||
-rw-r--r-- | sfx2/source/menu/mnuitem.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/menu/virtmenu.cxx | 20 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 20 |
10 files changed, 205 insertions, 24 deletions
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx index a04d01c0d1a7..e1ebe970a44f 100644 --- a/linguistic/source/hyphdsp.cxx +++ b/linguistic/source/hyphdsp.cxx @@ -275,7 +275,8 @@ Reference< XHyphenatedWord > SAL_CALL return xRes; // search for entry with that language - LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get(); + HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; BOOL bWordModified = FALSE; if (!pEntry || (nMaxLeading < 0 || nMaxLeading > nWordLen)) @@ -418,7 +419,8 @@ Reference< XHyphenatedWord > SAL_CALL return xRes; // search for entry with that language - LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get(); + HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; BOOL bWordModified = FALSE; if (!pEntry || !(0 <= nIndex && nIndex <= nWordLen - 2)) @@ -555,7 +557,8 @@ Reference< XPossibleHyphens > SAL_CALL return xRes; // search for entry with that language - LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get(); + HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (!pEntry) { @@ -713,8 +716,9 @@ Sequence< OUString > // search for entry with that language and use data from that INT16 nLanguage = LocaleToLanguage( rLocale ); - HyphenatorDispatcher *pThis = (HyphenatorDispatcher *) this; - const LangSvcEntries_Hyph *pEntry = pThis->aSvcMap[ nLanguage ].get(); + HyphenatorDispatcher *pThis = (HyphenatorDispatcher *) this; + const HyphSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) ); + const LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (pEntry) { aRes = pEntry->aSvcImplNames; diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index 48e64163dbe4..6009461c7e7c 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -330,7 +330,8 @@ BOOL SpellCheckerDispatcher::isValid_Impl( return bRes; // search for entry with that language - LangSvcEntries_Spell *pEntry = aSvcMap[ nLanguage ].get(); + SpellSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (!pEntry) { @@ -497,7 +498,8 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( return xRes; // search for entry with that language - LangSvcEntries_Spell *pEntry = aSvcMap[ nLanguage ].get(); + SpellSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (!pEntry) { @@ -847,8 +849,9 @@ Sequence< OUString > // search for entry with that language and use data from that INT16 nLanguage = LocaleToLanguage( rLocale ); - SpellCheckerDispatcher *pThis = (SpellCheckerDispatcher *) this; - const LangSvcEntries_Spell *pEntry = pThis->aSvcMap[ nLanguage ].get(); + SpellCheckerDispatcher *pThis = (SpellCheckerDispatcher *) this; + const SpellSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) ); + const LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (pEntry) aRes = pEntry->aSvcImplNames; diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx index cc0623d1dd82..b944e3a44d1b 100644 --- a/linguistic/source/thesdsp.cxx +++ b/linguistic/source/thesdsp.cxx @@ -136,7 +136,8 @@ Sequence< Reference< XMeaning > > SAL_CALL return aMeanings; // search for entry with that language - LangSvcEntries_Thes *pEntry = aSvcMap[ nLanguage ].get(); + ThesSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); + LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (!pEntry) { @@ -264,8 +265,9 @@ Sequence< OUString > // search for entry with that language and use data from that INT16 nLanguage = LocaleToLanguage( rLocale ); - ThesaurusDispatcher *pThis = (ThesaurusDispatcher *) this; - const LangSvcEntries_Thes *pEntry = pThis->aSvcMap[ nLanguage ].get(); + ThesaurusDispatcher *pThis = (ThesaurusDispatcher *) this; + const ThesSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) ); + const LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; if (pEntry) aRes = pEntry->aSvcImplNames; diff --git a/sfx2/inc/sfx2/mnuitem.hxx b/sfx2/inc/sfx2/mnuitem.hxx index 85381a891c4b..a173f6e1a31e 100644 --- a/sfx2/inc/sfx2/mnuitem.hxx +++ b/sfx2/inc/sfx2/mnuitem.hxx @@ -90,9 +90,9 @@ public: virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); - static SfxMenuControl* CreateControl( USHORT nId, Menu &, SfxBindings & ); - static SfxUnoMenuControl* - CreateControl( const String&, USHORT, Menu&, SfxBindings&, SfxVirtualMenu* ); + static SfxMenuControl* CreateControl( USHORT nId, Menu &, SfxBindings & ); + static SfxUnoMenuControl* CreateControl( const String&, USHORT, Menu&, SfxBindings&, SfxVirtualMenu* ); + static SfxUnoMenuControl* CreateControl( const String&, USHORT, Menu&, const String& sItemText, const String& sHelpText, SfxBindings&, SfxVirtualMenu* ); static BOOL IsSpecialControl( USHORT nId, SfxModule* ); static void RegisterMenuControl(SfxModule*, SfxMenuCtrlFactory*); @@ -104,6 +104,9 @@ class SfxUnoMenuControl : public SfxMenuControl public: SfxUnoMenuControl( const String&, USHORT nId, Menu&, SfxBindings&, SfxVirtualMenu* ); + SfxUnoMenuControl( const String&, USHORT nId, Menu&, + const String&, const String&, + SfxBindings&, SfxVirtualMenu* ); ~SfxUnoMenuControl(); void Select(); }; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 32ae33ec3c8b..302233a93ad7 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -155,6 +155,8 @@ using namespace ::com::sun::star::io; #define MAX_REDIRECT 5 +sal_Bool IsReadonlyAccordingACL( const sal_Unicode* pFilePath ); + //========================================================== namespace { @@ -1145,6 +1147,15 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI ) } catch( uno::Exception ) {} + + if ( !bContentReadonly ) + { + // the file is not readonly, check the ACL + + String aPhysPath; + if ( ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aPhysPath ) ) + bContentReadonly = IsReadonlyAccordingACL( aPhysPath.GetBuffer() ); + } } // do further checks only if the file not readonly in fs diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index 1b42844491e0..66fd03175a8e 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -86,11 +86,19 @@ SLOFILES = \ $(SLO)$/DocumentMetadataAccess.obj \ $(SLO)$/Metadatable.obj \ $(SLO)$/sfxmodelfactory.obj \ + $(SLO)$/sfxacldetect.obj \ $(SLO)$/docstoragemodifylistener.obj \ $(SLO)$/querytemplate.obj # $(SLO)$/applet.obj \ +.IF "$(GUI)" == "WNT" + +#HACK TO DISABLE PCH +NOOPTFILES= \ + $(SLO)$/sfxacldetect.obj +.ENDIF + # --- Tagets ------------------------------------------------------- diff --git a/sfx2/source/doc/sfxacldetect.cxx b/sfx2/source/doc/sfxacldetect.cxx new file mode 100755 index 000000000000..94370e9a1c52 --- /dev/null +++ b/sfx2/source/doc/sfxacldetect.cxx @@ -0,0 +1,108 @@ +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: shutdowniconw32.cxx,v $
+ * $Revision: 1.48 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifdef WNT
+
+// necessary to include system headers without warnings
+#ifdef _MSC_VER
+#pragma warning(disable:4668 4917)
+#endif
+
+#include <windows.h>
+#include <lmaccess.h>
+#include <sal/types.h>
+
+sal_Bool IsReadonlyAccordingACL( const sal_Unicode* pFilePath )
+{
+ sal_Bool bResult = sal_False;
+
+ sal_uInt32 nFDSize = 0;
+ GetFileSecurityW( pFilePath, DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION, NULL, 0, &nFDSize );
+ if ( nFDSize )
+ {
+ PSECURITY_DESCRIPTOR pFileDescr = reinterpret_cast< PSECURITY_DESCRIPTOR >( malloc( nFDSize ) );
+ if ( GetFileSecurityW( pFilePath, DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION, pFileDescr, nFDSize, &nFDSize ) )
+ {
+ HANDLE hToken = NULL;
+ if ( OpenThreadToken( GetCurrentThread(), TOKEN_DUPLICATE|TOKEN_QUERY, TRUE, &hToken )
+ || OpenProcessToken( GetCurrentProcess(), TOKEN_DUPLICATE|TOKEN_QUERY, &hToken) )
+ {
+ HANDLE hImpersonationToken = NULL;
+ if ( DuplicateToken( hToken, SecurityImpersonation, &hImpersonationToken) )
+ {
+ sal_uInt32 nDesiredAccess = ACCESS_WRITE;
+ GENERIC_MAPPING aGenericMapping = { ACCESS_READ, ACCESS_WRITE, 0, ACCESS_READ | ACCESS_WRITE };
+ MapGenericMask( &nDesiredAccess, &aGenericMapping );
+
+ PRIVILEGE_SET aPrivilegeSet;
+ sal_uInt32 nPrivilegeSetSize = sizeof( PRIVILEGE_SET );
+
+ sal_uInt32 nGrantedAccess;
+ BOOL bAccessible = TRUE;
+ if ( AccessCheck( pFileDescr,
+ hImpersonationToken,
+ nDesiredAccess,
+ &aGenericMapping,
+ &aPrivilegeSet,
+ &nPrivilegeSetSize,
+ &nGrantedAccess,
+ &bAccessible ) )
+ {
+ bResult = !bAccessible;
+ }
+
+ CloseHandle( hImpersonationToken );
+ }
+
+ CloseHandle( hToken );
+ }
+ }
+
+ free( pFileDescr );
+ }
+
+ return bResult;
+}
+
+#else // this is UNX
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sfx2.hxx"
+
+
+#include <sal/types.h>
+
+sal_Bool IsReadonlyAccordingACL( const sal_Unicode* )
+{
+ // to be implemented
+ return sal_False;
+}
+
+#endif
+
diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index 6619c17d3077..88247a0966e7 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -542,6 +542,13 @@ SfxUnoMenuControl* SfxMenuControl::CreateControl( const String& rCmd, return new SfxUnoMenuControl( rCmd, nId, rMenu, rBindings, pVirt ); } +SfxUnoMenuControl* SfxMenuControl::CreateControl( const String& rCmd, + USHORT nId, Menu& rMenu, const String& sItemText, const String& sHelpText, + SfxBindings& rBindings, SfxVirtualMenu* pVirt) +{ + return new SfxUnoMenuControl( rCmd, nId, rMenu, sItemText, sHelpText, rBindings, pVirt); +} + SfxUnoMenuControl::SfxUnoMenuControl( const String& rCmd, USHORT nSlotId, Menu& rMenu, SfxBindings& rBindings, SfxVirtualMenu* pVirt ) : SfxMenuControl( nSlotId, rBindings ) @@ -554,6 +561,19 @@ SfxUnoMenuControl::SfxUnoMenuControl( const String& rCmd, USHORT nSlotId, pUnoCtrl->GetNewDispatch(); } +SfxUnoMenuControl::SfxUnoMenuControl( + const String& rCmd, USHORT nSlotId, Menu& /*rMenu*/, + const String& rItemText, const String& rHelpText, + SfxBindings& rBindings, SfxVirtualMenu* pVirt) + : SfxMenuControl( nSlotId, rBindings ) +{ + Bind( pVirt, nSlotId, rItemText, rHelpText, rBindings); + UnBind(); + pUnoCtrl = new SfxUnoControllerItem( this, rBindings, rCmd ); + pUnoCtrl->acquire(); + pUnoCtrl->GetNewDispatch(); +} + SfxUnoMenuControl::~SfxUnoMenuControl() { pUnoCtrl->UnBind(); diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index e0b6f6f32bf2..326431c3ffbd 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -417,8 +417,12 @@ void SfxVirtualMenu::CreateFromSVMenu() DELETEZ( pPopup ); } + const String sItemText = pSVMenu->GetItemText(nSlotId); + const String sHelpText = pSVMenu->GetHelpText(nSlotId); + if ( pPopup ) { + SfxMenuControl *pMnuCtrl = SfxMenuControl::CreateControl(nSlotId, *pPopup, *pBindings); @@ -434,10 +438,8 @@ void SfxVirtualMenu::CreateFromSVMenu() SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count() ); - (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId), - pSVMenu->GetHelpText(nSlotId), *pBindings); - pMnuCtrl->Bind( this, nSlotId, pSVMenu->GetItemText(nSlotId), - pSVMenu->GetHelpText(nSlotId), *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); + pMnuCtrl->Bind( this, nSlotId, sItemText, sHelpText, *pBindings); if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) { @@ -473,7 +475,7 @@ void SfxVirtualMenu::CreateFromSVMenu() { pMnuCtrl->Bind( this, nSlotId, *new SfxVirtualMenu(nSlotId, this, *pPopup, bHelpInitialized, *pBindings, bOLE, bResCtor), - pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), + sItemText, sHelpText, *pBindings ); } } @@ -510,12 +512,12 @@ void SfxVirtualMenu::CreateFromSVMenu() if ( aCmd.Len() && (( nSlotId < SID_SFX_START ) || ( nSlotId > SHRT_MAX )) ) { // try to create control via comand name - pMnuCtrl = SfxMenuControl::CreateControl( aCmd, nSlotId, *pSVMenu, *pBindings, this ); + pMnuCtrl = SfxMenuControl::CreateControl( aCmd, nSlotId, *pSVMenu, sItemText, sHelpText, *pBindings, this ); if ( pMnuCtrl ) { SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count()); - (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); } } @@ -527,13 +529,13 @@ void SfxVirtualMenu::CreateFromSVMenu() { SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.C40_INSERT( SfxMenuControl, pMnuCtrl, rCtrlArr.Count()); - (pItems+nPos)->Bind( 0, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings); + (pItems+nPos)->Bind( 0, nSlotId, sItemText, sHelpText, *pBindings); } else // take default control pMnuCtrl = (pItems+nPos); - pMnuCtrl->Bind( this, nSlotId, pSVMenu->GetItemText(nSlotId), pSVMenu->GetHelpText(nSlotId), *pBindings); + pMnuCtrl->Bind( this, nSlotId, sItemText, sHelpText, *pBindings); } if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index c0980017c2ed..1de0bc80ee73 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -137,6 +137,19 @@ rtl::OUString Databases::expandURL( const rtl::OUString& aURL, Reference< uno::X return aRetURL; } + +// Hold Packages to improve performance (#i106100) +// The PackageManager implementation seems to completely throw away all cached data +// as soon as the last reference to a XPackage dies. Maybe this should be changed. +struct ImplPackageSequenceHolder +{ + Sequence< Reference< deployment::XPackage > > m_aUserPackagesSeq; + Sequence< Reference< deployment::XPackage > > m_aSharedPackagesSeq; +}; + +static ImplPackageSequenceHolder* GpPackageSequenceHolder = NULL; + + Databases::Databases( sal_Bool showBasic, const rtl::OUString& instPath, const com::sun::star::uno::Sequence< rtl::OUString >& imagesZipPaths, @@ -187,6 +200,8 @@ Databases::Databases( sal_Bool showBasic, m_xSFA = Reference< ucb::XSimpleFileAccess >( m_xSMgr->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), m_xContext ), UNO_QUERY_THROW ); + + GpPackageSequenceHolder = new ImplPackageSequenceHolder(); } Databases::~Databases() @@ -235,6 +250,7 @@ Databases::~Databases() } } + delete GpPackageSequenceHolder; } static bool impl_getZipFile( @@ -1530,6 +1546,8 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextUserHelpPack thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("user") ); m_aUserPackagesSeq = xUserManager->getDeployedPackages ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + if( GpPackageSequenceHolder != NULL ) + GpPackageSequenceHolder->m_aUserPackagesSeq = m_aUserPackagesSeq; m_bUserPackagesLoaded = true; } @@ -1560,6 +1578,8 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("shared") ); m_aSharedPackagesSeq = xSharedManager->getDeployedPackages ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + if( GpPackageSequenceHolder != NULL ) + GpPackageSequenceHolder->m_aSharedPackagesSeq = m_aSharedPackagesSeq; m_bSharedPackagesLoaded = true; } |