diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/doc/graphhelp.cxx | 27 |
3 files changed, 23 insertions, 30 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 23093bfa066f..3fec8e40bfb7 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -1231,9 +1231,20 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI ) if ( !bResult && !IsReadOnly() ) { // check whether the file is readonly in fs + // the check is only necessary if // do it only for loading, some contents still might have problems with this property, let them not affect the saving sal_Bool bContentReadonly = sal_False; - if ( bLoading ) + if ( bLoading && ::utl::LocalFileHelper::IsLocalFile( aLogicName ) ) + { + // let the stream be opened to check the possibility to open it for editing + GetMedium_Impl(); + } + + // "IsReadOnly" property does not allow to detect whether the file is readonly always + // so we try always to open the file for editing + // the file is readonly only in case the read-write stream can not be opened + SFX_ITEMSET_ARG( pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM, sal_False); + if ( bLoading && !pWriteStreamItem ) { try { @@ -1244,11 +1255,12 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI ) {} } + // do further checks only if the file not readonly in fs if ( !bContentReadonly ) { + // the special file locking should be used only for file URLs if ( ::utl::LocalFileHelper::IsLocalFile( aLogicName ) ) { - // the special file locking should be used only for file URLs // in case of storing the document should request the output before locking if ( bLoading ) diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 7df93afaa63e..099e649506c0 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -72,6 +72,7 @@ #include "sfxurlrelocator.hxx" #include "doctemplateslocal.hxx" #include <sfx2/docfac.hxx> +#include <sfx2/docfile.hxx> #include "doc.hrc" //----------------------------------------------------------------------------- @@ -909,7 +910,8 @@ sal_Bool SfxDocTplService_Impl::CreateNewUniqueFolderWithPrefix( const ::rtl::OU Content aParent; - if ( Content::create( aDirPath.GetMainURL( INetURLObject::NO_DECODE ), maCmdEnv, aParent ) ) + uno::Reference< XCommandEnvironment > aQuietEnv; + if ( Content::create( aDirPath.GetMainURL( INetURLObject::NO_DECODE ), aQuietEnv, aParent ) ) { for ( sal_Int32 nInd = 0; nInd < 32000; nInd++ ) { @@ -1919,7 +1921,11 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, aStoreArgs[1].Name = ::rtl::OUString::createFromAscii( "DocumentTitle" ); aStoreArgs[1].Value <<= rTemplateName; - rStorable->storeToURL( aNewTemplateTargetURL, aStoreArgs ); + ::rtl::OUString aCurrentDocumentURL = rStorable->getLocation(); + if( !SfxMedium::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() )) + rStorable->storeToURL( aNewTemplateTargetURL, aStoreArgs ); + else + rStorable->store(); // the storing was successful, now the old template with the same name can be removed if it existed if ( aTemplateToRemoveTargetURL.getLength() ) diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index f1e6cc80812e..bd0e65830870 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -374,32 +374,7 @@ sal_Bool GraphicHelper::createThumb_Impl( const GDIMetaFile& rMtf, if ( aBmp.GetBitCount() != 24 ) aBmp.Convert( BMP_CONVERSION_24BIT ); - // create resulting mask bitmap with metafile output set to black - GDIMetaFile aMonchromeMtf( rMtf.GetMonochromeMtf( COL_BLACK ) ); - aVDev.DrawWallpaper( Rectangle( aNullPt, aSizePix ), Wallpaper( Color( COL_WHITE ) ) ); - aMonchromeMtf.WindStart(); - aMonchromeMtf.Play( &aVDev, aBackPosPix, aDrawSize ); - - // watch for overlay mask - if ( pOverlay ) - { - Bitmap aOverlayMergeBmp( aVDev.GetBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize() ) ); - - // create ANDed resulting mask at overlay area - if ( pOverlay->IsTransparent() ) - aVDev.DrawBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), pOverlay->GetMask() ); - else - { - aVDev.SetLineColor( COL_BLACK ); - aVDev.SetFillColor( COL_BLACK ); - aVDev.DrawRect( aOverlayRect); - } - - aOverlayMergeBmp.CombineSimple( aVDev.GetBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize() ), BMP_COMBINE_AND ); - aVDev.DrawBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), aOverlayMergeBmp ); - } - - rBmpEx = BitmapEx( aBmp, aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) ); + rBmpEx = BitmapEx( aBmp ); } return !rBmpEx.IsEmpty(); |