CWS-TOOLING: integrate CWS fwk103

2009-05-26 12:44:25 +0200 mst  r272292 : #i100727#
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx:
  + fix warning: rename method to prevent overloading
2009-05-19 13:42:31 +0200 mav  r272075 : #i101356# add comment
2009-05-19 10:56:24 +0200 mav  r272062 : #i101356# register the singleton correctly
2009-05-19 10:25:42 +0200 mav  r272060 : #i101356# register the singleton correctly
2009-05-18 12:48:48 +0200 mav  r272013 : #i91306# fix the typo
2009-05-14 08:50:06 +0200 mav  r271871 : #i101356# reduce the amount of macros
2009-05-13 13:26:08 +0200 mav  r271858 : #i101356# reduce the amount of macros
2009-05-13 11:29:16 +0200 mav  r271849 : #i101356# reduce the amount of macros
2009-05-12 12:09:42 +0200 mav  r271815 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 12:03:20 +0200 mav  r271814 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:58:48 +0200 mav  r271813 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:53:05 +0200 mav  r271812 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:48:36 +0200 mav  r271810 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:43:45 +0200 mav  r271809 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:39:38 +0200 mav  r271808 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:37:38 +0200 mav  r271806 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:33:58 +0200 mav  r271805 : #i101356# allow to generate a small log if a document can not be stored
2009-05-12 11:30:01 +0200 mav  r271804 : #i101356# allow to generate a small log if a document can not be stored
2009-05-06 17:43:38 +0200 mst  r271607 : #i100727#
- svtools/source/svhtml/parhtml.cxx:
  + adapt code to renaming of HTML constants (sb107)
2009-05-05 11:14:18 +0200 mav  r271507 : #i101222# avoid warning
2009-05-05 10:27:23 +0200 mav  r271505 : #i101426# send the modified() notification only when the document can be modified
2009-05-05 10:25:07 +0200 mav  r271504 : #i101426# send the modified() notification only when the document is modified
2009-05-05 08:42:48 +0200 mav  r271497 : CWS-TOOLING: rebase CWS fwk103 to trunk@271427 (milestone: DEV300:m47)
2009-04-30 13:32:11 +0200 mav  r271412 : #i100518# check the template folders quietly
2009-04-29 20:04:25 +0200 mst  r271393 : - sw/source/filter/html/swhtml.cxx:
  + fix wrong initialization order in constructor
2009-04-28 12:28:46 +0200 mav  r271319 : #i99142# set the error correctly
2009-04-28 08:44:48 +0200 mav  r271305 : #i99050# clear hidden flag if necessary
2009-04-28 08:40:10 +0200 mav  r271304 : #i99050# avoid crash
2009-04-22 07:40:11 +0200 mav  r271056 : #i101093# lets not affect the performance
2009-04-15 09:30:47 +0200 cd  r270820 : #i99771# Fix warnings for gcc 4.4
2009-04-15 09:19:52 +0200 cd  r270819 : #i99771# Fix warnings for gcc 4.4
2009-04-15 08:42:34 +0200 cd  r270817 : #i99771# Fix warnings for gcc 4.4
2009-04-14 14:31:01 +0200 mav  r270768 : #i99493# fix typo
2009-04-01 12:45:43 +0200 mst  r270317 : fix #i100727#
- svtools/inc/svtools/svparser.hxx, svtools/source/svrtf/svparser.cxx,
  sfx2/inc/sfx2/docfile.hxx, sfx2/source/doc/{objmisc.cxx,docfile.cxx}:
  + move SvKeyValue stuff from sfx2 to svtools
- svtools/inc/svtools/parhtml.hxx, svtools/source/svhtml/parhtml.cxx,
  sfx2/inc/sfx2/sfxhtml.hxx, sfx2/source/bastyp/sfxhtml.cxx:
  + move ParseMetaOptions() and GetEncodingByMIME() from SfxHTMLParser (sfx2)
    to HTMLParser (svtools)
  + make HTMLParser::ParseMetaOptions() a virtual function
  + HTMLParser::ParseMetaOptions() calls GetExtendedCompatibilityTextEncoding()
  + new template method HTMLParser::AddMetaUserDefined()
- svtools/source/svhtml/makefile.mk:
  + enable exceptions for parhtml.cxx
- dbaccess/source/ui/misc/HtmlReader.cxx,
  sc/source/filter/html/htmlpars.cxx:
  + remove encoding related code duplication
- sw/source/filter/html/{swhtml{.hxx,.cxx},htmlfld.cxx}:
  + new SwHTMLParser::AddMetaUserDefined() for import of
    DOCINFO field subtypes INFO[1-4]
  + do not use DocumentInfo for import of DOCINFO field subtypes INFO[1-4]
2009-03-31 17:01:35 +0200 mav  r270288 : #i91214# fix typo
2009-03-31 15:19:41 +0200 mav  r270285 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 15:00:36 +0200 mav  r270284 : #i100123# allow to turn OOo locking mechanics off
2009-03-31 12:19:13 +0200 mav  r270270 : #i100123# taking the lock file over throws no exception
2009-03-30 13:57:21 +0200 mav  r270227 : #i100351# fix the typo
2009-03-30 13:47:26 +0200 mav  r270225 : #i99885# let OK be default button
2009-03-29 19:38:55 +0200 mav  r270190 : CWS-TOOLING: rebase CWS fwk103 to trunk@270033 (milestone: DEV300:m45)
2009-03-16 16:39:48 +0100 mav  r269558 : #i93558# convert the attributes as well
2009-03-13 15:35:55 +0100 mav  r269488 : #i93558# improve manifest.xml parsing
2009-03-13 08:47:00 +0100 mav  r269454 : #i96205# allow to remove password on SaveAs
2009-03-12 13:36:07 +0100 mav  r269398 : #i91306# show special error in case of shared document
2009-03-12 13:33:35 +0100 mav  r269397 : #i91306# introduce the new error-message
2009-03-12 11:40:42 +0100 mst  r269378 : fix #i90877#
- svtools/source/uno/unoevent.cxx:
  + use proper operator delete[]
2009-02-26 15:23:10 +0100 mav  r268526 : #i91214# do not use ATL
2009-02-26 14:19:06 +0100 mav  r268516 : #i98909# integrate the patch
2009-02-10 17:29:52 +0100 cd  r267568 : #i98649# Make sure that we catch the NoSuchElementException when a module is not installed.
This commit is contained in:
Ivo Hinkelmann 2009-06-16 16:15:54 +00:00
parent 23337b9a2d
commit a245ebc751
32 changed files with 753 additions and 680 deletions

View File

@ -39,14 +39,10 @@ TARGET=emboleobj
.INCLUDE : settings.mk
.IF "$(DISABLE_ATL)"==""
# .IF "$(DISABLE_ATL)"==""
LIBTARGET=NO
USE_DEFFILE=YES
INCPRE+=$(ATL_INCLUDE)
.IF "$(MFC_INCLUDE)"!=""
INCPRE+=$(MFC_INCLUDE)
.ENDIF
# --- Files --------------------------------------------------------
@ -134,7 +130,7 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
.ENDIF
# .ENDIF
# --- Targets -------------------------------------------------------
.INCLUDE : target.mk

View File

@ -58,6 +58,120 @@ using namespace ::comphelper;
#define MAX_ENUM_ELE 20
#define FORMATS_NUM 3
// ============ class ComSmart =====================
namespace {
template< class T > class ComSmart
{
T* m_pInterface;
void OwnRelease()
{
if ( m_pInterface )
{
T* pInterface = m_pInterface;
m_pInterface = NULL;
pInterface->Release();
}
}
public:
ComSmart()
: m_pInterface( NULL )
{}
ComSmart( const ComSmart<T>& rObj )
: m_pInterface( rObj.m_pInterface )
{
if ( m_pInterface != NULL )
m_pInterface->AddRef();
}
ComSmart( T* pInterface )
: m_pInterface( pInterface )
{
if ( m_pInterface != NULL )
m_pInterface->AddRef();
}
~ComSmart()
{
OwnRelease();
}
ComSmart& operator=( const ComSmart<T>& rObj )
{
OwnRelease();
m_pInterface = rObj.m_pInterface;
if ( m_pInterface != NULL )
m_pInterface->AddRef();
return *this;
}
ComSmart<T>& operator=( T* pInterface )
{
OwnRelease();
m_pInterface = pInterface;
if ( m_pInterface != NULL )
m_pInterface->AddRef();
return *this;
}
operator T*() const
{
return m_pInterface;
}
T& operator*() const
{
return *m_pInterface;
}
T** operator&()
{
OwnRelease();
m_pInterface = NULL;
return &m_pInterface;
}
T* operator->() const
{
return m_pInterface;
}
BOOL operator==( const ComSmart<T>& rObj ) const
{
return ( m_pInterface == rObj.m_pInterface );
}
BOOL operator!=( const ComSmart<T>& rObj ) const
{
return ( m_pInterface != rObj.m_pInterface );
}
BOOL operator==( const T* pInterface ) const
{
return ( m_pInterface == pInterface );
}
BOOL operator!=( const T* pInterface ) const
{
return ( m_pInterface != pInterface );
}
};
}
// ============ class ComSmart =====================
sal_Bool ConvertBufferToFormat( void* pBuf,
sal_uInt32 nBufSize,
const ::rtl::OUString& aFormatShortName,
@ -74,10 +188,10 @@ FORMATETC pFormatTemplates[FORMATS_NUM] = {
struct OleComponentNative_Impl {
CComPtr< IUnknown > m_pObj;
CComPtr< IOleObject > m_pOleObject;
CComPtr< IViewObject2 > m_pViewObject2;
CComPtr< IStorage > m_pIStorage;
ComSmart< IUnknown > m_pObj;
ComSmart< IOleObject > m_pOleObject;
ComSmart< IViewObject2 > m_pViewObject2;
ComSmart< IStorage > m_pIStorage;
FormatEtcList m_aFormatsList;
uno::Sequence< datatransfer::DataFlavor > m_aSupportedGraphFormats;
uno::Sequence< ::rtl::OUString > m_aGraphShortFormats; //short names for formats from previous sequence
@ -509,11 +623,11 @@ void OleComponent::RetrieveObjectDataFlavors_Impl()
if ( !m_aDataFlavors.getLength() )
{
CComPtr< IDataObject > pDataObject;
ComSmart< IDataObject > pDataObject;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
if ( SUCCEEDED( hr ) && pDataObject )
{
CComPtr< IEnumFORMATETC > pFormatEnum;
ComSmart< IEnumFORMATETC > pFormatEnum;
hr = pDataObject->EnumFormatEtc( DATADIR_GET, &pFormatEnum );
if ( SUCCEEDED( hr ) && pFormatEnum )
{
@ -561,11 +675,11 @@ sal_Bool OleComponent::InitializeObject_Impl()
return sal_False;
// the linked object will be detected here
CComPtr< IOleLink > pOleLink;
ComSmart< IOleLink > pOleLink;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IOleLink, (void**)&pOleLink );
OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
if ( m_pUnoOleObject )
m_pUnoOleObject->SetObjectIsLink_Impl( pOleLink != NULL );
m_pUnoOleObject->SetObjectIsLink_Impl( sal_Bool( pOleLink != NULL ) );
hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IViewObject2, (void**)&m_pNativeImpl->m_pViewObject2 );
@ -799,7 +913,7 @@ void OleComponent::InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent )
if ( m_pNativeImpl->m_pIStorage )
throw io::IOException(); // TODO:the object is already initialized
CComPtr< IDataObject > pDataObject;
ComSmart< IDataObject > pDataObject;
HRESULT hr = pOleLinkComponent->m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
if ( SUCCEEDED( hr ) && pDataObject && SUCCEEDED( OleQueryCreateFromData( pDataObject ) ) )
{
@ -819,12 +933,12 @@ void OleComponent::InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent )
if ( !m_pNativeImpl->m_pObj )
{
CComPtr< IOleLink > pOleLink;
ComSmart< IOleLink > pOleLink;
hr = pOleLinkComponent->m_pNativeImpl->m_pObj->QueryInterface( IID_IOleLink, (void**)&pOleLink );
if ( FAILED( hr ) || !pOleLink )
throw io::IOException(); // TODO: the object doesn't support IOleLink
CComPtr< IMoniker > pMoniker;
ComSmart< IMoniker > pMoniker;
hr = pOleLink->GetSourceMoniker( &pMoniker );
if ( FAILED( hr ) || !pMoniker )
throw io::IOException(); // TODO: can not retrieve moniker
@ -834,7 +948,7 @@ void OleComponent::InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent )
hr = pMoniker->IsSystemMoniker( &aMonType );
if ( SUCCEEDED( hr ) && aMonType == MKSYS_FILEMONIKER )
{
CComPtr< IMalloc > pMalloc;
ComSmart< IMalloc > pMalloc;
CoGetMalloc( 1, &pMalloc ); // if fails there will be a memory leak
OSL_ENSURE( pMalloc, "CoGetMalloc() failed!" );
@ -860,11 +974,11 @@ void OleComponent::InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent )
// in case of other moniker types the only way is to get storage
if ( !m_pNativeImpl->m_pObj )
{
CComPtr< IBindCtx > pBindCtx;
ComSmart< IBindCtx > pBindCtx;
hr = CreateBindCtx( 0, ( LPBC FAR* )&pBindCtx );
if ( SUCCEEDED( hr ) && pBindCtx )
{
CComPtr< IStorage > pObjectStorage;
ComSmart< IStorage > pObjectStorage;
hr = pMoniker->BindToStorage( pBindCtx, NULL, IID_IStorage, (void**)&pObjectStorage );
if ( SUCCEEDED( hr ) && pObjectStorage )
{
@ -948,7 +1062,7 @@ uno::Sequence< embed::VerbDescriptor > OleComponent::GetVerbList()
if( !m_aVerbList.getLength() )
{
CComPtr< IEnumOLEVERB > pEnum;
ComSmart< IEnumOLEVERB > pEnum;
if( SUCCEEDED( m_pNativeImpl->m_pOleObject->EnumVerbs( &pEnum ) ) )
{
OLEVERB szEle[ MAX_ENUM_ELE ];
@ -1045,7 +1159,7 @@ awt::Size OleComponent::GetExtent( sal_Int64 nAspect )
if ( nMSAspect == DVASPECT_CONTENT )
{
// Try to get the size from the replacement image first
CComPtr< IDataObject > pDataObject;
ComSmart< IDataObject > pDataObject;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
if ( SUCCEEDED( hr ) || pDataObject )
{
@ -1190,7 +1304,7 @@ sal_Bool OleComponent::IsDirty()
if ( IsWorkaroundActive() )
return sal_True;
CComPtr< IPersistStorage > pPersistStorage;
ComSmart< IPersistStorage > pPersistStorage;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IPersistStorage, (void**)&pPersistStorage );
if ( FAILED( hr ) || !pPersistStorage )
throw io::IOException(); // TODO
@ -1205,7 +1319,7 @@ void OleComponent::StoreOwnTmpIfNecessary()
if ( !m_pNativeImpl->m_pOleObject )
throw embed::WrongStateException(); // TODO: the object is in wrong state
CComPtr< IPersistStorage > pPersistStorage;
ComSmart< IPersistStorage > pPersistStorage;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IPersistStorage, (void**)&pPersistStorage );
if ( FAILED( hr ) || !pPersistStorage )
throw io::IOException(); // TODO
@ -1439,7 +1553,7 @@ uno::Any SAL_CALL OleComponent::getTransferData( const datatransfer::DataFlavor&
DWORD nRequestedAspect = GetAspectFromFlavor( aFlavor );
// if own icon is set and icon aspect is requested the own icon can be returned directly
CComPtr< IDataObject > pDataObject;
ComSmart< IDataObject > pDataObject;
HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
if ( FAILED( hr ) || !pDataObject )
throw io::IOException(); // TODO: transport error code

View File

@ -41,16 +41,9 @@
#pragma warning(push, 1)
#pragma warning(disable: 4548 4555 4917)
#endif
#include "windows.h"
#ifdef __MINGW32__
#include <atlbase.h>
#else
#if defined(_MSC_VER) && (_MSC_VER > 1310)
#include <atldbcli.h>
#else
#include "atlcomcli.h"
#endif
#endif
#if defined _MSC_VER
#pragma warning(pop)
#endif

View File

@ -5624,11 +5624,17 @@ Dymamic border coloring means that when the mouse is hovered over a control, and
<prop oor:name="UseDocumentSystemFileLocking" oor:type="xs:boolean">
<info>
<author>MAV</author>
<desc>Allows to specify whether the OOo document file locking mechanics should use the system file locking additionaly.</desc>
<desc>Allows to specify whether the OOo document file locking mechanics should use the system file locking.</desc>
</info>
<value>true</value>
</prop>
<prop oor:name="UseDocumentOOoLockFile" oor:type="xs:boolean">
<info>
<author>MAV</author>
<desc>Allows to specify whether the OOo document file locking mechanics should use the lock file for locking.</desc>
</info>
<value>true</value>
</prop>
<prop oor:name="UseSystemPrintDialog" oor:type="xs:boolean">
<info>
<author>PL</author>

View File

@ -1,4 +1,4 @@
/*************************************************************************
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -206,7 +206,9 @@ public:
{ return ERRCODE_TOERROR(GetErrorCode()); }
sal_uInt32 GetLastStorageCreationState();
void SetError( sal_uInt32 nError ) { eError = nError; }
void SetError( sal_uInt32 nError, const ::rtl::OUString& aLogMessage );
void AddLog( const ::rtl::OUString& aMessage );
void CloseInStream();
sal_Bool CloseOutStream();
@ -360,89 +362,5 @@ SV_DECL_COMPAT_WEAK( SfxMedium )
DECLARE_LIST( SfxMediumList, SfxMedium* )
#endif
/*========================================================================
*
* SvKeyValue.
*
*======================================================================*/
#ifndef COPYCTOR_API
#define COPYCTOR_API(C) C (const C&); C& operator= (const C&)
#endif
SV_DECL_REF(SvKeyValueIterator)
class SvKeyValue
{
/** Representation.
*/
String m_aKey;
String m_aValue;
public:
/** Construction.
*/
SvKeyValue (void)
{}
SvKeyValue (const String &rKey, const String &rValue)
: m_aKey (rKey), m_aValue (rValue)
{}
SvKeyValue (const SvKeyValue &rOther)
: m_aKey (rOther.m_aKey), m_aValue (rOther.m_aValue)
{}
/** Assignment.
*/
SvKeyValue& operator= (SvKeyValue &rOther)
{
m_aKey = rOther.m_aKey;
m_aValue = rOther.m_aValue;
return *this;
}
/** Operation.
*/
const String& GetKey (void) const { return m_aKey; }
const String& GetValue (void) const { return m_aValue; }
void SetKey (const String &rKey ) { m_aKey = rKey; }
void SetValue (const String &rValue) { m_aValue = rValue; }
};
/*========================================================================
*
* SvKeyValueIterator.
*
*======================================================================*/
class SvKeyValueList_Impl;
class SFX2_DLLPUBLIC SvKeyValueIterator : public SvRefBase
{
/** Representation.
*/
SvKeyValueList_Impl* m_pList;
USHORT m_nPos;
/** Not implemented.
*/
COPYCTOR_API(SvKeyValueIterator);
public:
/** Construction/Destruction.
*/
SvKeyValueIterator (void);
virtual ~SvKeyValueIterator (void);
/** Operation.
*/
virtual BOOL GetFirst (SvKeyValue &rKeyVal);
virtual BOOL GetNext (SvKeyValue &rKeyVal);
virtual void Append (const SvKeyValue &rKeyVal);
};
SV_IMPL_REF(SvKeyValueIterator);
#endif

View File

@ -325,7 +325,10 @@ public:
void ResetError();
sal_uInt32 GetError() const;
sal_uInt32 GetErrorCode() const;
void SetError(sal_uInt32 rErr);
void SetError( sal_uInt32 rErr, const ::rtl::OUString& aLogMessage );
void AddLog( const ::rtl::OUString& aMessage );
void StoreLog();
sal_Bool DoInitNew( SfxMedium* pMedium=0 );
sal_Bool DoLoad( SfxMedium* pMedium );

View File

@ -38,16 +38,10 @@
#include <svtools/parhtml.hxx>
#include <svtools/macitem.hxx>
namespace com { namespace sun { namespace star {
namespace document {
class XDocumentProperties;
}
} } }
class ImageMap;
class SfxMedium;
class SfxObjectShell;
class SvKeyValueIterator;
class SFX2_DLLPUBLIC SfxHTMLParser : public HTMLParser
{
@ -67,7 +61,7 @@ protected:
SfxHTMLParser( SvStream& rStream, BOOL bNewDoc=TRUE, SfxMedium *pMedium=0 );
~SfxHTMLParser();
virtual ~SfxHTMLParser();
public:
// Lesen der Optionen einer Image-Map
@ -85,24 +79,14 @@ public:
USHORT nEventMouseOver = 0,
USHORT nEventMouseOut = 0);
/// parse meta options into XDocumentProperties
static BOOL ParseMetaOptions( const ::com::sun::star::uno::Reference<
::com::sun::star::document::XDocumentProperties>&,
SvKeyValueIterator*,
const HTMLOptions*,
rtl_TextEncoding& rEnc );
// <TD SDVAL="..." SDNUM="...">
static double GetTableDataOptionsValNum( sal_uInt32& nNumForm,
LanguageType& eNumLang, const String& aValStr,
const String& aNumStr, SvNumberFormatter& rFormatter );
static rtl_TextEncoding GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader );
protected:
BOOL ParseMetaOptions( const ::com::sun::star::uno::Reference<
::com::sun::star::document::XDocumentProperties>&,
SvKeyValueIterator* );
protected:
// Start eines File-Downloads. Dieser erfolgt synchron oder asynchron.
// Im synchronen Fall befindet sich der Parser nach dem Aufruf im
@ -141,8 +125,6 @@ protected:
ScriptType GetScriptType( SvKeyValueIterator* ) const;
const String& GetScriptTypeString( SvKeyValueIterator* ) const;
static rtl_TextEncoding GetEncodingByMIME( const String& rMime );
BOOL SetEncodingByHTTPHeader( SvKeyValueIterator *pHTTPHeader );
};

View File

@ -37,7 +37,6 @@
#include <sfx2/docfile.hxx>
#include "openflag.hxx"
#include <comphelper/string.hxx>
#include <svtools/htmlkywd.hxx>
#include <svtools/htmltokn.h>
#include <svtools/imap.hxx>
@ -50,15 +49,13 @@
#include <svtools/svstdarr.hxx>
#endif
#include <svtools/zforlist.hxx>
#include <svtools/inettype.hxx>
#include <rtl/tencinfo.h>
#include <tools/tenccvt.hxx>
#include <sfx2/sfxhtml.hxx>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
using namespace ::com::sun::star;
@ -67,20 +64,6 @@ sal_Char __FAR_DATA sHTML_MIME_text[] = "text/";
sal_Char __FAR_DATA sHTML_MIME_application[] = "application/";
sal_Char __FAR_DATA sHTML_MIME_experimental[] = "x-";
#define HTML_META_NONE 0
#define HTML_META_AUTHOR 1
#define HTML_META_DESCRIPTION 2
#define HTML_META_KEYWORDS 3
#define HTML_META_REFRESH 4
#define HTML_META_CLASSIFICATION 5
#define HTML_META_CREATED 6
#define HTML_META_CHANGEDBY 7
#define HTML_META_CHANGED 8
#define HTML_META_GENERATOR 9
#define HTML_META_SDFOOTNOTE 10
#define HTML_META_SDENDNOTE 11
#define HTML_META_CONTENT_TYPE 12
// <INPUT TYPE=xxx>
#ifdef __MINGW32__ // for runtime pseudo reloc
static HTMLOptionEnum aAreaShapeOptEnums[] =
@ -97,28 +80,6 @@ static HTMLOptionEnum __READONLY_DATA aAreaShapeOptEnums[] =
{ 0, 0 }
};
// <META NAME=xxx>
#ifdef __MINGW32__ // for runtime pseudo reloc
static HTMLOptionEnum aHTMLMetaNameTable[] =
#else
static HTMLOptionEnum __READONLY_DATA aHTMLMetaNameTable[] =
#endif
{
{ OOO_STRING_SVTOOLS_HTML_META_author, HTML_META_AUTHOR },
{ OOO_STRING_SVTOOLS_HTML_META_changed, HTML_META_CHANGED },
{ OOO_STRING_SVTOOLS_HTML_META_changedby, HTML_META_CHANGEDBY },
{ OOO_STRING_SVTOOLS_HTML_META_classification,HTML_META_CLASSIFICATION},
{ OOO_STRING_SVTOOLS_HTML_META_content_type, HTML_META_CONTENT_TYPE },
{ OOO_STRING_SVTOOLS_HTML_META_created, HTML_META_CREATED },
{ OOO_STRING_SVTOOLS_HTML_META_description, HTML_META_DESCRIPTION },
{ OOO_STRING_SVTOOLS_HTML_META_keywords, HTML_META_KEYWORDS },
{ OOO_STRING_SVTOOLS_HTML_META_generator, HTML_META_GENERATOR },
{ OOO_STRING_SVTOOLS_HTML_META_refresh, HTML_META_REFRESH },
{ OOO_STRING_SVTOOLS_HTML_META_sdendnote, HTML_META_SDENDNOTE },
{ OOO_STRING_SVTOOLS_HTML_META_sdfootnote, HTML_META_SDFOOTNOTE },
{ 0, 0 }
};
SfxHTMLParser::SfxHTMLParser( SvStream& rStream, BOOL bIsNewDoc,
SfxMedium *pMed ) :
HTMLParser( rStream, bIsNewDoc ),
@ -288,169 +249,6 @@ IMAPOBJ_SETEVENT:
return bNewArea;
}
BOOL SfxHTMLParser::ParseMetaOptions(
const uno::Reference<document::XDocumentProperties> & i_xDocProps,
SvKeyValueIterator *pHTTPHeader,
const HTMLOptions *pOptions,
rtl_TextEncoding& rEnc )
{
String aName, aContent;
USHORT nAction = HTML_META_NONE;
BOOL bHTTPEquiv = FALSE, bChanged = FALSE;
for( USHORT i = pOptions->Count(); i; )
{
const HTMLOption *pOption = (*pOptions)[ --i ];
switch( pOption->GetToken() )
{
case HTML_O_NAME:
aName = pOption->GetString();
if( HTML_META_NONE==nAction )
pOption->GetEnum( nAction, aHTMLMetaNameTable );
break;
case HTML_O_HTTPEQUIV:
aName = pOption->GetString();
pOption->GetEnum( nAction, aHTMLMetaNameTable );
bHTTPEquiv = TRUE;
break;
case HTML_O_CONTENT:
aContent = pOption->GetString();
break;
}
}
if( bHTTPEquiv || HTML_META_DESCRIPTION!=nAction )
{
// wenn's keine Description ist CRs und LFs aus dem CONTENT entfernen
aContent.EraseAllChars( _CR );
aContent.EraseAllChars( _LF );
}
else
{
// fuer die Beschreibung die Zeilen-Umbrueche entsprechen wandeln
aContent.ConvertLineEnd();
}
if( bHTTPEquiv && pHTTPHeader )
{
// #57232#: Netscape scheint ein abschliessendes " einfach zu
// ignorieren, also tun wir das auch.
if( aContent.Len() && '"' == aContent.GetChar( aContent.Len()-1 ) )
aContent.Erase( aContent.Len() - 1 );
SvKeyValue aKeyValue( aName, aContent );
pHTTPHeader->Append( aKeyValue );
}
switch( nAction )
{
case HTML_META_AUTHOR:
if (i_xDocProps.is()) {
i_xDocProps->setAuthor( aContent );
bChanged = TRUE;
}
break;
case HTML_META_DESCRIPTION:
if (i_xDocProps.is()) {
i_xDocProps->setDescription( aContent );
bChanged = TRUE;
}
break;
case HTML_META_KEYWORDS:
if (i_xDocProps.is()) {
i_xDocProps->setKeywords(
::comphelper::string::convertCommaSeparated(aContent));
bChanged = TRUE;
}
break;
case HTML_META_CLASSIFICATION:
if (i_xDocProps.is()) {
i_xDocProps->setSubject( aContent );
bChanged = TRUE;
}
break;
case HTML_META_CHANGEDBY:
if (i_xDocProps.is()) {
i_xDocProps->setModifiedBy( aContent );
bChanged = TRUE;
}
break;
case HTML_META_CREATED:
case HTML_META_CHANGED:
if( i_xDocProps.is() && aContent.Len() && aContent.GetTokenCount()==2 )
{
Date aDate( (ULONG)aContent.GetToken(0).ToInt32() );
Time aTime( (ULONG)aContent.GetToken(1).ToInt32() );
DateTime aDateTime( aDate, aTime );
::util::DateTime uDT(aDateTime.Get100Sec(),
aDateTime.GetSec(), aDateTime.GetMin(),
aDateTime.GetHour(), aDateTime.GetDay(),
aDateTime.GetMonth(), aDateTime.GetYear());
if( HTML_META_CREATED==nAction )
i_xDocProps->setCreationDate( uDT );
else
i_xDocProps->setModificationDate( uDT );
bChanged = TRUE;
}
break;
case HTML_META_REFRESH:
DBG_ASSERT( !bHTTPEquiv || pHTTPHeader,
"Reload-URL aufgrund unterlsassener MUSS-Aenderung verlorengegangen" );
break;
case HTML_META_CONTENT_TYPE:
if( aContent.Len() )
rEnc = GetEncodingByMIME( aContent );
bChanged = TRUE;
break;
case HTML_META_NONE:
if( !bHTTPEquiv )
{
if (i_xDocProps.is()) {
uno::Reference<beans::XPropertyContainer> xUDProps
= i_xDocProps->getUserDefinedProperties();
try {
xUDProps->addProperty(aName,
beans::PropertyAttribute::REMOVEABLE,
uno::makeAny(::rtl::OUString(aContent)));
bChanged = TRUE;
} catch (uno::Exception &) {
// ignore
}
}
}
break;
}
return bChanged;
}
BOOL SfxHTMLParser::ParseMetaOptions(
const uno::Reference<document::XDocumentProperties> & i_xDocProps,
SvKeyValueIterator *pHeader )
{
USHORT nContentOption = HTML_O_CONTENT;
rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
BOOL bRet = ParseMetaOptions( i_xDocProps, pHeader,
GetOptions(&nContentOption),
eEnc );
// If the encoding is set by a META tag, it may only overwrite the
// current encoding if both, the current and the new encoding, are 1-BYTE
// encodings. Everything else cannot lead to reasonable results.
if( RTL_TEXTENCODING_DONTKNOW != eEnc &&
rtl_isOctetTextEncoding( eEnc ) &&
rtl_isOctetTextEncoding( GetSrcEncoding() ) )
SetSrcEncoding( eEnc );
return bRet;
}
void SfxHTMLParser::StartFileDownload( const String& rURL, int nToken,
SfxObjectShell *pSh )
@ -559,24 +357,6 @@ IMPL_STATIC_LINK( SfxHTMLParser, FileDownloadDone, void*, EMPTYARG )
return 0;
}
rtl_TextEncoding SfxHTMLParser::GetEncodingByMIME( const String& rMime )
{
ByteString sType;
ByteString sSubType;
INetContentTypeParameterList aParameters;
ByteString sMime( rMime, RTL_TEXTENCODING_ASCII_US );
if (INetContentTypes::parse(sMime, sType, sSubType, &aParameters))
{
const INetContentTypeParameter * pCharset
= aParameters.find("charset");
if (pCharset != 0)
{
ByteString sValue( pCharset->m_sValue, RTL_TEXTENCODING_ASCII_US );
return GetExtendedCompatibilityTextEncoding(rtl_getTextEncodingFromMimeCharset( sValue.GetBuffer() ) );
}
}
return RTL_TEXTENCODING_DONTKNOW;
}
rtl_TextEncoding SfxHTMLParser::GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader )
{
rtl_TextEncoding eRet = RTL_TEXTENCODING_DONTKNOW;

View File

@ -270,8 +270,6 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest
}
}
SfxBindings *pBindings = GetBindings();
// Alles holen, was gebraucht wird, da der Slot den Execute evtl. nicht
// "uberlebt, falls es ein 'Pseudoslot' f"ur Macros oder Verben ist
sal_Bool bAutoUpdate = rSlot.IsMode(SFX_SLOT_AUTOUPDATE);
@ -308,9 +306,17 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest
// falls 'this' noch lebt
if ( bThisDispatcherAlive )
pImp->pInCallAliveFlag = pOldInCallAliveFlag;
else if ( pOldInCallAliveFlag )
// auch verschachtelte Stack-Frames sch"utzen
*pOldInCallAliveFlag = sal_False;
else
{
if ( pOldInCallAliveFlag )
{
// auch verschachtelte Stack-Frames sch"utzen
*pOldInCallAliveFlag = sal_False;
}
// do nothing after this object is dead
return rReq.IsDone();
}
}
// TabPage-ID und Executing-SID zurueck setzen
@ -325,6 +331,8 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest
if ( rReq.IsDone() )
{
SfxBindings *pBindings = GetBindings();
// bei AutoUpdate sofort updaten; "Pseudoslots" d"urfen nicht
// Autoupdate sein!
if ( bAutoUpdate && pBindings )

View File

@ -71,6 +71,7 @@
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
#include <com/sun/star/ucb/OpenMode.hpp>
#include <com/sun/star/ucb/NameClashException.hpp>
#include <com/sun/star/logging/XSimpleLogRing.hpp>
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#ifndef _COM_SUN_STAR_SECURITY_DOCUMENTSIGNATURESINFORMATION_HPP_
@ -82,6 +83,7 @@
#include <tools/urlobj.hxx>
#include <unotools/tempfile.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
#include <unotools/streamhelper.hxx>
#include <unotools/localedatawrapper.hxx>
#ifndef _MSGBOX_HXX //autogen
@ -93,6 +95,7 @@
#include <svtools/sfxecode.hxx>
#include <svtools/itemset.hxx>
#include <svtools/intitem.hxx>
#include <svtools/svparser.hxx> // SvKeyValue
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/implbase1.hxx>
@ -149,12 +152,73 @@ using namespace ::com::sun::star::io;
#define MAX_REDIRECT 5
//==========================================================
namespace {
static const sal_Int8 LOCK_UI_NOLOCK = 0;
static const sal_Int8 LOCK_UI_SUCCEEDED = 1;
static const sal_Int8 LOCK_UI_TRY = 2;
static const sal_Int8 LOCK_UI_NOLOCK = 0;
static const sal_Int8 LOCK_UI_SUCCEEDED = 1;
static const sal_Int8 LOCK_UI_TRY = 2;
//----------------------------------------------------------------
sal_Bool IsSystemFileLockingUsed()
{
// check whether system file locking has been used, the default value is false
sal_Bool bUseSystemLock = sal_False;
try
{
uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
::comphelper::getProcessServiceFactory(),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
::comphelper::ConfigurationHelper::E_STANDARD );
if ( !xCommonConfig.is() )
throw uno::RuntimeException();
::comphelper::ConfigurationHelper::readRelativeKey(
xCommonConfig,
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseSystemLock;
}
catch( const uno::Exception& )
{
}
return bUseSystemLock;
}
//----------------------------------------------------------------
sal_Bool IsOOoLockFileUsed()
{
// check whether system file locking has been used, the default value is false
sal_Bool bOOoLockFileUsed = sal_False;
try
{
uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
::comphelper::getProcessServiceFactory(),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
::comphelper::ConfigurationHelper::E_STANDARD );
if ( !xCommonConfig.is() )
throw uno::RuntimeException();
::comphelper::ConfigurationHelper::readRelativeKey(
xCommonConfig,
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentOOoLockFile" ) ) ) >>= bOOoLockFileUsed;
}
catch( const uno::Exception& )
{
}
return bOOoLockFileUsed;
}
} // anonymous namespace
//==========================================================
//----------------------------------------------------------------
class SfxMediumHandler_Impl : public ::cppu::WeakImplHelper1< com::sun::star::task::XInteractionHandler >
{
com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInter;
@ -170,10 +234,12 @@ public:
~SfxMediumHandler_Impl();
};
//----------------------------------------------------------------
SfxMediumHandler_Impl::~SfxMediumHandler_Impl()
{
}
//----------------------------------------------------------------
void SAL_CALL SfxMediumHandler_Impl::handle( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest >& xRequest )
throw( com::sun::star::uno::RuntimeException )
{
@ -192,6 +258,7 @@ void SAL_CALL SfxMediumHandler_Impl::handle( const com::sun::star::uno::Referenc
m_xInter->handle( xRequest );
}
//----------------------------------------------------------------
class SfxPoolCancelManager_Impl : public SfxCancelManager ,
public SfxCancellable ,
public SfxListener ,
@ -208,6 +275,7 @@ public:
virtual void Cancel();
};
//----------------------------------------------------------------
SV_DECL_IMPL_REF( SfxPoolCancelManager_Impl )
@ -327,6 +395,8 @@ public:
util::DateTime m_aDateTime;
uno::Reference< logging::XSimpleLogRing > m_xLogRing;
SfxPoolCancelManager_Impl* GetCancelManager();
SfxMedium_Impl( SfxMedium* pAntiImplP );
@ -341,7 +411,7 @@ void SfxMedium::DataAvailable_Impl()
void SfxMedium::Cancel_Impl()
{
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
SfxPoolCancelManager_Impl* SfxMedium_Impl::GetCancelManager()
@ -448,6 +518,33 @@ sal_uInt32 SfxMedium::GetLastStorageCreationState()
return pImp->nLastStorageError;
}
//------------------------------------------------------------------
void SfxMedium::AddLog( const ::rtl::OUString& aMessage )
{
if ( !pImp->m_xLogRing.is() )
{
try
{
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
if ( aContext.is() )
pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW );
}
catch( uno::Exception& )
{}
}
if ( pImp->m_xLogRing.is() )
pImp->m_xLogRing->logString( aMessage );
}
//------------------------------------------------------------------
void SfxMedium::SetError( sal_uInt32 nError, const ::rtl::OUString& aLogMessage )
{
eError = nError;
if ( eError != ERRCODE_NONE && aLogMessage.getLength() )
AddLog( aLogMessage );
}
//------------------------------------------------------------------
sal_uInt32 SfxMedium::GetErrorCode() const
{
@ -479,28 +576,7 @@ void SfxMedium::CheckFileDate( const util::DateTime& aInitDate )
|| pImp->m_aDateTime.Month != aInitDate.Month
|| pImp->m_aDateTime.Year != aInitDate.Year )
{
// check whether system file locking has been used, the default value is false
sal_Bool bUseSystemLock = sal_False;
try
{
uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
::comphelper::getProcessServiceFactory(),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
::comphelper::ConfigurationHelper::E_STANDARD );
if ( !xCommonConfig.is() )
throw uno::RuntimeException();
::comphelper::ConfigurationHelper::readRelativeKey(
xCommonConfig,
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseSystemLock;
}
catch( const uno::Exception& )
{
}
if ( !bUseSystemLock )
if ( !IsSystemFileLockingUsed() )
{
uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
@ -520,7 +596,7 @@ void SfxMedium::CheckFileDate( const util::DateTime& aInitDate )
::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
{
SetError( ERRCODE_ABORT );
SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
catch ( uno::Exception& )
@ -946,7 +1022,7 @@ void SfxMedium::StorageBackup_Impl()
{
DoInternalBackup_Impl( aOriginalContent );
if( !pImp->m_aBackupURL.getLength() )
SetError( ERRCODE_SFX_CANTCREATEBACKUP );
SetError( ERRCODE_SFX_CANTCREATEBACKUP, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
@ -1021,7 +1097,7 @@ void SfxMedium::SetPasswordToStorage_Impl()
{
OSL_ENSURE( sal_False, "It must be possible to set a common password for the storage" );
// TODO/LATER: set the error code in case of problem
// SetError( ERRCODE_IO_GENERAL );
// SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
}
@ -1090,7 +1166,7 @@ sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< ::rtl::OUStri
::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
{
SetError( ERRCODE_ABORT );
SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
else if ( uno::Reference< task::XInteractionDisapprove >( xSelected.get(), uno::UNO_QUERY ).is() )
{
@ -1129,7 +1205,7 @@ sal_Int8 SfxMedium::ShowLockedDocumentDialog( const uno::Sequence< ::rtl::OUStri
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) );
}
else
SetError( ERRCODE_IO_ACCESSDENIED );
SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
@ -1184,24 +1260,7 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
sal_Int8 bUIStatus = LOCK_UI_NOLOCK;
// check whether system file locking has been used, the default value is false
sal_Bool bUseSystemLock = sal_False;
try
{
uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
::comphelper::getProcessServiceFactory(),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
::comphelper::ConfigurationHelper::E_STANDARD );
if ( !xCommonConfig.is() )
throw uno::RuntimeException();
::comphelper::ConfigurationHelper::readRelativeKey(
xCommonConfig,
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseSystemLock;
}
catch( const uno::Exception& )
{
}
sal_Bool bUseSystemLock = IsSystemFileLockingUsed();
// TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem
// if system lock is used the writeable stream should be available
@ -1220,35 +1279,55 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
}
catch ( ucb::InteractiveIOException& e )
{
if ( e.Code == IOErrorCode_INVALID_PARAMETER )
// exception means that the lock file can not be successfuly accessed
// in this case it should be ignored if system file locking is anyway active
if ( bUseSystemLock || !IsOOoLockFileUsed() )
{
// it looks like the lock file name is not accepted by the content
if ( !bUseSystemLock )
{
// system file locking is not active, ask user whether he wants to open the document without any locking
uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
if ( xHandler.is() )
{
::rtl::Reference< ::ucbhelper::InteractionRequest > xIgnoreRequestImpl
= new ::ucbhelper::InteractionRequest( uno::makeAny( document::LockFileIgnoreRequest() ) );
uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 );
aContinuations[0] = new ::ucbhelper::InteractionAbort( xIgnoreRequestImpl.get() );
aContinuations[1] = new ::ucbhelper::InteractionApprove( xIgnoreRequestImpl.get() );
xIgnoreRequestImpl->setContinuations( aContinuations );
xHandler->handle( xIgnoreRequestImpl.get() );
::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xIgnoreRequestImpl->getSelection();
bResult = ( uno::Reference< task::XInteractionApprove >( xSelected.get(), uno::UNO_QUERY ).is() );
}
}
else
bResult = sal_True;
bResult = sal_True;
// take the ownership over the lock file
aLockFile.OverwriteOwnLockFile();
}
else
throw;
else if ( e.Code == IOErrorCode_INVALID_PARAMETER )
{
// system file locking is not active, ask user whether he wants to open the document without any locking
uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
if ( xHandler.is() )
{
::rtl::Reference< ::ucbhelper::InteractionRequest > xIgnoreRequestImpl
= new ::ucbhelper::InteractionRequest( uno::makeAny( document::LockFileIgnoreRequest() ) );
uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 );
aContinuations[0] = new ::ucbhelper::InteractionAbort( xIgnoreRequestImpl.get() );
aContinuations[1] = new ::ucbhelper::InteractionApprove( xIgnoreRequestImpl.get() );
xIgnoreRequestImpl->setContinuations( aContinuations );
xHandler->handle( xIgnoreRequestImpl.get() );
::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xIgnoreRequestImpl->getSelection();
bResult = ( uno::Reference< task::XInteractionApprove >( xSelected.get(), uno::UNO_QUERY ).is() );
}
}
}
catch ( uno::Exception& )
{
// exception means that the lock file can not be successfuly accessed
// in this case it should be ignored if system file locking is anyway active
if ( bUseSystemLock || !IsOOoLockFileUsed() )
{
bResult = sal_True;
// take the ownership over the lock file
aLockFile.OverwriteOwnLockFile();
}
}
// in case OOo locking is turned off the lock file is still written if possible
// but it is ignored while deciding whether the document should be opened for editing or not
if ( !bResult && !IsOOoLockFileUsed() )
{
bResult = sal_True;
// take the ownership over the lock file
aLockFile.OverwriteOwnLockFile();
}
}
@ -1316,7 +1395,7 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, FALSE );
if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) )
SetError( ERRCODE_IO_ACCESSDENIED );
SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
else
GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) );
}
@ -1816,13 +1895,13 @@ sal_Bool SfxMedium::StorageCommit_Impl()
}
if ( !GetError() )
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
catch ( uno::Exception& )
{
//TODO/LATER: improve error handling
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
}
@ -2102,7 +2181,7 @@ void SfxMedium::Transfer_Impl()
else
{
DBG_ERROR( "Illegal Output stream parameter!\n" );
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
// free the reference
@ -2147,7 +2226,7 @@ void SfxMedium::Transfer_Impl()
{
//TODO/MBA: error handling
//if ( !GetError() )
// SetError( xStor->GetError() );
// SetError( xStor->GetError(, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )) );
}
return;
}
@ -2192,7 +2271,7 @@ void SfxMedium::Transfer_Impl()
SetStorage_Impl( xStor );
}
else if ( !GetError() )
SetError( xStor->GetError() );
SetError( xStor->GetError(, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )) );
return;
}*/
}
@ -2573,7 +2652,7 @@ void SfxMedium::GetMedium_Impl()
//TODO/MBA: ErrorHandling - how to transport error from MediaDescriptor
if ( !GetError() && !pImp->xStream.is() && !pImp->xInputStream.is() )
SetError( ERRCODE_IO_ACCESSDENIED );
SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if ( !GetError() )
{
@ -3696,17 +3775,17 @@ void SfxMedium::TryToSwitchToRepairedTemp()
catch ( uno::Exception& )
{
//TODO/MBA: error handling
//SetError( aNewStorage->GetError() );
//SetError( aNewStorage->GetError(, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )) );
}
}
else
SetError( ERRCODE_IO_CANTWRITE );
SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if (pImp->pTempFile != pTmpFile)
delete pTmpFile;
}
else
SetError( ERRCODE_IO_CANTREAD );
SetError( ERRCODE_IO_CANTREAD, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
@ -3756,7 +3835,7 @@ void SfxMedium::CreateTempFile()
aName = pImp->pTempFile->GetFileName();
if ( !aName.Len() )
{
SetError( ERRCODE_IO_CANTWRITE );
SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return;
}
@ -3800,7 +3879,7 @@ void SfxMedium::CreateTempFileNoCopy()
aName = pImp->pTempFile->GetFileName();
if ( !aName.Len() )
{
SetError( ERRCODE_IO_CANTWRITE );
SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return;
}
@ -4005,61 +4084,6 @@ sal_Bool SfxMedium::EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OU
return bResult;
}
SV_DECL_PTRARR_DEL(SvKeyValueList_Impl, SvKeyValue*, 0, 4)
SV_IMPL_PTRARR(SvKeyValueList_Impl, SvKeyValue*);
/*
* SvKeyValueIterator.
*/
SvKeyValueIterator::SvKeyValueIterator (void)
: m_pList (new SvKeyValueList_Impl),
m_nPos (0)
{
}
/*
* ~SvKeyValueIterator.
*/
SvKeyValueIterator::~SvKeyValueIterator (void)
{
delete m_pList;
}
/*
* GetFirst.
*/
BOOL SvKeyValueIterator::GetFirst (SvKeyValue &rKeyVal)
{
m_nPos = m_pList->Count();
return GetNext (rKeyVal);
}
/*
* GetNext.
*/
BOOL SvKeyValueIterator::GetNext (SvKeyValue &rKeyVal)
{
if (m_nPos > 0)
{
rKeyVal = *m_pList->GetObject(--m_nPos);
return TRUE;
}
else
{
// Nothing to do.
return FALSE;
}
}
/*
* Append.
*/
void SvKeyValueIterator::Append (const SvKeyValue &rKeyVal)
{
SvKeyValue *pKeyVal = new SvKeyValue (rKeyVal);
m_pList->C40_INSERT(SvKeyValue, pKeyVal, m_pList->Count());
}
BOOL SfxMedium::HasStorage_Impl() const
{
return pImp->xStorage.is();

View File

@ -1220,10 +1220,14 @@ void SfxDocTplService_Impl::doUpdate()
// the last directory in the list must be writable
sal_Bool bWriteableDirectory = sal_True;
// the target folder might not exist, for this reason no interaction handler should be used
uno::Reference< XCommandEnvironment > aQuietEnv;
while ( nCountDir )
{
nCountDir--;
if ( Content::create( pDirs[ nCountDir ], maCmdEnv, aDirContent ) )
if ( Content::create( pDirs[ nCountDir ], aQuietEnv, aDirContent ) )
{
createFromContent( aGroupList, aDirContent, sal_False, bWriteableDirectory );
}
@ -2535,7 +2539,10 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList,
try
{
aContent = Content( rOwnURL, maCmdEnv );
// this method is only used during checking of the available template-folders
// that should happen quietly
uno::Reference< XCommandEnvironment > aQuietEnv;
aContent = Content( rOwnURL, aQuietEnv );
ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
xResultSet = aContent.createCursor( aProps, eInclude );
}

View File

@ -38,6 +38,7 @@
#include <svtools/eitem.hxx>
#include <svtools/stritem.hxx>
#include <svtools/intitem.hxx>
#include <svtools/svparser.hxx> // SvKeyValue
#include <vos/mutex.hxx>
#include <cppuhelper/exc_hlp.hxx>
@ -64,6 +65,7 @@
#include <com/sun/star/embed/XEmbedPersist.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/script/provider/XScript.hpp>
@ -113,6 +115,7 @@ using namespace ::com::sun::star::container;
#include <svtools/inettype.hxx>
#include <svtools/sharecontrolfile.hxx>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
#include <vcl/svapp.hxx>
#include <framework/interaction.hxx>
#include <comphelper/storagehelper.hxx>
@ -256,10 +259,15 @@ void SfxObjectShell::FlushDocInfo()
//-------------------------------------------------------------------------
void SfxObjectShell::SetError(sal_uInt32 lErr)
void SfxObjectShell::SetError( sal_uInt32 lErr, const ::rtl::OUString& aLogMessage )
{
if(pImp->lErr==ERRCODE_NONE)
{
pImp->lErr=lErr;
if( lErr != ERRCODE_NONE && aLogMessage.getLength() )
AddLog( aLogMessage );
}
}
//-------------------------------------------------------------------------
@ -285,6 +293,9 @@ sal_uInt32 SfxObjectShell::GetErrorCode() const
void SfxObjectShell::ResetError()
{
if( pImp->lErr != ERRCODE_NONE )
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Resetting Error." ) ) );
pImp->lErr=0;
SfxMedium * pMed = GetMedium();
if( pMed )
@ -669,7 +680,7 @@ void SfxObjectShell::DisconnectFromShared()
SfxMedium* pTmpMedium = pMedium;
ForgetMedium();
if( !DoSaveCompleted( pTmpMedium ) )
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
else
{
// the medium should not dispose the storage, DoSaveCompleted() has let it to do so
@ -1444,7 +1455,7 @@ void SfxObjectShell::TemplateDisconnectionAfterLoad()
ForgetMedium();
if( !DoSaveCompleted( pTmpMedium ) )
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
else
{
SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False );
@ -2330,3 +2341,89 @@ void SfxObjectShell_Impl::showBrokenSignatureWarning( const uno::Reference< task
const_cast< SfxObjectShell_Impl* >( this )->bSignatureErrorIsShown = sal_True;
}
}
void SfxObjectShell::AddLog( const ::rtl::OUString& aMessage )
{
if ( !pImp->m_xLogRing.is() )
{
try
{
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
if ( aContext.is() )
pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW );
}
catch( uno::Exception& )
{}
}
if ( pImp->m_xLogRing.is() )
pImp->m_xLogRing->logString( aMessage );
}
namespace {
void WriteStringInStream( const uno::Reference< io::XOutputStream >& xOutStream, const ::rtl::OUString& aString )
{
if ( xOutStream.is() )
{
::rtl::OString aStrLog = ::rtl::OUStringToOString( aString, RTL_TEXTENCODING_UTF8 );
uno::Sequence< sal_Int8 > aLogData( (const sal_Int8*)aStrLog.getStr(), aStrLog.getLength() );
xOutStream->writeBytes( aLogData );
aLogData.realloc( 1 );
aLogData[0] = '\n';
xOutStream->writeBytes( aLogData );
}
}
}
void SfxObjectShell::StoreLog()
{
if ( !pImp->m_xLogRing.is() )
{
try
{
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
if ( aContext.is() )
pImp->m_xLogRing.set( aContext.getSingleton( "com.sun.star.logging.DocumentIOLogRing" ), UNO_QUERY_THROW );
}
catch( uno::Exception& )
{}
}
if ( pImp->m_xLogRing.is() )
{
::rtl::OUString aFileURL =
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}" ) );
::rtl::Bootstrap::expandMacros( aFileURL );
::rtl::OUString aBuildID =
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/setup.ini:buildid}" ) );
::rtl::Bootstrap::expandMacros( aBuildID );
if ( aFileURL.getLength() )
{
aFileURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/temp/document_io_logring.txt" ) );
try
{
uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess( xFactory->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
uno::Reference< io::XStream > xStream( xSimpleFileAccess->openFileReadWrite( aFileURL ), uno::UNO_SET_THROW );
uno::Reference< io::XOutputStream > xOutStream( xStream->getOutputStream(), uno::UNO_SET_THROW );
uno::Reference< io::XTruncate > xTruncate( xOutStream, uno::UNO_QUERY_THROW );
xTruncate->truncate();
if ( aBuildID.getLength() )
WriteStringInStream( xOutStream, aBuildID );
uno::Sequence< ::rtl::OUString > aLogSeq = pImp->m_xLogRing->getCollectedLog();
for ( sal_Int32 nInd = 0; nInd < aLogSeq.getLength(); nInd++ )
WriteStringInStream( xOutStream, aLogSeq[nInd] );
}
catch( uno::Exception& )
{}
}
}
}

View File

@ -639,11 +639,20 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
SfxStoringHelper aHelper( xEmptyFactory );
if ( QueryHiddenInformation( bIsPDFExport ? WhenCreatingPDF : WhenSaving, NULL ) == RET_YES )
{
bDialogUsed = aHelper.GUIStoreModel( GetModel(),
::rtl::OUString::createFromAscii( pSlot->GetUnoName() ),
aDispatchArgs,
bPreselectPassword,
GetSharedFileURL() );
::rtl::OUString::createFromAscii( pSlot->GetUnoName() ),
aDispatchArgs,
bPreselectPassword,
GetSharedFileURL() );
}
else
{
// the user has decided not to store the document
throw task::ErrorCodeIOException( ::rtl::OUString(),
uno::Reference< uno::XInterface >(),
ERRCODE_IO_ABORT );
}
// the scripting signature might be preserved
// pImp->nScriptingSignatureState = SIGNATURESTATE_NOSIGNATURES;

View File

@ -282,7 +282,7 @@ sal_Bool SfxObjectShell::PutURLContentsToVersionStream_Impl(
catch( uno::Exception& )
{
// TODO/LATER: handle the error depending on exception
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
return bResult;
@ -314,7 +314,7 @@ sal_Bool SfxObjectShell::PutURLContentsToVersionStream_Impl(
aTempURL = ::rtl::OUString();
// TODO/LATER: may need error code setting based on exception
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
@ -356,7 +356,7 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto
}
catch( uno::Exception& )
{
const_cast<SfxObjectShell*>( this )->SetError( ERRCODE_IO_GENERAL );
const_cast<SfxObjectShell*>( this )->SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
::rtl::OUString aVersion;
@ -412,7 +412,7 @@ sal_Bool SfxObjectShell::GeneralInit_Impl( const uno::Reference< embed::XStorage
{
if ( bTypeMustBeSetAlready )
{
SetError( ERRCODE_IO_BROKENPACKAGE );
SetError( ERRCODE_IO_BROKENPACKAGE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return sal_False;
}
@ -632,7 +632,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
{
sal_uInt32 nError = HandleFilter( pMedium, this );
if ( nError != ERRCODE_NONE )
SetError( nError );
SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
EnableSetModified( sal_False );
@ -666,12 +666,12 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
}
if ( bWarnMediaTypeFallback || !xStorage->getElementNames().getLength() )
SetError( ERRCODE_IO_BROKENPACKAGE );
SetError( ERRCODE_IO_BROKENPACKAGE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
catch( uno::Exception& )
{
// TODO/LATER: may need error code setting based on exception
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
// Load
@ -691,11 +691,11 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
SetReadOnlyUI();
}
else
SetError( ERRCODE_ABORT );
SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
else
SetError( pMed->GetLastStorageCreationState() );
SetError( pMed->GetLastStorageCreationState(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
else if ( GetError() == ERRCODE_NONE && InitNew(0) )
{
@ -1049,7 +1049,7 @@ sal_Bool SfxObjectShell::DoSave()
}
catch( uno::Exception& )
{
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
DBG_ASSERT( bOk, "The root storage must allow to set common password!\n" );
@ -1089,7 +1089,7 @@ sal_Bool SfxObjectShell::DoSave()
}
catch( uno::Exception& )
{
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
bOk = sal_False;
}
}
@ -1140,6 +1140,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
{
RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mv76033) SfxObjectShell::SaveTo_Impl" );
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Begin" ) ) );
ModifyBlocker_Impl aMod(this);
const SfxFilter *pFilter = rMedium.GetFilter();
@ -1161,7 +1163,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// protected libraries exceed the size we can handler
if ( bOwnTarget && !QuerySaveSizeExceededModules_Impl( rMedium.GetInteractionHandler() ) )
{
SetError( ERRCODE_IO_ABORT );
SetError( ERRCODE_IO_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return sal_False;
}
@ -1178,6 +1180,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
|| pImp->nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
|| pImp->nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_INVALID ) )
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "MacroSignaturePreserving" ) ) );
// the checking of the library modified state iterates over the libraries, should be done only when required
bTryToPreservScriptSignature = !pImp->pBasicManager->isAnyContainerModified();
if ( bTryToPreservScriptSignature )
@ -1221,13 +1225,14 @@ sal_Bool SfxObjectShell::SaveTo_Impl
&& SfxMedium::EqualURLs( pMedium->GetName(), rMedium.GetName() ) )
{
bStoreToSameLocation = sal_True;
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save" ) ) );
rMedium.CheckFileDate( pMedium->GetInitFileDate() );
if ( bCopyTo && GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
{
// export to the same location is vorbidden
SetError( ERRCODE_IO_CANTWRITE );
SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
else
{
@ -1236,10 +1241,11 @@ sal_Bool SfxObjectShell::SaveTo_Impl
const sal_Bool bDoBackup = SvtSaveOptions().IsBackup();
if ( bDoBackup )
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "DoBackup" ) ) );
rMedium.DoBackup_Impl();
if ( rMedium.GetError() )
{
SetError( rMedium.GetErrorCode() );
SetError( rMedium.GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
rMedium.ResetError();
}
}
@ -1262,6 +1268,9 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// commit the wrapper stream ( the stream will connect the URL only on commit, after that it will hold it )
// if the last step is failed the stream should stay to be transacted and should be commited on any flush
// so we can forget the stream in any way and the next storage commit will flush it
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save: Own to Own" ) ) );
bNeedsDisconnectionOnFail = DisconnectStorage_Impl(
*pMedium, rMedium );
if ( bNeedsDisconnectionOnFail
@ -1282,6 +1291,9 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// the source and the target formats are alien
// just disconnect the stream from the source format
// so that the target medium can use it
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save: Alien to Alien" ) ) );
pMedium->CloseAndRelease();
rMedium.CloseAndRelease();
rMedium.CreateTempFileNoCopy();
@ -1292,6 +1304,9 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// the source format is an alien one but the target
// format is an own one so just disconnect the source
// medium
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save: Alien to Own" ) ) );
pMedium->CloseAndRelease();
rMedium.CloseAndRelease();
rMedium.GetOutputStorage();
@ -1301,6 +1316,9 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// the source format is an own one but the target is
// an alien format, just connect the source to temporary
// storage
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save: Own to Alien" ) ) );
bNeedsDisconnectionOnFail = DisconnectStorage_Impl(
*pMedium, rMedium );
if ( bNeedsDisconnectionOnFail
@ -1320,6 +1338,9 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// the alien filters still might write directly to the file, that is of course a bug,
// but for now the framework has to be ready for it
// TODO/LATER: let the medium be prepared for alien formats as well
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "SaveAs/Export" ) ) );
rMedium.CloseAndRelease();
if ( bStorageBasedTarget )
{
@ -1331,6 +1352,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if( rMedium.GetErrorCode() || pMedium->GetErrorCode() || GetErrorCode() )
return sal_False;
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Locking" ) ) );
rMedium.LockOrigFileOnDemand( sal_False, sal_False );
if ( bStorageBasedTarget )
@ -1384,12 +1407,14 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if( bOwnTarget && !( pFilter->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) )
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing in own format." ) ) );
uno::Reference< embed::XStorage > xMedStorage = rMedium.GetStorage();
if ( !xMedStorage.is() )
{
// no saving without storage, unlock UI and return
Lock_Impl( this, sal_False );
pImp->bForbidReload = bOldStat;
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing failed, still no error set." ) ) );
return sal_False;
}
@ -1406,7 +1431,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
catch( uno::Exception& )
{
DBG_ERROR( "Setting of common encryption key failed!" );
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
else
@ -1425,15 +1450,18 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( xMedStorage == GetStorage() )
{
OSL_ENSURE( !pVersionItem, "This scenario is impossible currently!\n" );
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Should be impossible." ) ) );
// usual save procedure
bOk = Save();
}
else
{
// save to target
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save as own format." ) ) );
bOk = SaveAsOwnFormat( rMedium );
if ( bOk && pVersionItem )
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "pVersionItem != NULL" ) ) );
aTmpVersionURL = CreateTempCopyOfStorage_Impl( xMedStorage );
bOk = ( aTmpVersionURL.getLength() > 0 );
}
@ -1444,7 +1472,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( bOk && GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
{
// store the thumbnail representation image
// TODO: handle the case when document is encrypted and/or signed
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Thumbnail creation." ) ) );
if ( !GenerateAndStoreThumbnail( bPasswdProvided,
sal_False,
pFilter->IsOwnTemplateFormat(),
@ -1459,6 +1487,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
{
if ( pImp->bIsSaving || pImp->bPreserveVersions )
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Preserve versions." ) ) );
try
{
Sequence < util::RevisionTag > aVersions = rMedium.GetVersionList();
@ -1488,6 +1517,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
}
catch( uno::Exception& )
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Preserve versions has failed." ) ) );
DBG_ERROR( "Couldn't copy versions!\n" );
bOk = sal_False;
// TODO/LATER: a specific error could be set
@ -1540,6 +1570,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
}
else
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing in alien format." ) ) );
// it's a "SaveAs" in an alien format
if ( rMedium.GetFilter() && ( rMedium.GetFilter()->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) )
bOk = ExportTo( rMedium );
@ -1617,6 +1648,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( bOk )
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Medium commit." ) ) );
// transfer data to its destinated location
// the medium commits the storage or the stream it is based on
RegisterTransfer( rMedium );
@ -1624,6 +1657,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( bOk && bScriptSignatureIsCopied )
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Script signature check." ) ) );
// if the script signature was copied it should be checked now
// usually it should be ok, so no additional actions will be done
// but if for any reasong ( f.e. binshell change ) it is broken it should be removed here
@ -1671,6 +1706,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
if ( bOk )
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing is successful." ) ) );
// if the target medium is an alien format and the "old" medium was an own format and the "old" medium
// has a name, the object storage must be exchanged, because now we need a new temporary storage
// as object storage
@ -1689,12 +1726,17 @@ sal_Bool SfxObjectShell::SaveTo_Impl
OSL_ENSURE( pMedium->GetName().Len(), "Fallback is used, the medium without name should not dispose the storage!\n" );
// copy storage of old medium to new temporary storage and take this over
if( !ConnectTmpStorage_Impl( pMedium->GetStorage(), pMedium ) )
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Process after storing has failed." ) ) );
bOk = sal_False;
}
}
}
}
else
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing has failed." ) ) );
// in case the document storage was connected to backup temporarely it must be disconnected now
if ( bNeedsDisconnectionOnFail )
ConnectTmpStorage_Impl( pImp->m_xDocStorage, NULL );
@ -1848,7 +1890,7 @@ sal_Bool SfxObjectShell::ConnectTmpStorage_Impl(
if ( !bResult )
{
// TODO/LATER: may need error code setting based on exception
SetError( ERRCODE_IO_GENERAL );
SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
}
@ -1904,7 +1946,7 @@ sal_Bool SfxObjectShell::DoSaveAs( SfxMedium& rMedium )
{
// hier kommen nur Root-Storages rein, die via Temp-File gespeichert werden
rMedium.CreateTempFileNoCopy();
SetError(rMedium.GetErrorCode());
SetError(rMedium.GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if ( GetError() )
return sal_False;
@ -1914,7 +1956,7 @@ sal_Bool SfxObjectShell::DoSaveAs( SfxMedium& rMedium )
sal_Bool bRet = SaveTo_Impl( rMedium, NULL );
if ( !bRet )
SetError(rMedium.GetErrorCode());
SetError(rMedium.GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return bRet;
}
@ -2478,7 +2520,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
// pMediumTmp->CreateTempFileNoCopy();
if ( pMediumTmp->GetErrorCode() != ERRCODE_NONE )
{
SetError( pMediumTmp->GetError() );
SetError( pMediumTmp->GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
delete pMediumTmp;
return sal_False;
}
@ -2487,7 +2529,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
pMediumTmp->TransferVersionList_Impl( *pRetrMedium );
/*
if ( pFilter && ( pFilter->GetFilterFlags() & SFX_FILTER_PACKED ) )
SetError( GetMedium()->Unpack_Impl( pRetrMedium->GetPhysicalName() ) );
SetError( GetMedium()->Unpack_Impl( pRetrMedium->GetPhysicalName() ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
*/
// an interaction handler here can aquire only in case of GUI Saving
@ -2508,7 +2550,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
pMediumTmp->GetItemSet()->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL );
}
SetError(pMediumTmp->GetErrorCode());
SetError(pMediumTmp->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
//REMOVE if ( !IsHandsOff() )
//REMOVE pMediumTmp->Close();
@ -2520,7 +2562,7 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
else
{
// transfer error code from medium to objectshell
SetError( pMediumTmp->GetError() );
SetError( pMediumTmp->GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
// reconnect to object storage
//REMOVE if ( IsHandsOff() )
@ -2550,7 +2592,7 @@ sal_Bool SfxObjectShell::Save_Impl( const SfxItemSet* pSet )
{
if ( IsReadOnly() )
{
SetError( ERRCODE_SFX_DOCUMENTREADONLY );
SetError( ERRCODE_SFX_DOCUMENTREADONLY, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return sal_False;
}
@ -2596,7 +2638,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl
{
if( aURL.HasError() )
{
SetError( ERRCODE_IO_INVALIDPARAMETER );
SetError( ERRCODE_IO_INVALIDPARAMETER, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return sal_False;
}
@ -2618,7 +2660,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl
if ( pDoc )
{
// dann Fehlermeldeung: "schon offen"
SetError(ERRCODE_SFX_ALREADYOPEN);
SetError(ERRCODE_SFX_ALREADYOPEN, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
return sal_False;
}
}
@ -2634,7 +2676,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl
|| !pFilter->CanExport()
|| (!bSaveTo && !pFilter->CanImport()) )
{
SetError( ERRCODE_IO_INVALIDPARAMETER );
SetError( ERRCODE_IO_INVALIDPARAMETER, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return sal_False;
}
@ -2656,7 +2698,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl
if ( aURL == aActName && aURL != INetURLObject( OUString::createFromAscii( "private:stream" ) )
&& IsReadOnly() )
{
SetError(ERRCODE_SFX_DOCUMENTREADONLY);
SetError(ERRCODE_SFX_DOCUMENTREADONLY, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
return sal_False;
}
@ -2793,7 +2835,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
if ( pNewFile->GetErrorCode() != ERRCODE_NONE )
{
// creating temporary file failed ( f.e. floppy disk not inserted! )
SetError( pNewFile->GetError() );
SetError( pNewFile->GetError(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
delete pNewFile;
return sal_False;
}
@ -2813,7 +2855,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
if ( GetMedium()->GetFilter() && ( GetMedium()->GetFilter()->GetFilterFlags() & SFX_FILTER_PACKED ) )
{
SfxMedium *pMed = bCopyTo ? pMedium : pNewFile;
pNewFile->SetError( GetMedium()->Unpack_Impl( pMed->GetPhysicalName() ) );
pNewFile->SetError( GetMedium()->Unpack_Impl( pMed->GetPhysicalName() ) , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
*/
// Save the document ( first as temporary file, then transfer to the target URL by committing the medium )
@ -2823,7 +2865,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
bOk = sal_True;
// transfer a possible error from the medium to the document
SetError( pNewFile->GetErrorCode() );
SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
// notify the document that saving was done successfully
//REMOVE if ( bCopyTo )
@ -2854,7 +2896,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
// and the DoSaveCompleted call should not be able to fail in general
DBG_ASSERT( !bCopyTo, "Error while reconnecting to medium, can't be handled!");
SetError( pNewFile->GetErrorCode() );
SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
if ( !bCopyTo )
{
@ -2888,7 +2930,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
}
else
{
SetError( pNewFile->GetErrorCode() );
SetError( pNewFile->GetErrorCode(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
//REMOVE // reconnect to the old storage
//REMOVE if ( IsHandsOff() )

View File

@ -168,7 +168,7 @@ throw( uno::RuntimeException )
// we must destroy the plugin before the parent is destroyed
xWindow->addEventListener( this );
xFrame->setComponent( xWindow, uno::Reference < frame::XController >() );
return TRUE;
return mxPlugin.is() ? TRUE : FALSE;
}
return FALSE;

View File

@ -1485,6 +1485,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
if ( m_pData->m_pObjectShell.Is() )
{
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "storeSelf" ) ) );
SfxSaveGuard aSaveGuard(this, m_pData, sal_False);
for ( sal_Int32 nInd = 0; nInd < aSeqArgs.getLength(); nInd++ )
@ -1495,6 +1496,9 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
&& !aSeqArgs[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ) )
&& !aSeqArgs[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator" ) ) ) )
{
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "unexpected parameter for storeSelf, might be no problem if SaveAs is executed." ) ) );
m_pData->m_pObjectShell->StoreLog();
::rtl::OUString aMessage( RTL_CONSTASCII_USTRINGPARAM( "Unexpected MediaDescriptor parameter: " ) );
aMessage += aSeqArgs[nInd].Name;
throw lang::IllegalArgumentException( aMessage, uno::Reference< uno::XInterface >(), 1 );
@ -1539,12 +1543,17 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
if ( bRet )
{
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "successful saving." ) ) );
m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl();
SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCDONE, m_pData->m_pObjectShell ) );
}
else
{
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing failed!" ) ) );
m_pData->m_pObjectShell->StoreLog();
// write the contents of the logger to the file
SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, m_pData->m_pObjectShell ) );
throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), nErrCode );
@ -1579,6 +1588,7 @@ void SAL_CALL SfxBaseModel::storeAsURL( const ::rtl::OUString&
if ( m_pData->m_pObjectShell.Is() )
{
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "storeAsURL" ) ) );
SfxSaveGuard aSaveGuard(this, m_pData, sal_False);
impl_store( rURL, rArgs, sal_False );
@ -1604,6 +1614,7 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString&
if ( m_pData->m_pObjectShell.Is() )
{
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "storeToURL" ) ) );
SfxSaveGuard aSaveGuard(this, m_pData, sal_False);
impl_store( rURL, rArgs, sal_True );
}
@ -2468,6 +2479,10 @@ void SfxBaseModel::changing()
if ( impl_isDisposed() )
return;
// the notification should not be sent if the document can not be modified
if ( !m_pData->m_pObjectShell.Is() || !m_pData->m_pObjectShell->IsEnableSetModified() )
return;
::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0) );
if( pIC )
@ -2589,19 +2604,48 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
aArgHash.erase( aFilterString );
aArgHash.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) );
try
// if the password is changed SaveAs should be done
// no password for encrypted document is also a change here
sal_Bool bPassChanged = sal_False;
::comphelper::SequenceAsHashMap::iterator aNewPassIter
= aArgHash.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) ) );
SFX_ITEMSET_ARG( pMedium->GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False );
if ( pPasswordItem && aNewPassIter != aArgHash.end() )
{
storeSelf( aArgHash.getAsConstPropertyValueList() );
bSaved = sal_True;
::rtl::OUString aNewPass;
aNewPassIter->second >>= aNewPass;
bPassChanged = !aNewPass.equals( pPasswordItem->GetValue() );
}
catch( const lang::IllegalArgumentException& )
else if ( pPasswordItem || aNewPassIter != aArgHash.end() )
bPassChanged = sal_True;
if ( !bPassChanged )
{
// some additional arguments do not allow to use saving, SaveAs should be done
// but only for normal documents, the shared documents would be overwritten in this case
// that would mean an information loss
// TODO/LATER: need a new interaction for this case
if ( m_pData->m_pObjectShell->IsDocShared() )
throw;
try
{
storeSelf( aArgHash.getAsConstPropertyValueList() );
bSaved = sal_True;
}
catch( const lang::IllegalArgumentException& )
{
// some additional arguments do not allow to use saving, SaveAs should be done
// but only for normal documents, the shared documents would be overwritten in this case
// that would mean an information loss
// TODO/LATER: need a new interaction for this case
if ( m_pData->m_pObjectShell->IsDocShared() )
{
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't store shared document!" ) ) );
m_pData->m_pObjectShell->StoreLog();
throw;
}
}
}
else if ( m_pData->m_pObjectShell->IsDocShared() )
{
// if the password is changed a special error should be used in case of shared document
throw task::ErrorCodeIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cant change password for shared document." ) ), uno::Reference< uno::XInterface >(), ERRCODE_SFX_SHARED_NOPASSWORDCHANGE );
}
}
}
@ -2623,9 +2667,14 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
SFX_ITEMSET_ARG( aParams, pCopyStreamItem, SfxBoolItem, SID_COPY_STREAM_IF_POSSIBLE, sal_False );
if ( pCopyStreamItem && pCopyStreamItem->GetValue() && !bSaveTo )
{
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Misuse of CopyStreamIfPossible!" ) ) );
m_pData->m_pObjectShell->StoreLog();
throw frame::IllegalArgumentIOException(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CopyStreamIfPossible parameter is not acceptable for storeAsURL() call!") ),
uno::Reference< uno::XInterface >() );
}
// since saving a document modifies its DocumentInfo, the current
// DocumentInfo must be saved on "SaveTo", so it can be restored
@ -2679,7 +2728,10 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
sal_uInt32 nErrCode = m_pData->m_pObjectShell->GetErrorCode();
if ( !bRet && !nErrCode )
{
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing has failed, no error is set!" ) ) );
nErrCode = ERRCODE_IO_CANTWRITE;
}
m_pData->m_pObjectShell->ResetError();
if ( bRet )
@ -2708,6 +2760,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
}
}
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing succeeded!" ) ) );
if ( !bSaveTo )
{
m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl();
@ -2720,6 +2773,10 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
}
else
{
// let the logring be stored to the related file
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing failed!" ) ) );
m_pData->m_pObjectShell->StoreLog();
SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED,
m_pData->m_pObjectShell ) );

View File

@ -33,6 +33,7 @@
//#include <hash_map>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/logging/XSimpleLogRing.hpp>
#include <tools/datetime.hxx>
#include <svtools/securityoptions.hxx>
@ -168,6 +169,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
::rtl::OUString m_aSharedFileURL;
::com::sun::star::uno::Reference< ::com::sun::star::logging::XSimpleLogRing > m_xLogRing;
SfxObjectShell_Impl( SfxObjectShell& _rDocShell );
virtual ~SfxObjectShell_Impl();

View File

@ -157,6 +157,8 @@ public:
virtual void NbcSetLogicRect(const Rectangle& rRect);
virtual void SetGeoData(const SdrObjGeoData& rGeo);
static sal_Bool CanUnloadRunningObj( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj,
sal_Int64 nAspect );
static sal_Bool Unload( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
BOOL Unload();
void Connect();

View File

@ -146,10 +146,13 @@ void OLEObjCache::UnloadOnDemand()
{
try
{
sal_Bool bUnload = sal_True;
// it is important to get object without reinitialization to avoid reentrance
uno::Reference< embed::XEmbeddedObject > xUnloadObj = pUnloadObj->GetObjRef_NoInit();
if ( xUnloadObj.is() )
sal_Bool bUnload = SdrOle2Obj::CanUnloadRunningObj( xUnloadObj, pUnloadObj->GetAspect() );
// check whether the object can be unloaded before looking for the parent objects
if ( xUnloadObj.is() && bUnload )
{
uno::Reference< frame::XModel > xUnloadModel( xUnloadObj->getComponent(), uno::UNO_QUERY );
if ( xUnloadModel.is() )
@ -193,11 +196,18 @@ void OLEObjCache::InsertObj(SdrOle2Obj* pObj)
return;
}
// get the old position of the object to know whether it is already in container
ULONG nOldPos = GetPos( pObj );
// insert object into first position
Remove(pObj);
Remove( nOldPos );
Insert(pObj, (ULONG) 0L);
UnloadOnDemand();
if ( nOldPos == CONTAINER_ENTRY_NOTFOUND )
{
// a new object was inserted, recalculate the cache
UnloadOnDemand();
}
}
void OLEObjCache::RemoveObj(SdrOle2Obj* pObj)

View File

@ -1916,40 +1916,60 @@ void SdrOle2Obj::NbcMove(const Size& rSize)
// -----------------------------------------------------------------------------
sal_Bool SdrOle2Obj::Unload( const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect )
sal_Bool SdrOle2Obj::CanUnloadRunningObj( const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect )
{
sal_Bool bResult = sal_False;
sal_Int32 nState = xObj->getCurrentState();
if ( nState == embed::EmbedStates::LOADED )
{
// the object is already unloaded
bResult = sal_True;
}
else
{
sal_Int64 nMiscStatus = xObj->getStatus( nAspect );
uno::Reference < util::XModifiable > xModifiable( xObj->getComponent(), uno::UNO_QUERY );
if ( embed::EmbedMisc::MS_EMBED_ALWAYSRUN != ( nMiscStatus & embed::EmbedMisc::MS_EMBED_ALWAYSRUN ) &&
embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY != ( nMiscStatus & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) &&
!( xModifiable.is() && xModifiable->isModified() ) &&
!( nState == embed::EmbedStates::INPLACE_ACTIVE || nState == embed::EmbedStates::UI_ACTIVE || nState == embed::EmbedStates::ACTIVE ) )
if ( !xModifiable.is() )
bResult = sal_True;
else
{
try
sal_Int64 nMiscStatus = xObj->getStatus( nAspect );
if ( embed::EmbedMisc::MS_EMBED_ALWAYSRUN != ( nMiscStatus & embed::EmbedMisc::MS_EMBED_ALWAYSRUN ) &&
embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY != ( nMiscStatus & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) &&
!( xModifiable.is() && xModifiable->isModified() ) &&
!( nState == embed::EmbedStates::INPLACE_ACTIVE || nState == embed::EmbedStates::UI_ACTIVE || nState == embed::EmbedStates::ACTIVE ) )
{
xObj->changeState( embed::EmbedStates::LOADED );
bResult = sal_True;
}
catch( ::com::sun::star::uno::Exception& e )
{
(void)e;
DBG_ERROR(
(OString("SdrOle2Obj::Unload=(), "
"exception caught: ") +
rtl::OUStringToOString(
comphelper::anyToString( cppu::getCaughtException() ),
RTL_TEXTENCODING_UTF8 )).getStr() );
}
}
}
return bResult;
}
// -----------------------------------------------------------------------------
sal_Bool SdrOle2Obj::Unload( const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect )
{
sal_Bool bResult = sal_False;
if ( CanUnloadRunningObj( xObj, nAspect ) )
{
try
{
xObj->changeState( embed::EmbedStates::LOADED );
bResult = sal_True;
}
catch( ::com::sun::star::uno::Exception& e )
{
(void)e;
DBG_ERROR(
(OString("SdrOle2Obj::Unload=(), "
"exception caught: ") +
rtl::OUStringToOString(
comphelper::anyToString( cppu::getCaughtException() ),
RTL_TEXTENCODING_UTF8 )).getStr() );
}
}

View File

@ -607,7 +607,7 @@ BaseContent::addProperty(
{
if( ( m_nState & JustInserted ) || ( m_nState & Deleted ) || Name == rtl::OUString() )
{
throw lang::IllegalArgumentException();
throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
}
m_pMyShell->associate( m_aUncPath,Name,DefaultValue,Attributes );
@ -623,7 +623,7 @@ BaseContent::removeProperty(
{
if( m_nState & Deleted )
throw beans::UnknownPropertyException();
throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
m_pMyShell->deassociate( m_aUncPath, Name );
}
@ -792,7 +792,7 @@ BaseContent::setParent(
throw( lang::NoSupportException,
RuntimeException)
{
throw lang::NoSupportException();
throw lang::NoSupportException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@ -973,12 +973,12 @@ BaseContent::setPropertyValues(
rtl::OUString NewTitle;
if( !( Values[i].Value >>= NewTitle ) )
{
ret[i] <<= beans::IllegalTypeException();
ret[i] <<= beans::IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
break;
}
else if( ! NewTitle.getLength() )
{
ret[i] <<= lang::IllegalArgumentException();
ret[i] <<= lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
break;
}

View File

@ -100,7 +100,7 @@ XCommandInfo_impl::getCommandInfoByName(
if( m_pMyShell->m_sCommandInfo[i].Name == aName )
return m_pMyShell->m_sCommandInfo[i];
throw UnsupportedCommandException();
throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@ -114,7 +114,7 @@ XCommandInfo_impl::getCommandInfoByHandle(
if( m_pMyShell->m_sCommandInfo[i].Handle == Handle )
return m_pMyShell->m_sCommandInfo[i];
throw UnsupportedCommandException();
throw UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}

View File

@ -66,6 +66,7 @@
using namespace ucbhelper;
using namespace osl;
using namespace ::com::sun::star;
using namespace com::sun::star::task;
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
@ -277,7 +278,7 @@ namespace fileaccess {
if( errorCode == TASKHANDLER_UNSUPPORTED_COMMAND )
{
aAny <<= UnsupportedCommandException();
aAny <<= UnsupportedCommandException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
cancelCommandExecution( aAny,xEnv );
}
else if( errorCode == TASKHANDLING_WRONG_SETPROPERTYVALUES_ARGUMENT ||

View File

@ -153,7 +153,7 @@ XInputStream_impl::readBytes(
io::IOException,
uno::RuntimeException)
{
if( ! m_nIsOpen ) throw io::IOException();
if( ! m_nIsOpen ) throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
aData.realloc(nBytesToRead);
//TODO! translate memory exhaustion (if it were detectable...) into
@ -162,7 +162,7 @@ XInputStream_impl::readBytes(
sal_uInt64 nrc(0);
if(m_aFile.read( aData.getArray(),sal_uInt64(nBytesToRead),nrc )
!= osl::FileBase::E_None)
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
// Shrink aData in case we read less than nBytesToRead (XInputStream
// documentation does not tell whether this is required, and I do not know
@ -219,7 +219,7 @@ XInputStream_impl::closeInput(
{
osl::FileBase::RC err = m_aFile.close();
if( err != osl::FileBase::E_None )
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
m_nIsOpen = false;
}
}
@ -233,9 +233,9 @@ XInputStream_impl::seek(
uno::RuntimeException )
{
if( location < 0 )
throw lang::IllegalArgumentException();
throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
if( osl::FileBase::E_None != m_aFile.setPos( Pos_Absolut, sal_uInt64( location ) ) )
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@ -247,7 +247,7 @@ XInputStream_impl::getPosition(
{
sal_uInt64 uPos;
if( osl::FileBase::E_None != m_aFile.getPos( uPos ) )
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
return sal_Int64( uPos );
}
@ -259,7 +259,7 @@ XInputStream_impl::getLength(
{
sal_uInt64 uEndPos;
if ( m_aFile.getSize(uEndPos) != osl::FileBase::E_None )
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
else
return sal_Int64( uEndPos );
}

View File

@ -129,7 +129,7 @@ XPropertySetInfo_impl::getPropertyByName(
for( sal_Int32 i = 0; i < m_seq.getLength(); ++i )
if( m_seq[i].Name == aName ) return m_seq[i];
throw beans::UnknownPropertyException();
throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}

View File

@ -153,7 +153,7 @@ XRow_impl::getString(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
rtl::OUString Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<rtl::OUString>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -167,7 +167,7 @@ XRow_impl::getBoolean(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
sal_Bool Value( false );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<sal_Bool>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -182,7 +182,7 @@ XRow_impl::getByte(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
sal_Int8 Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<sal_Int8>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -196,7 +196,7 @@ XRow_impl::getShort(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
sal_Int16 Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<sal_Int16>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -211,7 +211,7 @@ XRow_impl::getInt(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
sal_Int32 Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<sal_Int32>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -225,7 +225,7 @@ XRow_impl::getLong(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
sal_Int64 Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<sal_Int64>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -239,7 +239,7 @@ XRow_impl::getFloat(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
float Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<float>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -253,7 +253,7 @@ XRow_impl::getDouble(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
double Value( 0 );
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<double>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -267,7 +267,7 @@ XRow_impl::getBytes(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Sequence< sal_Int8 > Value(0);
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Sequence< sal_Int8 > >( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -281,7 +281,7 @@ XRow_impl::getDate(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
util::Date Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<util::Date>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -295,7 +295,7 @@ XRow_impl::getTime(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
util::Time Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<util::Time>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -309,7 +309,7 @@ XRow_impl::getTimestamp(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
util::DateTime Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<util::DateTime>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -324,7 +324,7 @@ XRow_impl::getBinaryStream(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< io::XInputStream > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Reference< io::XInputStream > >( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -339,7 +339,7 @@ XRow_impl::getCharacterStream(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< io::XInputStream > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert< uno::Reference< io::XInputStream> >( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -355,7 +355,7 @@ XRow_impl::getObject(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Any Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Any>( m_pMyShell,m_xTypeConverter,m_aValueMap[ --columnIndex ],Value );
@ -369,7 +369,7 @@ XRow_impl::getRef(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< sdbc::XRef > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Reference< sdbc::XRef> >( m_pMyShell,
@ -386,7 +386,7 @@ XRow_impl::getBlob(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< sdbc::XBlob > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Reference< sdbc::XBlob> >( m_pMyShell,
@ -403,7 +403,7 @@ XRow_impl::getClob(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< sdbc::XClob > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Reference< sdbc::XClob> >( m_pMyShell,
@ -421,7 +421,7 @@ XRow_impl::getArray(
uno::RuntimeException)
{
if( columnIndex < 1 || columnIndex > m_aValueMap.getLength() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
uno::Reference< sdbc::XArray > Value;
osl::MutexGuard aGuard( m_aMutex );
m_nWasNull = ::convert<uno::Reference< sdbc::XArray> >( m_pMyShell,

View File

@ -355,7 +355,7 @@ XResultSet_impl::OneMore(
}
else // error fetching anything
{
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
}
}
}
@ -513,7 +513,7 @@ XResultSet_impl::relative(
uno::RuntimeException)
{
if( isAfterLast() || isBeforeFirst() )
throw sdbc::SQLException();
throw sdbc::SQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), ::rtl::OUString(), 0, uno::Any() );
if( row > 0 )
while( row-- ) next();
else if( row < 0 )
@ -665,7 +665,7 @@ XResultSet_impl::getStaticResultSet()
osl::MutexGuard aGuard( m_aMutex );
if ( m_xListener.is() )
throw ucb::ListenerAlreadySetException();
throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
return uno::Reference< sdbc::XResultSet >( this );
}
@ -681,7 +681,7 @@ XResultSet_impl::setListener(
osl::ClearableMutexGuard aGuard( m_aMutex );
if ( m_xListener.is() )
throw ucb::ListenerAlreadySetException();
throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
m_xListener = Listener;
@ -724,9 +724,9 @@ XResultSet_impl::connectToCache(
= m_pMyShell->m_xMultiServiceFactory;
if( m_xListener.is() )
throw ucb::ListenerAlreadySetException();
throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
if( m_bStatic )
throw ucb::ListenerAlreadySetException();
throw ucb::ListenerAlreadySetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
uno::Reference< ucb::XSourceInitialization > xTarget(
xCache, uno::UNO_QUERY );
@ -753,7 +753,7 @@ XResultSet_impl::connectToCache(
return;
}
}
throw ucb::ServiceNotFoundException();
throw ucb::ServiceNotFoundException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
//=========================================================================
@ -838,7 +838,7 @@ void SAL_CALL XResultSet_impl::setPropertyValue(
if( aPropertyName == rtl::OUString::createFromAscii( "IsRowCountFinal" ) ||
aPropertyName == rtl::OUString::createFromAscii( "RowCount" ) )
return;
throw beans::UnknownPropertyException();
throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@ -862,7 +862,7 @@ uno::Any SAL_CALL XResultSet_impl::getPropertyValue(
return aAny;
}
else
throw beans::UnknownPropertyException();
throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@ -891,7 +891,7 @@ void SAL_CALL XResultSet_impl::addPropertyChangeListener(
m_pRowCountListeners->addInterface( xListener );
}
else
throw beans::UnknownPropertyException();
throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@ -916,7 +916,7 @@ void SAL_CALL XResultSet_impl::removePropertyChangeListener(
m_pRowCountListeners->removeInterface( aListener );
}
else
throw beans::UnknownPropertyException();
throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
void SAL_CALL XResultSet_impl::addVetoableChangeListener(

View File

@ -189,10 +189,10 @@ void SAL_CALL XStream_impl::truncate(void)
throw( io::IOException, uno::RuntimeException )
{
if (osl::FileBase::E_None != m_aFile.setSize(0))
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
if (osl::FileBase::E_None != m_aFile.setPos(Pos_Absolut,sal_uInt64(0)))
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@ -211,7 +211,7 @@ XStream_impl::readBytes(
uno::RuntimeException)
{
if( ! m_nIsOpen )
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
sal_Int8 * buffer;
try
@ -221,7 +221,7 @@ XStream_impl::readBytes(
catch( std::bad_alloc )
{
if( m_nIsOpen ) m_aFile.close();
throw io::BufferSizeExceededException();
throw io::BufferSizeExceededException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
sal_uInt64 nrc(0);
@ -229,7 +229,7 @@ XStream_impl::readBytes(
!= osl::FileBase::E_None)
{
delete[] buffer;
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
aData = uno::Sequence< sal_Int8 > ( buffer, (sal_uInt32)nrc );
delete[] buffer;
@ -287,7 +287,7 @@ XStream_impl::writeBytes( const uno::Sequence< sal_Int8 >& aData )
const sal_Int8* p = aData.getConstArray();
if(osl::FileBase::E_None != m_aFile.write(((void*)(p)),sal_uInt64(length),nWrittenBytes) ||
nWrittenBytes != length )
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
}
@ -352,9 +352,9 @@ XStream_impl::seek(
uno::RuntimeException )
{
if( location < 0 )
throw lang::IllegalArgumentException();
throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
if( osl::FileBase::E_None != m_aFile.setPos( Pos_Absolut, sal_uInt64( location ) ) )
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@ -366,7 +366,7 @@ XStream_impl::getPosition(
{
sal_uInt64 uPos;
if( osl::FileBase::E_None != m_aFile.getPos( uPos ) )
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
return sal_Int64( uPos );
}
@ -378,7 +378,7 @@ XStream_impl::getLength(
{
sal_uInt64 uEndPos;
if ( m_aFile.getSize(uEndPos) != osl::FileBase::E_None )
throw io::IOException();
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
else
return sal_Int64( uEndPos );
}

View File

@ -70,7 +70,7 @@ TaskManager::startTask(
TaskMap::iterator it = m_aTaskMap.find( CommandId );
if( it != m_aTaskMap.end() )
{
throw DuplicateCommandIdentifierException();
throw DuplicateCommandIdentifierException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
m_aTaskMap[ CommandId ] = TaskHandling( xCommandEnv );
}

View File

@ -343,7 +343,7 @@ FileProvider::queryContent(
aUnc );
if( err )
throw IllegalIdentifierException();
throw IllegalIdentifierException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
return Reference< XContent >( new BaseContent( m_pMyShell,xIdentifier,aUnc ) );
}
@ -534,7 +534,7 @@ XPropertySetInfoImpl2::getPropertyByName(
if( m_seq[i].Name == aName )
return m_seq[i];
throw UnknownPropertyException();
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@ -616,7 +616,7 @@ FileProvider::setPropertyValue( const rtl::OUString& aPropertyName,
aPropertyName.compareToAscii( "HostName" ) == 0 )
return;
else
throw UnknownPropertyException();
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@ -648,7 +648,7 @@ FileProvider::getPropertyValue(
return aAny;
}
else
throw UnknownPropertyException();
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}

View File

@ -494,7 +494,7 @@ shell::associate( const rtl::OUString& aUnqPath,
shell::PropertySet::iterator it1 = m_aDefaultProperties.find( newProperty );
if( it1 != m_aDefaultProperties.end() )
throw beans::PropertyExistException();
throw beans::PropertyExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
{
osl::MutexGuard aGuard( m_aMutex );
@ -507,7 +507,7 @@ shell::associate( const rtl::OUString& aUnqPath,
PropertySet& properties = *(it->second.properties);
it1 = properties.find( newProperty );
if( it1 != properties.end() )
throw beans::PropertyExistException();
throw beans::PropertyExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
// Property does not exist
properties.insert( newProperty );
@ -530,7 +530,7 @@ shell::deassociate( const rtl::OUString& aUnqPath,
shell::PropertySet::iterator it1 = m_aDefaultProperties.find( oldProperty );
if( it1 != m_aDefaultProperties.end() )
throw beans::NotRemoveableException();
throw beans::NotRemoveableException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
osl::MutexGuard aGuard( m_aMutex );
@ -542,7 +542,7 @@ shell::deassociate( const rtl::OUString& aUnqPath,
it1 = properties.find( oldProperty );
if( it1 == properties.end() )
throw beans::UnknownPropertyException();
throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
properties.erase( it1 );
@ -838,7 +838,7 @@ shell::setv( const rtl::OUString& aUnqPath,
it1 = properties.find( toset );
if( it1 == properties.end() )
{
ret[i] <<= beans::UnknownPropertyException();
ret[i] <<= beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
continue;
}
@ -848,7 +848,7 @@ shell::setv( const rtl::OUString& aUnqPath,
if( it1->getAttributes() & beans::PropertyAttribute::READONLY )
{
ret[i] <<= lang::IllegalAccessException();
ret[i] <<= lang::IllegalAccessException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
continue;
}
@ -919,7 +919,7 @@ shell::setv( const rtl::OUString& aUnqPath,
}
}
else
ret[i] <<= beans::IllegalTypeException();
ret[i] <<= beans::IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
else if(values[i].Name == IsReadOnly ||
values[i].Name == IsHidden)
@ -1027,7 +1027,7 @@ shell::setv( const rtl::OUString& aUnqPath,
}
}
else
ret[i] <<= beans::IllegalTypeException();
ret[i] <<= beans::IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
}
} // end for

View File

@ -66,6 +66,7 @@ ModalDialog DLG_UUI_PASSWORD
{
Pos = MAP_APPFONT( 27, 56 );
Size = MAP_APPFONT( 37, 15 );
DefButton = TRUE ;
};
CancelButton BTN_PASSWORD_CANCEL