summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNiklas Nebel <nn@openoffice.org>2009-11-16 14:43:11 +0100
committerNiklas Nebel <nn@openoffice.org>2009-11-16 14:43:11 +0100
commit34f777379bac631ef96502ab88a950861a5154b9 (patch)
tree8b3da0279ee89594d64659ae4f6d9ad0a51697ed /sfx2
parentd2e7f677c5be667944bb2d873ada261dbefd5309 (diff)
parentcc423d4be4338cbd81eed9f96f7c7a277da0ee88 (diff)
validityref: merge with DEV300_m64
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/guisaveas.hxx4
-rw-r--r--sfx2/inc/pch/precompiled_sfx2.hxx3
-rw-r--r--sfx2/inc/sfx2/dinfdlg.hxx6
-rw-r--r--sfx2/inc/sfx2/docfile.hxx25
-rw-r--r--sfx2/inc/sfx2/docfilt.hxx14
-rw-r--r--sfx2/inc/sfx2/docmacromode.hxx24
-rw-r--r--sfx2/inc/sfx2/event.hxx37
-rw-r--r--sfx2/inc/sfx2/evntconf.hxx31
-rw-r--r--sfx2/inc/sfx2/objsh.hxx17
-rw-r--r--sfx2/inc/sfx2/sfx.hrc3
-rw-r--r--sfx2/inc/sfx2/sfxbasemodel.hxx2
-rw-r--r--sfx2/inc/sfx2/sfxsids.hrc6
-rw-r--r--sfx2/inc/sfx2/signaturestate.hxx9
-rw-r--r--sfx2/inc/sfx2/viewsh.hxx6
-rw-r--r--sfx2/sdi/appslots.sdi8
-rw-r--r--sfx2/sdi/makefile.mk3
-rw-r--r--sfx2/sdi/sfx.sdi129
-rw-r--r--sfx2/sdi/sfxslots.sdi1
-rw-r--r--sfx2/source/appl/app.cxx4
-rw-r--r--sfx2/source/appl/app.hrc16
-rw-r--r--sfx2/source/appl/app.src71
-rw-r--r--sfx2/source/appl/appcfg.cxx33
-rw-r--r--sfx2/source/appl/appdata.cxx1
-rw-r--r--sfx2/source/appl/appinit.cxx33
-rw-r--r--sfx2/source/appl/appopen.cxx4
-rw-r--r--sfx2/source/appl/appserv.cxx17
-rw-r--r--sfx2/source/appl/appuno.cxx6
-rw-r--r--sfx2/source/appl/sfxpicklist.cxx4
-rw-r--r--sfx2/source/bastyp/helper.cxx33
-rw-r--r--sfx2/source/bastyp/progress.cxx14
-rw-r--r--sfx2/source/config/evntconf.cxx418
-rw-r--r--sfx2/source/control/bindings.cxx515
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx28
-rw-r--r--sfx2/source/dialog/dockwin.cxx3
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx66
-rw-r--r--sfx2/source/doc/docfile.cxx979
-rw-r--r--sfx2/source/doc/docfilt.cxx14
-rw-r--r--sfx2/source/doc/docmacromode.cxx197
-rw-r--r--sfx2/source/doc/doctemplates.cxx10
-rw-r--r--sfx2/source/doc/graphhelp.cxx27
-rw-r--r--sfx2/source/doc/guisaveas.cxx23
-rw-r--r--sfx2/source/doc/makefile.mk5
-rw-r--r--sfx2/source/doc/objcont.cxx48
-rw-r--r--sfx2/source/doc/objembed.cxx2
-rw-r--r--sfx2/source/doc/objmisc.cxx147
-rw-r--r--sfx2/source/doc/objserv.cxx141
-rw-r--r--sfx2/source/doc/objstor.cxx215
-rw-r--r--sfx2/source/doc/objxtor.cxx103
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx46
-rw-r--r--sfx2/source/doc/sfxbasemodel.src94
-rw-r--r--sfx2/source/inc/eventsupplier.hxx3
-rw-r--r--sfx2/source/inc/helper.hxx1
-rw-r--r--sfx2/source/inc/objshimp.hxx13
-rw-r--r--sfx2/source/notify/eventsupplier.cxx26
-rw-r--r--sfx2/source/view/frame.cxx2
-rw-r--r--sfx2/source/view/frmload.cxx139
-rw-r--r--sfx2/source/view/prnmon.cxx2
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx4
-rw-r--r--sfx2/source/view/topfrm.cxx5
-rw-r--r--sfx2/source/view/viewfrm.cxx30
-rw-r--r--sfx2/source/view/viewimp.hxx27
-rw-r--r--sfx2/source/view/viewprn.cxx51
-rw-r--r--sfx2/source/view/viewsh.cxx127
-rw-r--r--sfx2/util/makefile.mk2
64 files changed, 1431 insertions, 2646 deletions
diff --git a/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx
index 772c3f7c5304..f8b19e1d5754 100644
--- a/sfx2/inc/guisaveas.hxx
+++ b/sfx2/inc/guisaveas.hxx
@@ -41,6 +41,7 @@
#include <com/sun/star/frame/XModuleManager.hpp>
#include <comphelper/sequenceashashmap.hxx>
+#include <sfx2/signaturestate.hxx>
namespace com { namespace sun { namespace star {
@@ -78,7 +79,8 @@ public:
const ::rtl::OUString& aSlotName,
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgsSequence,
sal_Bool bPreselectPassword,
- ::rtl::OUString aUserSelectedName );
+ ::rtl::OUString aUserSelectedName,
+ sal_uInt16 nDocumentSignatureState = SIGNATURESTATE_NOSIGNATURES );
static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SearchForFilter(
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery >& xFilterQuery,
diff --git a/sfx2/inc/pch/precompiled_sfx2.hxx b/sfx2/inc/pch/precompiled_sfx2.hxx
index ad70b76f27ff..b1f81aa620d2 100644
--- a/sfx2/inc/pch/precompiled_sfx2.hxx
+++ b/sfx2/inc/pch/precompiled_sfx2.hxx
@@ -484,8 +484,6 @@
#include "sal/config.h"
#include "sal/types.h"
#include "setup_native/qswin32.h"
-#include "shell/systemshell.hxx"
-#include "sj2/sjapplet.hxx"
#include "sot/clsids.hxx"
#include "sot/exchange.hxx"
#include "sot/factory.hxx"
@@ -542,7 +540,6 @@
#include "svtools/lckbitem.hxx"
#include "svtools/localisationoptions.hxx"
#include "svtools/localresaccess.hxx"
-#include "svtools/loginerr.hxx"
#include "svtools/lstner.hxx"
#include "svtools/memberid.hrc"
#include "svtools/menuoptions.hxx"
diff --git a/sfx2/inc/sfx2/dinfdlg.hxx b/sfx2/inc/sfx2/dinfdlg.hxx
index 1873c6e6c88e..27da2810d49e 100644
--- a/sfx2/inc/sfx2/dinfdlg.hxx
+++ b/sfx2/inc/sfx2/dinfdlg.hxx
@@ -417,12 +417,14 @@ private:
ImageButton m_aRemoveButton;
sal_Int32 m_nLineHeight;
+ sal_Int32 m_nScrollPos;
SvtSysLocale m_aSysLocale;
std::vector< CustomPropertyLine* > m_aCustomPropertiesLines;
CustomPropertyLine* m_pCurrentLine;
SvNumberFormatter m_aNumberFormatter;
Timer m_aEditLoseFocusTimer;
Timer m_aBoxLoseFocusTimer;
+ Link m_aRemovedHdl;
DECL_LINK( TypeHdl, CustomPropertiesTypeBox* );
DECL_LINK( RemoveHdl, CustomPropertiesRemoveButton* );
@@ -449,6 +451,7 @@ public:
bool DoesCustomPropertyExist( const String& rName ) const;
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
GetCustomProperties() const;
+ void SetRemovedHdl( const Link& rLink ) { m_aRemovedHdl = rLink; }
};
// class CustomPropertiesControl -----------------------------------------
@@ -466,12 +469,13 @@ private:
void Initialize();
DECL_LINK( ScrollHdl, ScrollBar* );
+ DECL_LINK( RemovedHdl, void* );
public:
CustomPropertiesControl( Window* pParent, const ResId& rResId );
~CustomPropertiesControl();
- void AddLine( const ::rtl::OUString& sName, com::sun::star::uno::Any& rAny );
+ void AddLine( const ::rtl::OUString& sName, com::sun::star::uno::Any& rAny, bool bInteractive );
inline bool AreAllLinesValid() const { return m_aPropertiesWin.AreAllLinesValid(); }
inline void ClearAllLines() { m_aPropertiesWin.ClearAllLines(); }
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index bebcdc684d89..e8ae3f5d1d85 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -199,8 +199,6 @@ public:
void SetDataAvailableLink( const Link& rLink );
Link GetDataAvailableLink( ) const;
- void SetClassFilter( const SvGlobalName & rFilterClass );
-
sal_uInt32 GetMIMEAndRedirect( String& );
sal_uInt32 GetErrorCode() const;
sal_uInt32 GetError() const
@@ -227,17 +225,14 @@ public:
SvEaMgr* GetEaMgr();
sal_Bool Commit();
- sal_Bool TryStorage();
- SAL_DLLPRIVATE ErrCode Unpack_Impl( const String& );
sal_Bool IsStorage();
sal_Int8 ShowLockedDocumentDialog( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aData, sal_Bool bIsLoading, sal_Bool bOwnLock );
sal_Bool LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI );
void UnlockFile();
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage();
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage( sal_Bool bCreateTempIfNo = sal_True );
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetOutputStorage();
- const SvGlobalName& GetClassFilter();
void ResetError();
sal_Bool UsesCache() const;
void SetUsesCache( sal_Bool );
@@ -253,9 +248,8 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetInputStream();
- void CreateTempFile();
+ void CreateTempFile( sal_Bool bReplace = sal_True );
void CreateTempFileNoCopy();
- void TryToSwitchToRepairedTemp();
::rtl::OUString SwitchDocumentToTempFile();
sal_Bool SwitchDocumentToFile( ::rtl::OUString aURL );
@@ -264,24 +258,19 @@ public:
::rtl::OUString GetBaseURL( bool bForSaving=false );
#if _SOLAR__PRIVATE
-//REMOVE // the storage will be truncated, if it is still not open then the stream will be truncated
-//REMOVE ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetOutputStorage_Impl();
- SAL_DLLPRIVATE ::rtl::OUString GetOutputStorageURL_Impl();
SAL_DLLPRIVATE BOOL HasStorage_Impl() const;
- SAL_DLLPRIVATE sal_Bool BasedOnOriginalFile_Impl();
SAL_DLLPRIVATE void StorageBackup_Impl();
SAL_DLLPRIVATE ::rtl::OUString GetBackup_Impl();
- SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetLastCommitReadStorage_Impl();
- SAL_DLLPRIVATE void CloseReadStorage_Impl();
+ SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetZipStorageToSign_Impl( sal_Bool bReadOnly = sal_True );
+ SAL_DLLPRIVATE void CloseZipStorage_Impl();
// the storage that will be returned by the medium on GetStorage request
SAL_DLLPRIVATE void SetStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xNewStorage );
SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetInputStream_Impl();
SAL_DLLPRIVATE void CloseAndReleaseStreams_Impl();
-//REMOVE SvStorage* GetStorage_Impl( BOOL bUCBStorage );
SAL_DLLPRIVATE void RefreshName_Impl();
SAL_DLLPRIVATE sal_uInt16 AddVersion_Impl( com::sun::star::util::RevisionTag& rVersion );
SAL_DLLPRIVATE sal_Bool TransferVersionList_Impl( SfxMedium& rMedium );
@@ -320,7 +309,6 @@ public:
SAL_DLLPRIVATE void DataAvailable_Impl();
SAL_DLLPRIVATE void Cancel_Impl();
SAL_DLLPRIVATE void SetPhysicalName_Impl(const String& rName);
- SAL_DLLPRIVATE void MoveTempTo_Impl( SfxMedium* pMedium );
SAL_DLLPRIVATE void CanDisposeStorage_Impl( sal_Bool bDisposeStorage );
SAL_DLLPRIVATE sal_Bool WillDisposeStorageOnClose_Impl();
@@ -340,7 +328,7 @@ public:
const INetURLObject& aDest,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xComEnv );
- SAL_DLLPRIVATE sal_Bool SignContents_Impl( sal_Bool bScriptingContent );
+ SAL_DLLPRIVATE sal_Bool SignContents_Impl( sal_Bool bScriptingContent, const ::rtl::OUString& aODFVersion, sal_Bool bHasValidDocumentSignature );
// the following two methods must be used and make sence only during saving currently
// TODO/LATER: in future the signature state should be controlled by the medium not by the document
@@ -353,6 +341,9 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
static sal_Bool EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL );
static ::rtl::OUString CreateTempCopyWithExt( const ::rtl::OUString& aURL );
+ static sal_Bool CallApproveHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler, ::com::sun::star::uno::Any aRequest, sal_Bool bAllowAbort );
+
+ static sal_Bool SetWritableForUserOnly( const ::rtl::OUString& aURL );
};
SV_DECL_IMPL_REF( SfxMedium )
diff --git a/sfx2/inc/sfx2/docfilt.hxx b/sfx2/inc/sfx2/docfilt.hxx
index dbeba0763c67..47c1cba003e5 100644
--- a/sfx2/inc/sfx2/docfilt.hxx
+++ b/sfx2/inc/sfx2/docfilt.hxx
@@ -75,6 +75,20 @@
#include <sfx2/sfxdefs.hxx>
//========================================================================
+
+namespace sfx2 {
+
+/** Returns true if the passed string is the name of a Microsoft Office file
+ format filter supporting export of password protected documents.
+
+ This function is just a hack for #i105076# is fixed and needs to be removed
+ then.
+ */
+SFX2_DLLPUBLIC bool CheckMSPasswordCapabilityForExport( const String& rFilterName );
+
+} // namespace sfx2
+
+//========================================================================
class SfxFilterContainer;
class SotStorage;
class SFX2_DLLPUBLIC SfxFilter
diff --git a/sfx2/inc/sfx2/docmacromode.hxx b/sfx2/inc/sfx2/docmacromode.hxx
index 4f0f1d2f9d9b..79d0cb016104 100644
--- a/sfx2/inc/sfx2/docmacromode.hxx
+++ b/sfx2/inc/sfx2/docmacromode.hxx
@@ -114,10 +114,11 @@ namespace sfx2
virtual ::rtl::OUString
getDocumentLocation() const = 0;
- /** returns the storage to which the document has last been committed to, for read-only
- access
+ /** returns a zip-storage based on the last commited version of the document,
+ for readonly access
- An implementation is allowed to return <NULL/> here if and only if the document
+ The storage is intended to be used for signing. An implementation is
+ allowed to return <NULL/> here if and only if the document
does not support signing the script storages.
@todo
@@ -126,7 +127,7 @@ namespace sfx2
XStorageBasedDocument.
*/
virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
- getLastCommitDocumentStorage() = 0;
+ getZipStorageToSign() = 0;
/** checks whether the document's storage contains sub storages with macros or scripts
@@ -161,7 +162,20 @@ namespace sfx2
@seealso <sfx2/signaturestate.hxx>
*/
virtual sal_Int16
- getScriptingSignatureState() const = 0;
+ getScriptingSignatureState() = 0;
+
+ /** allows to detect whether there is a trusted scripting signature
+
+ Note: On the medium run, the signature handling of a document should be outsourced
+ into a dedicated class, instead of being hard-wired into the SfxObjectShell. This
+ class could then be used outside the SfxObjectShell (e.g. in Base documents), too.
+ When this happens, this method here should be replaced by a method at this
+ new class.
+
+ @seealso <sfx2/signaturestate.hxx>
+ */
+ virtual sal_Bool
+ hasTrustedScriptingSignature( sal_Bool bAllowUIToAddAuthor ) = 0;
/** shows a warning that the document's signature is broken
diff --git a/sfx2/inc/sfx2/event.hxx b/sfx2/inc/sfx2/event.hxx
index cd83103c8196..653fa2eeb7d8 100644
--- a/sfx2/inc/sfx2/event.hxx
+++ b/sfx2/inc/sfx2/event.hxx
@@ -34,6 +34,8 @@
#include "sfx2/dllapi.h"
#include <tools/string.hxx>
#include <svtools/hint.hxx>
+#include <svtools/eventcfg.hxx>
+#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -44,33 +46,24 @@ class SfxObjectShell;
class SFX2_DLLPUBLIC SfxEventHint : public SfxHint
{
- USHORT nEventId;
SfxObjectShell* pObjShell;
- String _aArgs;
- BOOL _bDummy;
- BOOL _bAddToHistory;
+ ::rtl::OUString aEventName;
+ USHORT nEventId;
public:
TYPEINFO();
- SfxEventHint( USHORT nId,
- const String& rArgs,
- SfxObjectShell *pObj = 0 )
- : nEventId(nId),
- pObjShell(pObj),
- _aArgs( rArgs ),
- _bAddToHistory(FALSE)
- {}
- SfxEventHint( USHORT nId, SfxObjectShell *pObj = 0 )
- : nEventId(nId),
- pObjShell(pObj),
- _bAddToHistory(FALSE)
+ SfxEventHint( USHORT nId, const ::rtl::OUString& aName, SfxObjectShell *pObj = 0 )
+ : pObjShell(pObj),
+ aEventName(aName),
+ nEventId(nId)
{}
- const String& GetArgs() const { return _aArgs;}
-
USHORT GetEventId() const
{ return nEventId; }
+ ::rtl::OUString GetEventName() const
+ { return aEventName; }
+
SfxObjectShell* GetObjShell() const
{ return pObjShell; }
};
@@ -82,8 +75,6 @@ class SfxNamedHint : public SfxHint
String _aEventName;
SfxObjectShell* _pObjShell;
String _aArgs;
- BOOL _bDummy;
- BOOL _bAddToHistory;
public:
TYPEINFO();
@@ -93,15 +84,13 @@ public:
SfxObjectShell *pObj = 0 )
: _aEventName( rName ),
_pObjShell( pObj),
- _aArgs( rArgs ),
- _bAddToHistory( FALSE )
+ _aArgs( rArgs )
{}
SfxNamedHint( const String& rName,
SfxObjectShell *pObj = 0 )
: _aEventName( rName ),
- _pObjShell( pObj ),
- _bAddToHistory( FALSE )
+ _pObjShell( pObj )
{}
const String& GetArgs() const { return _aArgs;}
diff --git a/sfx2/inc/sfx2/evntconf.hxx b/sfx2/inc/sfx2/evntconf.hxx
index 51362c14c309..cfe8629cd0cf 100644
--- a/sfx2/inc/sfx2/evntconf.hxx
+++ b/sfx2/inc/sfx2/evntconf.hxx
@@ -118,36 +118,9 @@ public:
class SFX2_DLLPUBLIC SfxEventConfiguration
{
-friend class SfxEventConfigItem_Impl;
-
- SvxMacroTableDtor* pAppTable;
- SvxMacroTableDtor* pDocTable;
- sal_Bool bIgnoreConfigure;
-
public:
- SfxEventConfiguration();
- ~SfxEventConfiguration();
-
- void ConfigureEvent(USHORT nId, const SvxMacro&,
- SfxObjectShell* pObjSh);
- void ConfigureEvent(USHORT nId, const String& rMacro,
- SfxObjectShell* pObjSh);
-
- SvxMacroTableDtor* GetDocEventTable(SfxObjectShell*);
-
- static void RegisterEvent( USHORT nId, const String& rName,
- const String& rMacroName );
-
- SAL_DLLPRIVATE BOOL Warn_Impl( SfxObjectShell *pDoc, const SvxMacro* pMacro );
- SAL_DLLPRIVATE void PropagateEvent_Impl( SfxObjectShell *pDoc,
- USHORT nId,
- const SvxMacro* pMacro );
- SAL_DLLPRIVATE static rtl::OUString GetEventName_Impl( ULONG nID );
- SAL_DLLPRIVATE static ULONG GetEventId_Impl( const rtl::OUString& rEventName );
- SAL_DLLPRIVATE ::com::sun::star::uno::Any CreateEventData_Impl( const SvxMacro *pMacro );
-
- SAL_DLLPRIVATE static ULONG GetPos_Impl( USHORT nID, sal_Bool &rFound );
- SAL_DLLPRIVATE static ULONG GetPos_Impl( const String& rName, sal_Bool &rFound );
+ static void ConfigureEvent( ::rtl::OUString aName, const SvxMacro&, SfxObjectShell* pObjSh);
+ static SvxMacro* ConvertToMacro( const com::sun::star::uno::Any& rElement, SfxObjectShell* pDoc, BOOL bBlowUp );
};
#endif
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index 7c5cb38dd9b4..52e2008df937 100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -43,6 +43,7 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/security/DocumentSignatureInformation.hpp>
+#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -236,10 +237,6 @@ private:
//REMOVE sal_Bool SaveInfoAndConfig_Impl( SvStorageRef pNewStg );
- SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos );
-
-
//#endif
protected:
@@ -736,8 +733,11 @@ public:
SAL_DLLPRIVATE void BreakMacroSign_Impl( sal_Bool bBreakMacroSing );
SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl();
SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
+ SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos );
+ SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
- SAL_DLLPRIVATE static SEQUENCE< OUSTRING > GetEventNames_Impl();
+ SAL_DLLPRIVATE SEQUENCE< OUSTRING > GetEventNames_Impl();
SAL_DLLPRIVATE void InitBasicManager_Impl();
SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImp; }
@@ -800,6 +800,13 @@ public:
SAL_DLLPRIVATE SfxAcceleratorManager* GetAccMgr_Impl();
SAL_DLLPRIVATE SfxToolBoxConfig* GetToolBoxConfig_Impl();
SAL_DLLPRIVATE sal_uInt16 ImplGetSignatureState( sal_Bool bScriptingContent = FALSE );
+
+ SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >
+ ImplAnalyzeSignature(
+ sal_Bool bScriptingContent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >& xSigner
+ = ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >() );
+
SAL_DLLPRIVATE void ImplSign( sal_Bool bScriptingContent = FALSE );
SAL_DLLPRIVATE sal_Bool QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
//#endif
diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc
index fbc5e6f58d1c..1605f689471f 100644
--- a/sfx2/inc/sfx2/sfx.hrc
+++ b/sfx2/inc/sfx2/sfx.hrc
@@ -111,6 +111,9 @@
#define SFX_EVENT_SAVEDOCFAILED (EVENT_SFX_START + 28)
#define SFX_EVENT_SAVETODOCFAILED (EVENT_SFX_START + 29)
+#define SFX_EVENT_TITLECHANGED (EVENT_SFX_START + 30)
+#define SFX_EVENT_MODECHANGED (EVENT_SFX_START + 31)
+
// Events f"ur Controls etc.
#define SFX_EVENT_MOUSEOVER_OBJECT ( EVENT_SFX_START + 100 )
#define SFX_EVENT_MOUSECLICK_OBJECT ( EVENT_SFX_START + 101 )
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index 324080484c81..6ef67b6a009a 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -1513,7 +1513,7 @@ private:
SAL_DLLPRIVATE void impl_store( const OUSTRING& sURL ,
const SEQUENCE< PROPERTYVALUE >& seqArguments ,
sal_Bool bSaveTo ) ;
- SAL_DLLPRIVATE void postEvent_Impl( ULONG nEventID );
+ SAL_DLLPRIVATE void postEvent_Impl( ::rtl::OUString );
SAL_DLLPRIVATE String getEventName_Impl( long nID );
SAL_DLLPRIVATE void NotifyStorageListeners_Impl();
SAL_DLLPRIVATE bool QuerySaveSizeExceededModules( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler );
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index 545464e09433..c15c09a09384 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -140,8 +140,10 @@
//#define SID_TITLE (SID_SFX_START + 307)
#define SID_CONTEXT (SID_SFX_START + 310)
-#define SID_CURRENTTIME (SID_SFX_START + 311)
-#define SID_CURRENTDATE (SID_SFX_START + 312)
+
+#define SID_PASTE_SPECIAL (SID_SFX_START + 311)
+#define SID_CLIPBOARD_FORMAT_ITEMS (SID_SFX_START + 312)
+
#define SID_VERSION_VISIBLE (SID_SFX_START + 313)
#define SID_PASTE_UNFORMATTED (SID_SFX_START + 314)
#define SID_PRINTER_NOTFOUND_WARN (SID_SFX_START + 320)
diff --git a/sfx2/inc/sfx2/signaturestate.hxx b/sfx2/inc/sfx2/signaturestate.hxx
index 48c06fee623b..be035ef25818 100644
--- a/sfx2/inc/sfx2/signaturestate.hxx
+++ b/sfx2/inc/sfx2/signaturestate.hxx
@@ -36,7 +36,12 @@
#define SIGNATURESTATE_NOSIGNATURES (sal_Int16)0
#define SIGNATURESTATE_SIGNATURES_OK (sal_Int16)1
#define SIGNATURESTATE_SIGNATURES_BROKEN (sal_Int16)2
-#define SIGNATURESTATE_SIGNATURES_INVALID (sal_Int16)3 // State was SIGNATURES_OK, but doc is modified now
-#define SIGNATURESTATE_SIGNATURES_NOTVALIDATED (sal_Int16)4 // signature is OK, but certificate could not be validated
+// State was SIGNATURES_OK, but doc is modified now
+#define SIGNATURESTATE_SIGNATURES_INVALID (sal_Int16)3
+// signature is OK, but certificate could not be validated
+#define SIGNATURESTATE_SIGNATURES_NOTVALIDATED (sal_Int16)4
+//signatur and certificate are ok,but not al files are signed, as was the case in
+//OOo 2.x - OOo 3.1.1. This state is only used together with document signatures.
+#define SIGNATURESTATE_SIGNATURES_PARTIAL_OK (sal_Int16)5
#endif // SFX2_SIGNATURESTATE_HXX
diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx
index 3dd4ff3d63a7..d0ac30a9fcd9 100644
--- a/sfx2/inc/sfx2/viewsh.hxx
+++ b/sfx2/inc/sfx2/viewsh.hxx
@@ -38,6 +38,7 @@
#include <com/sun/star/uno/Reference.h>
#include <svtools/lstner.hxx>
#include <com/sun/star/ui/XContextMenuInterceptor.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
#include <cppuhelper/interfacecontainer.hxx>
#include "shell.hxx"
#include <tools/gen.hxx>
@@ -77,6 +78,9 @@ class NotifyEvent;
#define SFX_PRINTER_CHG_ORIENTATION_FLAG 3
#define SFX_PRINTER_CHG_SIZE_FLAG 4
+#define SFX_PRINTERROR_NONE 0
+#define SFX_PRINTERROR_BUSY 1
+
enum SfxScrollingMode
{
SCROLLING_NO,
@@ -302,6 +306,8 @@ public:
void SetAdditionalPrintOptions( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& );
+ void AddRemoveClipboardListener( const com::sun::star::uno::Reference < com::sun::star::datatransfer::clipboard::XClipboardListener>&, BOOL );
+
#if _SOLAR__PRIVATE
SAL_DLLPRIVATE SfxInPlaceClient* GetUIActiveIPClient_Impl() const;
SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor );
diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi
index 61b897baceae..5da69fa977f3 100644
--- a/sfx2/sdi/appslots.sdi
+++ b/sfx2/sdi/appslots.sdi
@@ -92,14 +92,6 @@ interface Application
ExecMethod = MiscExec_Impl ;
StateMethod = MiscState_Impl ;
]
- SID_CURRENTTIME // ole(no) api(final/play/norec)
- [
- StateMethod = MiscState_Impl ;
- ]
- SID_CURRENTDATE // ole(no) api(final/play/norec)
- [
- StateMethod = MiscState_Impl ;
- ]
SID_LOADCONFIG // ole(no) api(final/play)
[
ExecMethod = MiscExec_Impl ;
diff --git a/sfx2/sdi/makefile.mk b/sfx2/sdi/makefile.mk
index ddf487094cf3..f8def0a3c23c 100644
--- a/sfx2/sdi/makefile.mk
+++ b/sfx2/sdi/makefile.mk
@@ -39,10 +39,13 @@ TARGET=sfxslots
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/util$/makefile.pmk
+.IF "$(L10N_framework)"==""
+
SDI1NAME=$(TARGET)
SDI1EXPORT=sfx
#SIDHRCNAME=sfx.hrc unused???
+.ENDIF
# --- Files --------------------------------------------------------
SVSDI1DEPEND= \
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index db625a9386c3..26f55ccdd178 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -853,7 +853,7 @@ SfxBoolItem BrowseView SID_BROWSER_MODE
[
/* flags: */
AutoUpdate = TRUE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -1041,7 +1041,7 @@ SfxVoidItem ClearHistory SID_CLEARHISTORY
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -1447,60 +1447,6 @@ SfxVoidItem CreateMacro SID_BASICIDE_CREATEMACRO
]
//--------------------------------------------------------------------------
-SfxStringItem CurrentDate SID_CURRENTDATE
-
-[
- /* flags: */
- AutoUpdate = FALSE,
- Cachable = Volatile,
- FastCall = FALSE,
- HasCoreId = FALSE,
- HasDialog = FALSE,
- ReadOnlyDoc = TRUE,
- Toggle = FALSE,
- Container = TRUE,
- RecordAbsolute = FALSE,
- RecordPerSet;
- Synchron;
-
- Readonly = TRUE,
-
- /* config: */
- AccelConfig = FALSE,
- MenuConfig = FALSE,
- StatusBarConfig = TRUE,
- ToolBoxConfig = FALSE,
- GroupId = GID_VIEW;
-]
-
-//--------------------------------------------------------------------------
-SfxStringItem CurrentTime SID_CURRENTTIME
-
-[
- /* flags: */
- AutoUpdate = FALSE,
- Cachable = Volatile,
- FastCall = FALSE,
- HasCoreId = FALSE,
- HasDialog = FALSE,
- ReadOnlyDoc = TRUE,
- Toggle = FALSE,
- Container = TRUE,
- RecordAbsolute = FALSE,
- RecordPerSet;
- Synchron;
-
- Readonly = TRUE,
-
- /* config: */
- AccelConfig = FALSE,
- MenuConfig = FALSE,
- StatusBarConfig = TRUE,
- ToolBoxConfig = FALSE,
- GroupId = GID_VIEW;
-]
-
-//--------------------------------------------------------------------------
SfxStringItem CurrentURL SID_CURRENT_URL
[
@@ -1842,7 +1788,7 @@ SfxBoolItem EditDoc SID_EDITDOC
[
/* flags: */
AutoUpdate = TRUE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -4287,7 +4233,7 @@ SfxBoolItem Modified SID_MODIFIED
[
/* flags: */
AutoUpdate = TRUE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -5015,7 +4961,7 @@ SfxVoidItem Paste SID_PASTE
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -5035,6 +4981,59 @@ SfxVoidItem Paste SID_PASTE
]
//--------------------------------------------------------------------------
+SfxVoidItem ClipboardFormatItems SID_CLIPBOARD_FORMAT_ITEMS
+(SfxUInt32Item SelectedFormat SID_CLIPBOARD_FORMAT_ITEMS)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SvxClipboardFmtItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxInt16Item PasteSpecial SID_PASTE_SPECIAL
+(SfxUInt32Item Format SID_PASTE_SPECIAL)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
SfxStringItem DocPath SID_DOCPATH
[
@@ -5486,7 +5485,7 @@ SfxVoidItem Redo SID_REDO
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -5539,7 +5538,7 @@ SfxBoolItem Reload SID_RELOAD
[
/* flags: */
AutoUpdate = TRUE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -5643,7 +5642,7 @@ SfxStringItem RepeatAction SID_REPEAT
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -5747,7 +5746,7 @@ SfxBoolItem Save SID_SAVEDOC
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -7179,7 +7178,7 @@ SfxVoidItem Undo SID_UNDO
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = FALSE,
@@ -8809,7 +8808,7 @@ SfxInt16Item PasteUnformatted SID_PASTE_UNFORMATTED
[
/* flags: */
AutoUpdate = FALSE,
- Cachable = Volatile,
+ Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
diff --git a/sfx2/sdi/sfxslots.sdi b/sfx2/sdi/sfxslots.sdi
index 27336865be73..e439e8c776a0 100644
--- a/sfx2/sdi/sfxslots.sdi
+++ b/sfx2/sdi/sfxslots.sdi
@@ -59,6 +59,7 @@ TypeLibFile( "sfxslots.tlb" )
item String SfxFrameItem; //! Dummy
item String SfxObjectShellItem //! Dummy
item String SfxUsrAnyItem //! Dummy
+ item String SvxClipboardFmtItem; //! Dummy
struct Point
{
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index d74bbd0961d9..53ea87703ac6 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -505,7 +505,7 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame )
if ( pOldContainerFrame )
{
if ( bTaskActivate )
- NotifyEvent( SfxEventHint( SFX_EVENT_DEACTIVATEDOC, pOldContainerFrame->GetObjectShell() ) );
+ NotifyEvent( SfxEventHint( SFX_EVENT_DEACTIVATEDOC, GlobalEventConfig::GetEventName(STR_EVENT_DEACTIVATEDOC), pOldContainerFrame->GetObjectShell() ) );
pOldContainerFrame->DoDeactivate( bTaskActivate, pFrame );
if( pOldContainerFrame->GetProgress() )
@@ -529,7 +529,7 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame )
if ( bTaskActivate && pNewContainerFrame->GetObjectShell() )
{
pNewContainerFrame->GetObjectShell()->PostActivateEvent_Impl( pNewContainerFrame );
- NotifyEvent(SfxEventHint(SFX_EVENT_ACTIVATEDOC, pNewContainerFrame->GetObjectShell() ) );
+ NotifyEvent(SfxEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName(STR_EVENT_ACTIVATEDOC), pNewContainerFrame->GetObjectShell() ) );
}
SfxProgress *pProgress = pNewContainerFrame->GetProgress();
diff --git a/sfx2/source/appl/app.hrc b/sfx2/source/appl/app.hrc
index 5969833e449a..c08f46effc81 100644
--- a/sfx2/source/appl/app.hrc
+++ b/sfx2/source/appl/app.hrc
@@ -78,27 +78,11 @@
#define RID_RECORDINGTOOLBOX (RID_SFX_APP_START+43)
#define RID_ENVTOOLBOX (RID_SFX_APP_START+44)
-#define STR_EVENT_STARTAPP (RID_SFX_APP_START+50)
-#define STR_EVENT_CLOSEAPP (RID_SFX_APP_START+51)
-#define STR_EVENT_CREATEDOC (RID_SFX_APP_START+52)
-#define STR_EVENT_OPENDOC (RID_SFX_APP_START+53)
-#define STR_EVENT_CLOSEDOC (RID_SFX_APP_START+54)
-#define STR_EVENT_SAVEDOC (RID_SFX_APP_START+55)
-#define STR_EVENT_SAVEASDOC (RID_SFX_APP_START+56)
-#define STR_EVENT_ACTIVATEDOC (RID_SFX_APP_START+57)
-#define STR_EVENT_DEACTIVATEDOC (RID_SFX_APP_START+58)
-#define STR_EVENT_ONERROR (RID_SFX_APP_START+78)
-#define STR_EVENT_PREPARECLOSEDOC (RID_SFX_APP_START+89)
-#define STR_EVENT_MODIFYCHANGED (RID_SFX_APP_START+90)
-#define STR_EVENT_SAVEDOCDONE (RID_SFX_APP_START+95)
-#define STR_EVENT_SAVEASDOCDONE (RID_SFX_APP_START+96)
-
#define STR_QUITAPP (RID_SFX_APP_START+59)
#define STR_EXITANDRETURN (RID_SFX_APP_START+60)
#define STR_ERR_NOFILE (RID_SFX_APP_START+61)
#define STR_EXTHELPSTATUS (RID_SFX_APP_START+62)
-#define STR_EVENT_PRINTDOC (RID_SFX_APP_START+64)
#define STR_ADDRESS_NAME (RID_SFX_APP_START+65)
#define RID_STR_HLPFILENOTEXIST (RID_SFX_APP_START+68)
diff --git a/sfx2/source/appl/app.src b/sfx2/source/appl/app.src
index eacfefddc689..463788d2d6d0 100644
--- a/sfx2/source/appl/app.src
+++ b/sfx2/source/appl/app.src
@@ -502,76 +502,6 @@ ToolBox RID_FULLSCREENTOOLBOX
};
};
-String STR_EVENT_STARTAPP
-{
- Text [ en-US ] = "Start Application" ;
-};
-
-String STR_EVENT_CLOSEAPP
-{
- Text [ en-US ] = "Close Application" ;
-};
-
-String STR_EVENT_CREATEDOC
-{
- Text [ en-US ] = "Create Document" ;
-};
-
-String STR_EVENT_CLOSEDOC
-{
- Text [ en-US ] = "Document closed" ;
-};
-
-String STR_EVENT_PREPARECLOSEDOC
-{
- Text [ en-US ] = "Document is closing" ;
-};
-
-String STR_EVENT_OPENDOC
-{
- Text [ en-US ] = "Open Document" ;
-};
-
-String STR_EVENT_SAVEDOC
-{
- Text [ en-US ] = "Save Document" ;
-};
-
-String STR_EVENT_SAVEASDOC
-{
- Text [ en-US ] = "Save Document As" ;
-};
-
-String STR_EVENT_SAVEDOCDONE
-{
- Text [ en-US ] = "Document has been saved" ;
-};
-
-String STR_EVENT_SAVEASDOCDONE
-{
- Text [ en-US ] = "Document has been saved as" ;
-};
-
-String STR_EVENT_ACTIVATEDOC
-{
- Text [ en-US ] = "Activate Document" ;
-};
-
-String STR_EVENT_DEACTIVATEDOC
-{
- Text [ en-US ] = "Deactivate Document" ;
-};
-
-String STR_EVENT_PRINTDOC
-{
- Text [ en-US ] = "Print Document" ;
-};
-
-String STR_EVENT_MODIFYCHANGED
-{
- Text [ en-US ] = "'Modified' status was changed" ;
-};
-
String STR_ERR_NOTEMPLATE
{
Text [ en-US ] = "The selected template has an incorrect format" ;
@@ -582,7 +512,6 @@ String STR_ERR_NOFILE
Text [ en-US ] = "Can't open file $." ;
};
-
String STR_QUITAPP
{
Text [ en-US ] = "E~xit" ;
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 17b28c5ab3e6..af31659ec24c 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -62,7 +62,7 @@
#include <sot/exchange.hxx>
//#include <svtools/agprop.hxx>
-#include <sj2/sjapplet.hxx>
+//#include <sj2/sjapplet.hxx>
#include <svtools/isethint.hxx>
#include <unotools/configmgr.hxx>
@@ -160,10 +160,12 @@ IMPL_LINK(SfxEventAsyncer_Impl, TimerHdl, Timer*, pAsyncTimer)
SfxObjectShellRef xRef( aHint.GetObjShell() );
pAsyncTimer->Stop();
#ifdef DBG_UTIL
- ::rtl::OUString aName = SfxEventConfiguration::GetEventName_Impl( aHint.GetEventId() );
- ByteString aTmp( "SfxEvent: ");
- aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 );
- DBG_TRACE( aTmp.GetBuffer() );
+ if (!xRef.Is())
+ {
+ ByteString aTmp( "SfxEvent: ");
+ aTmp += ByteString( String( aHint.GetEventName() ), RTL_TEXTENCODING_UTF8 );
+ DBG_TRACE( aTmp.GetBuffer() );
+ }
#endif
SFX_APP()->Broadcast( aHint );
if ( xRef.Is() )
@@ -848,6 +850,8 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
// INet Session neu aufsetzen
if ( bResetSession )
{
+ // no more sj2
+ #if 0
try
{
SjApplet2::settingsChanged();
@@ -856,6 +860,7 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
{
DBG_ERRORFILE( "SjApplet2::settingsChanged() throws an exception" );
}
+ #endif
}
// geaenderte Daten speichern
@@ -1037,21 +1042,29 @@ SfxEventConfiguration* SfxApplication::GetEventConfig() const
//--------------------------------------------------------------------
void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, FASTBOOL bSynchron )
{
- DBG_ASSERT(pAppData_Impl->pEventConfig,"Keine Events angemeldet!");
+ //DBG_ASSERT(pAppData_Impl->pEventConfig,"Keine Events angemeldet!");
SfxObjectShell *pDoc = rEventHint.GetObjShell();
if ( pDoc && ( pDoc->IsPreview() || !pDoc->Get_Impl()->bInitialized ) )
return;
#ifdef DBG_UTIL
- ::rtl::OUString aName = SfxEventConfiguration::GetEventName_Impl( rEventHint.GetEventId() );
- ByteString aTmp( "SfxEvent: ");
- aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 );
- DBG_TRACE( aTmp.GetBuffer() );
+ //::rtl::OUString aName = SfxEventConfiguration::GetEventName_Impl( rEventHint.GetEventId() );
+ //ByteString aTmp( "SfxEvent: ");
+ //aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 );
+ //DBG_TRACE( aTmp.GetBuffer() );
#endif
if ( bSynchron )
{
+#ifdef DBG_UTIL
+ if (!pDoc)
+ {
+ ByteString aTmp( "SfxEvent: ");
+ aTmp += ByteString( String( rEventHint.GetEventName() ), RTL_TEXTENCODING_UTF8 );
+ DBG_TRACE( aTmp.GetBuffer() );
+ }
+#endif
Broadcast(rEventHint);
if ( pDoc )
pDoc->Broadcast( rEventHint );
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index 243c4c325fcd..23de7317c379 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -42,7 +42,6 @@
#include <vos/mutex.hxx>
#include <vcl/menu.hxx>
-#include <svtools/loginerr.hxx>
#include <vcl/msgbox.hxx>
#include <svtools/dateitem.hxx>
#include <vcl/menu.hxx>
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 748cbc29c707..98439eb5a6dc 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -144,7 +144,6 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a
pApp->Broadcast( SfxSimpleHint( SFX_HINT_DEINITIALIZING ) );
pApp->Get_Impl()->pAppDispatch->ReleaseAll();
pApp->Get_Impl()->pAppDispatch->release();
- pApp->NotifyEvent(SfxEventHint( SFX_EVENT_CLOSEAPP) );
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
css::uno::Reference< css::document::XEventListener > xGlobalBroadcaster(xSMGR->createInstance(SERVICE_GLOBALEVENTBROADCASTER), css::uno::UNO_QUERY);
@@ -301,38 +300,6 @@ FASTBOOL SfxApplication::Initialize_Impl()
Registrations_Impl();
-// ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
- // TODO/LATER: exchange confusing defines; CREATEDOC -> NEWDOC, DOCCREATED -> CREATEDOC
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_STARTAPP, String(SfxResId(STR_EVENT_STARTAPP)), SfxObjectShell::GetEventNames_Impl()[0] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_CLOSEAPP, String(SfxResId(STR_EVENT_CLOSEAPP)), SfxObjectShell::GetEventNames_Impl()[1] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_CREATEDOC, String(SfxResId(STR_EVENT_CREATEDOC)), SfxObjectShell::GetEventNames_Impl()[2] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_OPENDOC, String(SfxResId(STR_EVENT_OPENDOC)), SfxObjectShell::GetEventNames_Impl()[3] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEASDOC, String(SfxResId(STR_EVENT_SAVEASDOC)), SfxObjectShell::GetEventNames_Impl()[4] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEASDOCDONE, String(SfxResId(STR_EVENT_SAVEASDOCDONE)), SfxObjectShell::GetEventNames_Impl()[5] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEDOC, String(SfxResId(STR_EVENT_SAVEDOC)), SfxObjectShell::GetEventNames_Impl()[6] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEDOCDONE, String(SfxResId(STR_EVENT_SAVEDOCDONE)), SfxObjectShell::GetEventNames_Impl()[7] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_PREPARECLOSEDOC, String(SfxResId(STR_EVENT_PREPARECLOSEDOC)),SfxObjectShell::GetEventNames_Impl()[8] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_CLOSEDOC, String(SfxResId(STR_EVENT_CLOSEDOC)), SfxObjectShell::GetEventNames_Impl()[9] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_ACTIVATEDOC, String(SfxResId(STR_EVENT_ACTIVATEDOC)), SfxObjectShell::GetEventNames_Impl()[10] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_DEACTIVATEDOC, String(SfxResId(STR_EVENT_DEACTIVATEDOC)), SfxObjectShell::GetEventNames_Impl()[11] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_PRINTDOC, String(SfxResId(STR_EVENT_PRINTDOC)), SfxObjectShell::GetEventNames_Impl()[12] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_MODIFYCHANGED, String(SfxResId(STR_EVENT_MODIFYCHANGED)), SfxObjectShell::GetEventNames_Impl()[13] );
-
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVETODOC, String(), SfxObjectShell::GetEventNames_Impl()[14] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVETODOCDONE, String(), SfxObjectShell::GetEventNames_Impl()[15] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_VIEWCREATED, String(), SfxObjectShell::GetEventNames_Impl()[16] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_PREPARECLOSEVIEW, String(), SfxObjectShell::GetEventNames_Impl()[17] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_CLOSEVIEW, String(), SfxObjectShell::GetEventNames_Impl()[18] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_VISAREACHANGED, String(), SfxObjectShell::GetEventNames_Impl()[19] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_DOCCREATED, String(), SfxObjectShell::GetEventNames_Impl()[20] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_LOADFINISHED, String(), SfxObjectShell::GetEventNames_Impl()[21] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEASDOCFAILED, String(), SfxObjectShell::GetEventNames_Impl()[22] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVEDOCFAILED, String(), SfxObjectShell::GetEventNames_Impl()[23] );
- SfxEventConfiguration::RegisterEvent(SFX_EVENT_SAVETODOCFAILED, String(), SfxObjectShell::GetEventNames_Impl()[24] );
- SfxEventConfiguration::RegisterEvent(SFX_HINT_TITLECHANGED, String(), SfxObjectShell::GetEventNames_Impl()[25] );
- SfxEventConfiguration::RegisterEvent(SFX_HINT_MODECHANGED, String(), SfxObjectShell::GetEventNames_Impl()[26] );
-
// Subklasse initialisieren
pAppData_Impl->bDowning = sal_False;
Init();
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 85f38abf284c..c6cb16f8f3f6 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -311,7 +311,7 @@ sal_uInt32 CheckPasswd_Impl
if( ( !pFile->GetFilter() || pFile->IsStorage() ) )
{
- uno::Reference< embed::XStorage > xStorage = pFile->GetStorage();
+ uno::Reference< embed::XStorage > xStorage = pFile->GetStorage( sal_True );
if( xStorage.is() )
{
uno::Reference< beans::XPropertySet > xStorageProps( xStorage, uno::UNO_QUERY );
@@ -392,7 +392,7 @@ ULONG SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const String &rFil
const SfxFilter* pFilter = NULL;
SfxMedium aMedium( rFileName, ( STREAM_READ | STREAM_SHARE_DENYNONE ), FALSE );
- if ( !aMedium.GetStorage().is() )
+ if ( !aMedium.GetStorage( sal_True ).is() )
aMedium.GetInStream();
if ( aMedium.GetError() )
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index b51a7bb483dc..184ecb9f1a5c 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -668,17 +668,6 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
rSet.DisableItem(nWhich);
break;
- case SID_CURRENTTIME:
- {
- rSet.Put( SfxStringItem( nWhich, aLocaleWrapper.getTime( Time(), FALSE ) ) );
- break;
- }
- case SID_CURRENTDATE:
- {
- rSet.Put( SfxStringItem( nWhich, aLocaleWrapper.getDate( Date() ) ) );
- break;
- }
-
case SID_HELPTIPS:
{
rSet.Put( SfxBoolItem( SID_HELPTIPS, Help::IsQuickHelpEnabled() ) );
@@ -859,6 +848,12 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
pFact->CreateFrameDialog( NULL, xFrame, rReq.GetSlot(), sPageURL );
pDlg->Execute();
delete pDlg;
+ SfxViewFrame* pView = SfxViewFrame::GetFirst();
+ while ( pView )
+ {
+ pView->GetBindings().InvalidateAll(FALSE);
+ pView = SfxViewFrame::GetNext( *pView );
+ }
}
break;
}
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 90b12b484a01..c9814eb50e6a 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -137,7 +137,7 @@ using namespace ::com::sun::star::io;
#include "brokenpackageint.hxx"
#include "eventsupplier.hxx"
#include "xpackcreator.hxx"
-#include "applet.hxx"
+// #include "applet.hxx"
#include "plugin.hxx"
#include "iframe.hxx"
#include <ownsubfilterservice.hxx>
@@ -2150,6 +2150,7 @@ SFX2_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo(
xNewKey = xKey->createKey( aTempStr );
xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.frame.SpecialEmbeddedObject") );
+ #if 0
// AppletObject
aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
aImpl += ::sfx2::AppletObject::impl_getStaticImplementationName();
@@ -2158,6 +2159,7 @@ SFX2_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo(
aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES"));
xNewKey = xKey->createKey( aTempStr );
xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.frame.SpecialEmbeddedObject") );
+ #endif
// IFrameObject
aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
@@ -2324,11 +2326,13 @@ SFX2_DLLPUBLIC void* SAL_CALL component_getFactory(
IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler )
#endif
IF_NAME_CREATECOMPONENTFACTORY( OPackageStructureCreator )
+ #if 0
if ( ::sfx2::AppletObject::impl_getStaticImplementationName().equals(
::rtl::OUString::createFromAscii( pImplementationName ) ) )
{
xFactory = ::sfx2::AppletObject::impl_createFactory();
}
+ #endif
IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::PluginObject )
IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::IFrameObject )
IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::OwnSubFilterService )
diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index 0de25b0c7503..91227e3e34ec 100644
--- a/sfx2/source/appl/sfxpicklist.cxx
+++ b/sfx2/source/appl/sfxpicklist.cxx
@@ -43,8 +43,6 @@
#include <unotools/localfilehelper.hxx>
#include <cppuhelper/implbase1.hxx>
-#include <shell/systemshell.hxx>
-
// ----------------------------------------------------------------------------
#include <sfx2/app.hxx>
@@ -470,7 +468,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint )
pDocSh->Get_Impl()->bWaitingForPicklist = sal_False;
if ( aURL.GetProtocol() == INET_PROT_FILE )
- SystemShell::AddToRecentDocumentList( aURL.GetURLNoPass( INetURLObject::NO_DECODE ), (pFilter) ? pFilter->GetMimeType() : String() );
+ Application::AddToRecentDocumentList( aURL.GetURLNoPass( INetURLObject::NO_DECODE ), (pFilter) ? pFilter->GetMimeType() : String() );
}
break;
}
diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx
index 258170789c2f..3c0adfd5c873 100644
--- a/sfx2/source/bastyp/helper.cxx
+++ b/sfx2/source/bastyp/helper.cxx
@@ -820,39 +820,6 @@ ULONG SfxContentHelper::GetSize( const String& rContent )
}
// -----------------------------------------------------------------------
-
-sal_Bool SfxContentHelper::IsYounger( const String& rIsYoung, const String& rIsOlder )
-{
- DateTime aYoungDate, aOlderDate;
- INetURLObject aYoungObj( rIsYoung );
- DBG_ASSERT( aYoungObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
- INetURLObject aOlderObj( rIsOlder );
- DBG_ASSERT( aOlderObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
- try
- {
- uno::Reference< ucb::XCommandEnvironment > aCmdEnv;
- ::ucbhelper::Content aYoung( aYoungObj.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv );
- util::DateTime aTempYoungDate;
- aYoung.getPropertyValue( OUString::createFromAscii( "DateModified" ) ) >>= aTempYoungDate;
- CONVERT_DATETIME( aTempYoungDate, aYoungDate );
- ::ucbhelper::Content aOlder( aOlderObj.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv );
- util::DateTime aTempOlderDate;
- aOlder.getPropertyValue( OUString::createFromAscii( "DateModified" ) ) >>= aTempOlderDate;
- CONVERT_DATETIME( aTempOlderDate, aOlderDate );
- }
- catch( ucb::CommandAbortedException& )
- {
- DBG_ERRORFILE( "CommandAbortedException" );
- }
- catch( uno::Exception& )
- {
- DBG_ERRORFILE( "Any other exception" );
- }
-
- return ( aYoungDate > aOlderDate );
-}
-
-// -----------------------------------------------------------------------
// please don't use it (only used in appbas.cxx and appcfg.cxx)
sal_Bool SfxContentHelper::Exists( const String& rContent )
{
diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx
index 62bc5533e1a9..121b8604e02d 100644
--- a/sfx2/source/bastyp/progress.cxx
+++ b/sfx2/source/bastyp/progress.cxx
@@ -117,20 +117,8 @@ struct SfxProgress_Impl : public SfxCancellable
#define aTypeLibInfo aProgressTypeLibImpl
//========================================================================
-#if defined(_MSC_VER) && (_MSC_VER < 1300)
-inline ULONG Get10ThSec()
-{
-#if defined (MSC) && defined (WIN)
- ULONG n10Ticks = 10 * (ULONG)GetTickCount();
-#else
- ULONG n10Ticks = 10 * (ULONG)clock();
-#endif
-
- return n10Ticks / CLOCKS_PER_SEC;
-}
-#else
extern ULONG Get10ThSec();
-#endif
+
// -----------------------------------------------------------------------
void SfxProgress_Impl::Enable_Impl( BOOL bEnable )
diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx
index 6bca26886b2a..daf9174d20cb 100644
--- a/sfx2/source/config/evntconf.cxx
+++ b/sfx2/source/config/evntconf.cxx
@@ -69,23 +69,6 @@
#include <com/sun/star/uno/Reference.hxx>
// -----------------------------------------------------------------------
-
-#define PROPERTYVALUE ::com::sun::star::beans::PropertyValue
-#define XNAMEREPLACE ::com::sun::star::container::XNameReplace
-#define XEVENTSSUPPLIER ::com::sun::star::document::XEventsSupplier
-#define ANY ::com::sun::star::uno::Any
-#define REFERENCE ::com::sun::star::uno::Reference
-#define SEQUENCE ::com::sun::star::uno::Sequence
-#define UNO_QUERY ::com::sun::star::uno::UNO_QUERY
-
-#define OUSTRING ::rtl::OUString
-
-// -----------------------------------------------------------------------
-
-static const USHORT nCompatVersion = 3;
-static const USHORT nOldVersion = 4;
-static const USHORT nVersion = 5;
-
TYPEINIT1(SfxEventHint, SfxHint);
TYPEINIT1(SfxEventNamesItem, SfxPoolItem);
@@ -176,195 +159,11 @@ void SfxEventNamesItem::AddEvent( const String& rName, const String& rUIName, US
aEventsList.Insert( new SfxEventName( nID, rName, rUIName.Len() ? rUIName : rName ) );
}
-// class SfxAsyncEvent_Impl ----------------------------------------------
-
-class SfxAsyncEvent_Impl : public SfxListener
-{
- String aArgs;
- SfxObjectShell* pSh;
- const SvxMacro* pMacro;
- Timer *pTimer;
-
-public:
-
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
- SfxAsyncEvent_Impl( SfxObjectShell *pDoc, const SvxMacro *pMacro, const String& rArgs );
- ~SfxAsyncEvent_Impl();
- DECL_LINK( TimerHdl, Timer*);
-};
-
-// -----------------------------------------------------------------------
-
-void SfxAsyncEvent_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint )
-{
- SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint );
- if( pHint && pHint->GetId() == SFX_HINT_DYING && pTimer->IsActive() )
- {
- pTimer->Stop();
- delete this;
- }
-}
-
-// -----------------------------------------------------------------------
-
-SfxAsyncEvent_Impl::SfxAsyncEvent_Impl( SfxObjectShell *pDoc, const SvxMacro *pMac, const String& rArgs )
- : aArgs( rArgs )
- , pSh( pDoc )
- , pMacro( pMac )
-{
- if( pSh ) StartListening( *pSh );
- pTimer = new Timer;
- pTimer->SetTimeoutHdl( LINK(this, SfxAsyncEvent_Impl, TimerHdl) );
- pTimer->SetTimeout( 0 );
- pTimer->Start();
-}
-
-// -----------------------------------------------------------------------
-
-SfxAsyncEvent_Impl::~SfxAsyncEvent_Impl()
-{
- delete pTimer;
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK(SfxAsyncEvent_Impl, TimerHdl, Timer*, pAsyncTimer)
-{
- pAsyncTimer->Stop();
- ScriptType eSType = pMacro->GetScriptType();
- BOOL bIsBasic = ( eSType == STARBASIC );
- if ( bIsBasic && StarBASIC::IsRunning() )
- // Neues eventgebundenes Macro erst ausf"uhren, wenn gerade kein anderes Macro mehr l"auft
- pAsyncTimer->Start();
- else
- {
- SFX_APP()->GetMacroConfig()->ExecuteMacro( pSh, pMacro, aArgs );
- delete this;
- }
-
- return 0L;
-}
-
-SfxEventNamesList *gp_Id_SortList = NULL;
-SfxEventNamesList *gp_Name_SortList = NULL;
-
-//==========================================================================
-
-SfxEventConfiguration::SfxEventConfiguration()
- : pAppTable( NULL )
- , pDocTable( NULL )
-{
- bIgnoreConfigure = sal_False;
-}
-
-//==========================================================================
-
-SfxEventConfiguration::~SfxEventConfiguration()
-{
- delete pDocTable;
-
- if ( gp_Id_SortList )
- {
- delete gp_Id_SortList;
- delete gp_Name_SortList;
- gp_Id_SortList = NULL;
- gp_Name_SortList = NULL;
- }
-}
-
-void SfxEventConfiguration::ConfigureEvent( USHORT nId, const SvxMacro& rMacro, SfxObjectShell *pDoc )
-{
- if ( bIgnoreConfigure )
- return;
-
- SvxMacro *pMacro = NULL;
- if ( rMacro.GetMacName().Len() )
- pMacro = new SvxMacro( rMacro.GetMacName(), rMacro.GetLibName(), rMacro.GetScriptType() );
- if ( pDoc )
- {
- PropagateEvent_Impl( pDoc, nId, pMacro );
- }
- else
- {
- PropagateEvent_Impl( NULL, nId, pMacro );
- }
-}
//==========================================================================
-SvxMacroTableDtor* SfxEventConfiguration::GetDocEventTable( SfxObjectShell*pDoc )
-{
- if ( pDocTable )
- delete pDocTable;
-
- pDocTable = new SvxMacroTableDtor;
-
- if ( pDoc )
- {
- REFERENCE< XEVENTSSUPPLIER > xSup( pDoc->GetModel(), UNO_QUERY );
- uno::Reference < container::XNameReplace > xEvents = xSup->getEvents();
-
- uno::Sequence < ::rtl::OUString > aNames = xEvents->getElementNames();
- for ( sal_Int32 i=0; i<aNames.getLength(); i++ )
- {
- SvxMacro* pMacro = SfxEvents_Impl::ConvertToMacro( xEvents->getByName( aNames[i] ), pDoc, TRUE );
- USHORT nID = (USHORT) GetEventId_Impl( aNames[i] );
- if ( nID && pMacro )
- pDocTable->Insert( nID, pMacro );
- }
- }
-
- return pDocTable;
-}
-
//--------------------------------------------------------------------------
-void SfxEventConfiguration::PropagateEvent_Impl( SfxObjectShell *pDoc,
- USHORT nId,
- const SvxMacro* pMacro )
-{
- REFERENCE< XEVENTSSUPPLIER > xSupplier;
- if ( pDoc )
- {
- xSupplier = REFERENCE< XEVENTSSUPPLIER >( pDoc->GetModel(), UNO_QUERY );
- }
- else
- {
- xSupplier = REFERENCE< XEVENTSSUPPLIER >
- ( ::comphelper::getProcessServiceFactory()->createInstance(
- rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster" )), UNO_QUERY );
- }
-
- if ( xSupplier.is() )
- {
- REFERENCE< XNAMEREPLACE > xEvents = xSupplier->getEvents();
-
- bIgnoreConfigure = sal_True;
-
- OUSTRING aEventName = GetEventName_Impl( nId );
-
- if ( aEventName.getLength() )
- {
- ANY aEventData = CreateEventData_Impl( pMacro );
-
- try
- {
- xEvents->replaceByName( aEventName, aEventData );
- }
- catch( ::com::sun::star::lang::IllegalArgumentException )
- { DBG_ERRORFILE( "PropagateEvents_Impl: caught IllegalArgumentException" ); }
- catch( ::com::sun::star::container::NoSuchElementException )
- { DBG_ERRORFILE( "PropagateEvents_Impl: caught NoSuchElementException" ); }
- }
- else {
- DBG_WARNING( "PropagateEvents_Impl: Got unkown event" );
- }
-
- bIgnoreConfigure = sal_False;
- }
-}
-
-// -------------------------------------------------------------------------------------------------------
-ANY SfxEventConfiguration::CreateEventData_Impl( const SvxMacro *pMacro )
+uno::Any CreateEventData_Impl( const SvxMacro *pMacro )
{
/*
This function converts a SvxMacro into an Any containing three
@@ -376,57 +175,57 @@ ANY SfxEventConfiguration::CreateEventData_Impl( const SvxMacro *pMacro )
If pMacro is NULL, we return an empty property sequence, so PropagateEvent_Impl
can delete an event binding.
*/
- ANY aEventData;
+ uno::Any aEventData;
if ( pMacro )
{
if ( pMacro->GetScriptType() == STARBASIC )
{
- SEQUENCE < PROPERTYVALUE > aProperties(3);
- PROPERTYVALUE *pValues = aProperties.getArray();
+ uno::Sequence < beans::PropertyValue > aProperties(3);
+ beans::PropertyValue *pValues = aProperties.getArray();
- OUSTRING aType = OUSTRING::createFromAscii( STAR_BASIC );;
- OUSTRING aLib = pMacro->GetLibName();
- OUSTRING aMacro = pMacro->GetMacName();
+ ::rtl::OUString aType = ::rtl::OUString::createFromAscii( STAR_BASIC );;
+ ::rtl::OUString aLib = pMacro->GetLibName();
+ ::rtl::OUString aMacro = pMacro->GetMacName();
- pValues[ 0 ].Name = OUSTRING::createFromAscii( PROP_EVENT_TYPE );
+ pValues[ 0 ].Name = ::rtl::OUString::createFromAscii( PROP_EVENT_TYPE );
pValues[ 0 ].Value <<= aType;
- pValues[ 1 ].Name = OUSTRING::createFromAscii( PROP_LIBRARY );
+ pValues[ 1 ].Name = ::rtl::OUString::createFromAscii( PROP_LIBRARY );
pValues[ 1 ].Value <<= aLib;
- pValues[ 2 ].Name = OUSTRING::createFromAscii( PROP_MACRO_NAME );
+ pValues[ 2 ].Name = ::rtl::OUString::createFromAscii( PROP_MACRO_NAME );
pValues[ 2 ].Value <<= aMacro;
aEventData <<= aProperties;
}
else if ( pMacro->GetScriptType() == EXTENDED_STYPE )
{
- SEQUENCE < PROPERTYVALUE > aProperties(2);
- PROPERTYVALUE *pValues = aProperties.getArray();
+ uno::Sequence < beans::PropertyValue > aProperties(2);
+ beans::PropertyValue *pValues = aProperties.getArray();
- OUSTRING aLib = pMacro->GetLibName();
- OUSTRING aMacro = pMacro->GetMacName();
+ ::rtl::OUString aLib = pMacro->GetLibName();
+ ::rtl::OUString aMacro = pMacro->GetMacName();
- pValues[ 0 ].Name = OUSTRING::createFromAscii( PROP_EVENT_TYPE );
+ pValues[ 0 ].Name = ::rtl::OUString::createFromAscii( PROP_EVENT_TYPE );
pValues[ 0 ].Value <<= aLib;
- pValues[ 1 ].Name = OUSTRING::createFromAscii( PROP_SCRIPT );
+ pValues[ 1 ].Name = ::rtl::OUString::createFromAscii( PROP_SCRIPT );
pValues[ 1 ].Value <<= aMacro;
aEventData <<= aProperties;
}
else if ( pMacro->GetScriptType() == JAVASCRIPT )
{
- SEQUENCE < PROPERTYVALUE > aProperties(2);
- PROPERTYVALUE *pValues = aProperties.getArray();
+ uno::Sequence < beans::PropertyValue > aProperties(2);
+ beans::PropertyValue *pValues = aProperties.getArray();
- OUSTRING aMacro = pMacro->GetMacName();
+ ::rtl::OUString aMacro = pMacro->GetMacName();
- pValues[ 0 ].Name = OUSTRING::createFromAscii( PROP_EVENT_TYPE );
+ pValues[ 0 ].Name = ::rtl::OUString::createFromAscii( PROP_EVENT_TYPE );
pValues[ 0 ].Value <<= ::rtl::OUString::createFromAscii(SVX_MACRO_LANGUAGE_JAVASCRIPT);
- pValues[ 1 ].Name = OUSTRING::createFromAscii( PROP_MACRO_NAME );
+ pValues[ 1 ].Name = ::rtl::OUString::createFromAscii( PROP_MACRO_NAME );
pValues[ 1 ].Value <<= aMacro;
aEventData <<= aProperties;
@@ -438,171 +237,68 @@ ANY SfxEventConfiguration::CreateEventData_Impl( const SvxMacro *pMacro )
}
else
{
- SEQUENCE < PROPERTYVALUE > aProperties;
+ uno::Sequence < beans::PropertyValue > aProperties;
aEventData <<= aProperties;
}
return aEventData;
}
-// -------------------------------------------------------------------------------------------------------
-ULONG SfxEventConfiguration::GetPos_Impl( USHORT nId, sal_Bool &rFound )
+//--------------------------------------------------------------------------
+void PropagateEvent_Impl( SfxObjectShell *pDoc, rtl::OUString aEventName, const SvxMacro* pMacro )
{
- rFound = sal_False;
-
- if ( ! gp_Id_SortList->Count() )
- return 0;
-
- // use binary search to find the correct position
- // in the list
-
- int nCompVal = 1;
- long nStart = 0;
- long nEnd = gp_Id_SortList->Count() - 1;
- long nMid = 0;
-
- SfxEventName* pMid;
-
- rFound = sal_False;
-
- while ( nCompVal && ( nStart <= nEnd ) )
- {
- nMid = ( nEnd - nStart ) / 2 + nStart;
- pMid = gp_Id_SortList->GetObject( (USHORT) nMid );
-
- nCompVal = pMid->mnId - nId;
-
- if ( nCompVal < 0 ) // pMid < pData
- nStart = nMid + 1;
- else
- nEnd = nMid - 1;
- }
-
- if ( nCompVal == 0 )
+ uno::Reference < document::XEventsSupplier > xSupplier;
+ if ( pDoc )
{
- rFound = sal_True;
+ xSupplier = uno::Reference < document::XEventsSupplier >( pDoc->GetModel(), uno::UNO_QUERY );
}
else
{
- if ( nCompVal < 0 ) // pMid < pData
- nMid++;
+ xSupplier = uno::Reference < document::XEventsSupplier >
+ ( ::comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster" )), uno::UNO_QUERY );
}
- return (USHORT) nMid;
-}
-
-// -------------------------------------------------------------------------------------------------------
-ULONG SfxEventConfiguration::GetPos_Impl( const String& rName, sal_Bool &rFound )
-{
- rFound = sal_False;
-
- if ( ! gp_Name_SortList->Count() )
- return 0;
-
- // use binary search to find the correct position
- // in the list
-
- int nCompVal = 1;
- long nStart = 0;
- long nEnd = gp_Name_SortList->Count() - 1;
- long nMid = 0;
-
- SfxEventName* pMid;
-
- rFound = sal_False;
-
- while ( nCompVal && ( nStart <= nEnd ) )
+ if ( xSupplier.is() )
{
- nMid = ( nEnd - nStart ) / 2 + nStart;
- pMid = gp_Name_SortList->GetObject( (USHORT) nMid );
-
- nCompVal = rName.CompareTo( pMid->maEventName );
-
- if ( nCompVal < 0 ) // pMid < pData
- nStart = nMid + 1;
- else
- nEnd = nMid - 1;
- }
+ uno::Reference < container::XNameReplace > xEvents = xSupplier->getEvents();
+ if ( aEventName.getLength() )
+ {
+ uno::Any aEventData = CreateEventData_Impl( pMacro );
- if ( nCompVal == 0 )
- {
- rFound = sal_True;
- }
- else
- {
- if ( nCompVal < 0 ) // pMid < pData
- nMid++;
+ try
+ {
+ xEvents->replaceByName( aEventName, aEventData );
+ }
+ catch( ::com::sun::star::lang::IllegalArgumentException )
+ { DBG_ERRORFILE( "PropagateEvents_Impl: caught IllegalArgumentException" ); }
+ catch( ::com::sun::star::container::NoSuchElementException )
+ { DBG_ERRORFILE( "PropagateEvents_Impl: caught NoSuchElementException" ); }
+ }
+ else {
+ DBG_WARNING( "PropagateEvents_Impl: Got unkown event" );
+ }
}
-
- return (USHORT) nMid;
}
//--------------------------------------------------------------------------------------------------------
-OUSTRING SfxEventConfiguration::GetEventName_Impl( ULONG nID )
+void SfxEventConfiguration::ConfigureEvent( rtl::OUString aName, const SvxMacro& rMacro, SfxObjectShell *pDoc )
{
- OUSTRING aRet;
-
- if ( gp_Id_SortList )
+ SvxMacro *pMacro = NULL;
+ if ( rMacro.GetMacName().Len() )
+ pMacro = new SvxMacro( rMacro.GetMacName(), rMacro.GetLibName(), rMacro.GetScriptType() );
+ if ( pDoc )
{
- sal_Bool bFound;
- ULONG nPos = GetPos_Impl( (USHORT) nID, bFound );
-
- if ( bFound )
- {
- SfxEventName *pData = gp_Id_SortList->GetObject( nPos );
- aRet = pData->maEventName;
- }
+ PropagateEvent_Impl( pDoc, aName, pMacro );
}
-
- return aRet;
-}
-
-//--------------------------------------------------------------------------------------------------------
-ULONG SfxEventConfiguration::GetEventId_Impl( const OUSTRING& rEventName )
-{
- ULONG nRet = 0;
-
- if ( gp_Name_SortList )
+ else
{
- sal_Bool bFound;
- ULONG nPos = GetPos_Impl( rEventName, bFound );
-
- if ( bFound )
- {
- SfxEventName *pData = gp_Name_SortList->GetObject( nPos );
- nRet = pData->mnId;
- }
+ PropagateEvent_Impl( NULL, aName, pMacro );
}
-
- return nRet;
}
// -------------------------------------------------------------------------------------------------------
-void SfxEventConfiguration::RegisterEvent( USHORT nId,
- const String& rUIName,
- const String& rMacroName )
+SvxMacro* SfxEventConfiguration::ConvertToMacro( const com::sun::star::uno::Any& rElement, SfxObjectShell* pDoc, BOOL bBlowUp )
{
- if ( ! gp_Id_SortList )
- {
- gp_Id_SortList = new SfxEventNamesList;
- gp_Name_SortList = new SfxEventNamesList;
- }
-
- sal_Bool bFound = sal_False;
- ULONG nPos = GetPos_Impl( nId, bFound );
-
- if ( bFound )
- {
- DBG_ERRORFILE( "RegisterEvent: Event already registered?" );
- return;
- }
-
- gp_Id_SortList->Insert( new SfxEventName( nId, rMacroName, rUIName ), nPos );
- nPos = GetPos_Impl( rMacroName, bFound );
-
- DBG_ASSERT( !bFound, "RegisterEvent: Name in List, but ID not?" );
-
- gp_Name_SortList->Insert( new SfxEventName( nId, rMacroName, rUIName ), nPos );
-
- SFX_APP()->GetEventConfig();
+ return SfxEvents_Impl::ConvertToMacro( rElement, pDoc, bBlowUp );
}
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index e5d78f560cc9..0da17ba3b158 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -145,16 +145,6 @@ IMPL_LINK(SfxAsyncExec_Impl, TimerHdl, Timer*, pTimer)
}
class SfxBindings_Impl
-
-/* [Beschreibung]
-
- Diese Implementations-Struktur der Klasse SfxBindings dient
- der Entkopplung von "Anderungen vom exportierten Interface sowie
- der Verringerung von extern sichtbaren Symbolen.
-
- Eine Instanz exisitiert pro SfxBindings-Instanz f"ur deren Laufzeit.
-*/
-
{
public:
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchRecorder > xRecorder;
@@ -186,20 +176,6 @@ public:
//--------------------------------------------------------------------
struct SfxFoundCache_Impl
-
-/* [Beschreibung]
-
- In Instanzen dieser Struktur werden in <SfxBindings::CreateSet_Impl()>
- weitere Informationen zu den gemeinsam von einem <Slot-Server> zu
- erfragenden Status gesammelt, deren Ids dort in die Ranges eines
- <SfxItemSet>s aufgenommen werden.
-
- Diese Informationen werden w"ahrend der Suche nach den zusammen
- upzudatenden Ids sowieso als Zwischenergebnis ermittelt und nachher
- wieder ben"otigt, daher macht es Sinn, sie f"ur diesen kurzen Zeitraum
- gleich aufzubewahren.
-*/
-
{
sal_uInt16 nSlotId; // die Slot-Id
sal_uInt16 nWhichId; // falls verf"ugbar die Which-Id, sonst nSlotId
@@ -242,20 +218,6 @@ SV_IMPL_OP_PTRARR_SORT(SfxFoundCacheArr_Impl, SfxFoundCache_Impl*);
//==========================================================================
SfxBindings::SfxBindings()
-
-/* [Beschreibung]
-
- Konstruktor der Klasse SfxBindings. Genau eine Instanz wird automatisch
- von der <SfxApplication> vor <SfxApplication::Init()> angelegt. Wird
- eine Instanz ben"otigt, z.B. zum Invalidieren von Slots, sollte diese
- "uber den zugeh"origen <SfxViewFrame> besorgt werden. Bestimmte
- SfxViewFrame Subklassen (z.B. <SfxInPlaceFrame>) legen ihre eigene
- Instanz der SfxBindings an.
-
- <SfxControllerItem> Instanzen k"onnen erst angelegt werden, wenn
- die zugeh"orige SfxBindings Instanz existiert.
-*/
-
: pImp(new SfxBindings_Impl),
pDispatcher(0),
nRegLevel(1) // geht erst auf 0, wenn Dispatcher gesetzt
@@ -324,23 +286,6 @@ SfxBindings::~SfxBindings()
//--------------------------------------------------------------------
void SfxBindings::DeleteControllers_Impl()
-
-/* [Beschreibung]
-
- Interne Methode zum l"oschen noch existierender <SfxControllerItem>
- Instanzen, die bei dieser SfxBindings Instanz angemeldet sind.
-
- Dies sind i.d.R. <SfxPopupWindow>s. Nich sich selbst geh"orende
- SfxControllerItems d"urfen bei Aufruf nur noch existieren, wenn sie
- einem der restlichen SfxPopupWindows geh"oren.
-
-
- [Anmerkung]
-
- Wird beim Beenden der Applikation gerufen, bevor das Applikations-
- Fenster gel"oscht wird.
-*/
-
{
// in der ersten Runde den SfxPopupWindows l"oschen
sal_uInt16 nCount = pImp->pCaches->Count();
@@ -415,20 +360,6 @@ SfxPopupAction SfxBindings::GetPopupAction_Impl() const
//--------------------------------------------------------------------
void SfxBindings::HidePopups( bool bHide )
-
-/* [Beschreibung]
-
- Dieser Methode versteckt und zeigt die <SfxPopupWindows>, die aus
- <SfxToolboxControl>s dieser SfxBindings-Instanz abgerissen wurden bzw.
- floating <SfxChildWindow>-Instanzen dieser SfxBindings-Instanz.
-
-
- [Anmerkung]
-
- Es k"onnten noch weitere Floating-Windows exisitieren, die durch
- diese Methode nicht erfa\st werden.
-*/
-
{
// SfxPopupWindows hiden
HidePopupCtrls_Impl( bHide );
@@ -469,13 +400,6 @@ void SfxBindings::Update_Impl
(
SfxStateCache* pCache // der upzudatende SfxStatusCache
)
-
-/* [Beschreibung]
-
- Interne Methode zum Updaten eines Caches und den von derselben
- Status-Methode in derselben Shell bedienten und dirty Slots.
-*/
-
{
if( pCache->GetDispatch().is() && pCache->GetItemLink() )
{
@@ -558,35 +482,6 @@ void SfxBindings::Update
(
sal_uInt16 nId // die gebundene und upzudatende Slot-Id
)
-
-/* [Beschreibung]
-
- Diese Methode sorgt f"ur synchrones Updaten der auf die Slot-Id nId
- gebundenen <SfxContollerItem> Instanzen, die an dieser SfxBindings
- Instanz angemeldet sind. Vergleichbar zu Window::Update()
- (StarView) erfolgt ein Update nur, wenn entweder ein auf diese
- Slot-Id gebundenes SfxContollerItem dirty ist, oder die Slot-Id
- selbst dirty ist. Dies kann durch einen vorhergehendes Aufruf von
- <SfxBindings::Invalidate(sal_uInt16)> erzwungen werden.
-
-
- [Anmerkung]
-
- Es ist g"unstiger, zun"achst alle zu invalidierenden Slot-Ids per
- <SfxBindings::Invalidate(sal_uInt16)> zu invalidieren und dann
- Update() aufzurufen, als einzelne abwechselnde Invalidate/Update,
- da von derselben Status-Methode bediente Status-Anfragen von
- den SfxBindings automatisch zusammengefa"st werden.
-
-
- [Querverweise]
-
- <SfxShell::Invalidate(sal_uInt16)>
- <SfxBindings::Invalidate(sal_uInt16)>
- <SfxBindings::InvalidateAll(sal_Bool)>
- <SfxBindings::Update()>
-*/
-
{
DBG_MEMTEST();
DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" );
@@ -654,26 +549,6 @@ void SfxBindings::Update
//--------------------------------------------------------------------
void SfxBindings::Update()
-
-/* [Beschreibung]
-
- Diese Methode sorgt f"ur synchrones Updaten aller <SfxContollerItem>
- Instanzen, die an dieser SfxBindings Instanz angemeldet sind. Vergleichbar
- zu Window::Update() (StarView) erfolgt ein Update nur, wenn entweder ein
- SfxContollerItem dirty ist, in einem Status-Cache der Zeiger auf den
- <Slot-Server> dirty ist. Ersteres kann durch einen Aufruf von
- <SfxBindings::Invalidate(sal_uInt16)> erzwungen werden, letzters durch
- <SfxBindings::InvalidateAll(sal_Bool)>.
-
-
- [Querverweise]
-
- <SfxShell::Invalidate(sal_uInt16)>
- <SfxBindings::Invalidate(sal_uInt16)>
- <SfxBindings::InvalidateAll(sal_Bool)>
- <SfxBindings::Update(sal_uInt16)>
-*/
-
{
DBG_MEMTEST();
DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" );
@@ -702,19 +577,6 @@ void SfxBindings::SetState
(
const SfxItemSet& rSet // zu setzende Status-Werte
)
-
-/* [Beschreibung]
-
- Diese Methode erlaubt das direkte Setzen neuer Status-Werte, ohne
- den Umweg "uber <SfxBindings::Invalidate()> und das dann im Update
- erfolgende Rufen der Status-Methoden an den <SfxShell>s.
-
-
- [Querverweise]
-
- <SfxBindings::SetState(const SfxPoolItem&)>
-*/
-
{
// wenn gelockt, dann nur invalidieren
if ( nRegLevel )
@@ -759,23 +621,6 @@ void SfxBindings::SetState
(
const SfxPoolItem& rItem // zu setzender Status-Wert
)
-
-/* [Beschreibung]
-
- Diese Methode erlaubt das direkte Setzen eines neuen Status-Wertes,
- ohne den Umweg "uber <SfxBindings::Invalidate()> und das dann im Update
- erfolgende Rufen der Status-Methoden an den <SfxShell>s.
-
- Mit dieser Methode k"onnen nur <SfxPoolItem>s mit Slot, nicht
- aber mit Which-Id gesetzt werden, da kein <SfxItemPool> bekannt ist,
- "uber den gemappt werden k"onnte.
-
-
- [Querverweise]
-
- <SfxBindings::SetState(const SfxItemSet&)>
-*/
-
{
if ( nRegLevel )
{
@@ -824,25 +669,6 @@ SfxStateCache* SfxBindings::GetStateCache
wurde, bzw. an der es einfef"ugt werden
w"urde. */
)
-
-/* [Beschreibung]
-
- Diese Methode sucht die zu einer Slot-Id geh"orige <SfxStatusCache>
- Instanz. Falls die Slot-Id in keinem Controller gebunden ist, wird
- ein 0-Pointer zur"uckgegeben.
-
- Falls pPos != 0, wird erst ab der Position mit der Suche angefangen.
- Dieses ist eine Optimierung, f"ur den Fall, da"s die kleineren
- Ids bereits abgearbeitet wurden.
-
- In *pPos wird der ::com::sun::star::sdbcx::Index innerhalb der SfxBindings zur"uckgegeben,
- unter dem dieser Cache z.Zt. abgelegt ist. Dieser ::com::sun::star::sdbcx::Index ist bis zum
- n"achsten Aufruf von <SfxBindings::EnterRegistrations()> g"ultig.
- W"ahrend der Umkonfiguration (<SfxBindings::IsInRegistrations()> == sal_True)
- kann ist der ::com::sun::star::sdbcx::Index und der R"uckgabewert nur sehr kurzfristig
- g"ultig.
-*/
-
{
DBG_MEMTEST();
DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" );
@@ -870,27 +696,6 @@ void SfxBindings::InvalidateAll
sal_False
Slot-Server bleiben g"ultig */
)
-
-/* [Beschreibung]
-
- Invalidiert alle <SfxControllerItem> Instanzen, die an dieser
- SfxBindings Instanz angemeldet sind, und bei bWithMsg == sal_True
- ebenfalls die <Slot-Server>-Caches.
-
- Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten
- beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden,
- bevor "uberhaupt etwas passiert.
-
-
- [Querverweise]
-
- <SfxShell::Invalidate(sal_uInt16)>
- <SfxBindings::Invalidate(sal_uInt16)>
- <SfxBindings::Invalidate(sal_uInt16*)>
- <SfxBindings::Update()>
- <SfxBindings::Update(sal_uInt16)>
-*/
-
{
DBG_PROFSTART(SfxBindingsInvalidateAll);
DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" );
@@ -942,26 +747,6 @@ void SfxBindings::Invalidate
const sal_uInt16* pIds /* numerisch sortiertes 0-terminiertes Array
von Slot-Ids (einzel, nicht als Paare!) */
)
-
-/* [Beschreibung]
-
- Invalidiert die <SfxControllerItem> Instanzen der Slot-Ids in 'pIds',
- die an dieser SfxBindings Instanz angemeldet sind.
-
- Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten
- beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden,
- bevor "uberhaupt etwas passiert.
-
-
- [Querverweise]
-
- <SfxShell::Invalidate(sal_uInt16)>
- <SfxBindings::Invalidate(sal_uInt16)>
- <SfxBindings::InvalidateAll(sal_uInt16)>
- <SfxBindings::Update()>
- <SfxBindings::Update(sal_uInt16)>
-*/
-
{
DBG_PROFSTART(SfxBindingsInvalidateAll);
// DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" );
@@ -1032,26 +817,6 @@ void SfxBindings::InvalidateShell
Slot-Ids werden invalidiert */
//! MI: z. Zt. immer bDeep
)
-
-/* [Beschreibung]
-
- Invalidiert alle <SfxControllerItem> Instanzen, die zur Zeit von
- der angegebenen SfxShell Instanz bedient werden und an dieser
- SfxBindings Instanz angemeldet sind
-
- Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten
- beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden,
- bevor "uberhaupt etwas passiert.
-
-
- [Querverweise]
-
- <SfxShell::Invalidate(sal_uInt16)>
- <SfxBindings::Invalidate(sal_uInt16)>
- <SfxBindings::Update()>
- <SfxBindings::Update(sal_uInt16)>
-*/
-
{
DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" );
@@ -1108,24 +873,6 @@ void SfxBindings::Invalidate
(
sal_uInt16 nId // zu invalidierende Slot-Id
)
-
-/* [Beschreibung]
-
- Invalidiert alle <SfxControllerItem> Instanzen, die auf die Slot-Id
- nId gebunden sind und an dieser SfxBindings Instanz angemeldet sind.
-
- Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten
- beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden,
- bevor "uberhaupt etwas passiert.
-
-
- [Querverweise]
- <SfxBindings::Invalidate(sal_uInt16*)>
- <SfxBindings::InvalidateAll(sal_Bool)>
- <SfxBindings::Update()>
- <SfxBindings::Update(sal_uInt16)>
-*/
-
{
DBG_MEMTEST();
// DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" );
@@ -1166,24 +913,6 @@ void SfxBindings::Invalidate
sal_Bool bWithItem, // StateCache clearen ?
sal_Bool bWithMsg // SlotServer neu holen ?
)
-
-/* [Beschreibung]
-
- Invalidiert alle <SfxControllerItem> Instanzen, die auf die Slot-Id
- nId gebunden sind und an dieser SfxBindings Instanz angemeldet sind,
- und bei bWithMsg == sal_True ebenfalls den <Slot-Server>-Cache.
-
- Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten
- beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden,
- bevor "uberhaupt etwas passiert.
-
- [Querverweise]
- <SfxBindings::Invalidate(sal_uInt16*)>
- <SfxBindings::InvalidateAll(sal_Bool)>
- <SfxBindings::Update()>
- <SfxBindings::Update(sal_uInt16)>
-*/
-
{
DBG_MEMTEST();
DBG_ASSERT( !pImp->bInUpdate, "SfxBindings::Invalidate while in update" );
@@ -1214,52 +943,9 @@ void SfxBindings::Invalidate
}
}
-void SfxBindings::Invalidate
-(
- sal_uInt16, // zu invalidierende Slot-Id
- sal_Bool // SlotServer neu holen ?
-)
-
-/* [Beschreibung]
-
- Invalidiert alle <SfxControllerItem> Instanzen, die auf die Slot-Id
- nId gebunden sind und an dieser SfxBindings Instanz angemeldet sind,
- und bei bWithMsg == sal_True ebenfalls den <Slot-Server>-Cache.
-
- Es wird daraufhin ein Timer gestartet, bei dessen Ablauf das Updaten
- beginnt. Somit k"onnen mehrere Invalidierungen vorgenommen werden,
- bevor "uberhaupt etwas passiert.
-
- [Querverweise]
- <SfxBindings::Invalidate(sal_uInt16*)>
- <SfxBindings::InvalidateAll(sal_Bool)>
- <SfxBindings::Update()>
- <SfxBindings::Update(sal_uInt16)>
-*/
-
-{
- DBG_ERROR( "Methode veraltet!" );
-}
-
//--------------------------------------------------------------------
sal_Bool SfxBindings::IsBound( sal_uInt16 nSlotId, sal_uInt16 nStartSearchAt )
-
-/* [Beschreibung]
-
- Stellt fest, ob die angegebene Slot-Id in einem <SfxControllerItem>
- gebunden ist, der an dieser SfxBindings Instanz angemeldet ist.
-
-
- [R"uckgabewert]
-
- sal_Bool sal_True
- Die angegeben Slot-Id ist gebunden.
-
- sal_False
- Die angegeben Slot-Id ist nicht gebunden.
-*/
-
{
DBG_MEMTEST();
DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" );
@@ -1269,14 +955,6 @@ sal_Bool SfxBindings::IsBound( sal_uInt16 nSlotId, sal_uInt16 nStartSearchAt )
//--------------------------------------------------------------------
sal_uInt16 SfxBindings::GetSlotPos( sal_uInt16 nId, sal_uInt16 nStartSearchAt )
-
-/* [Beschreibung]
-
- Ermittelt den ::com::sun::star::sdbcx::Index der angegebenen Slot-Id in den SfxBindings.
- Falls die Slot-Id nicht gebunden ist, wird der ::com::sun::star::sdbcx::Index zur"uckgegeben,
- an dem sie eingef"ugt w"urde.
-*/
-
{
DBG_MEMTEST();
DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" );
@@ -1471,30 +1149,6 @@ const SfxPoolItem* SfxBindings::ExecuteSynchron( sal_uInt16 nId, const SfxPoolIt
sal_Bool SfxBindings::Execute( sal_uInt16 nId, const SfxPoolItem** ppItems, sal_uInt16 nModi, SfxCallMode nCallMode,
const SfxPoolItem **ppInternalArgs )
-
-/* [Beschreibung]
-
- F"uhrt den Slot mit der Slot-Id nId "uber den <Slot-Server> Cache
- aus. Dies ist nur bei in dieser SfxBindings INstanz gebundenen
- Slot-Ids m"oglich.
-
-
- [R"uckgabewert]
-
- sal_Bool sal_True
- Das Execute wurde ausgef"uhrt.
-
- sal_False
- Das Execute konnte nicht ausgef"uhrt werden,
- weil der Slot entweder nicht zur Verf"ugung steht
- (in keiner aktiven <SfxShell> vorhanden oder
- disabled) ist oder der Anwender die Ausf"uhrung
- abgebrochen hat (Cancel in einem Dialog).
-
-
- [Querverweise]
- <SfxDispatcher>
-*/
{
DBG_MEMTEST();
DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" );
@@ -1716,13 +1370,6 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell
//--------------------------------------------------------------------
void SfxBindings::UpdateSlotServer_Impl()
-
-/* [Beschreibung]
-
- Interne Methode zum Updaten der Pointer auf die SlotServer
- nach <SfxBindings::InvalidateAll(sal_Bool)>.
-*/
-
{
DBG_PROFSTART(SfxBindingsUpdateServers);
DBG_MEMTEST();
@@ -1785,16 +1432,6 @@ SfxItemSet* SfxBindings::CreateSet_Impl
const SfxSlotServer** pMsgServer, // out: Slot-Server zu nId
SfxFoundCacheArr_Impl& rFound // out: Liste der Caches der Siblings
)
-
-/* [Beschreibung]
-
- Diese interne Methode sucht zu pCache die Slot-Ids, die von derselben
- Status-Methode bedient werden und ebenfalls gebunden und dirty sind.
- Es wird ein SfxItemSet zusammengestellt, das die Slot-Ids (oder falls
- vorhanden die mit dem Pool der Shell gemappten Which-Ids) enth"alt.
- Die Caches dieser Slots werden in pFoundCaches zur"uckgeliefert.
-*/
-
{
DBG_MEMTEST();
DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" );
@@ -1942,18 +1579,6 @@ void SfxBindings::UpdateControllers_Impl
const SfxPoolItem* pItem, // item to send to controller
SfxItemState eState // state of item
)
-
-/* [Beschreibung]
-
- Dieses ist eine Hilfsmethode f"ur NextJob_Impl mit der die SfxController,
- welche auf nSlotId gebunden sind, upgedated werden. Dabei wird der
- Wert aus dem SfxPoolItem unter dem Which-Wert nWhich aus dem Set rSet
- genommen.
-
- Falls zu rSlot Enum-Werte in der Slotmap eingetragen sind, und diese
- gebunden sind, werden sie ebenfalls upgedated.
-*/
-
{
DBG_ASSERT( !pFound->pSlot || SFX_KIND_ENUM != pFound->pSlot->GetKind(),
"direct update of enum slot isn't allowed" );
@@ -2059,13 +1684,6 @@ void SfxBindings::UpdateControllers_Impl
//--------------------------------------------------------------------
IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer )
-
-/* [Beschreibung]
-
- Die SfxController werden "uber einen Timer updated. Dieses ist der
- dazugeh"orige interne TimeOut-Handler.
- */
-
{
#ifdef DBG_UTIL
// on Windows very often C++ Exceptions (GPF etc.) are caught by MSVCRT or another MS library
@@ -2181,18 +1799,26 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer )
}
}
- // volatiles wieder von vorne starten
pImp->nMsgPos = 0;
- pImp->aTimer.SetTimeout(TIMEOUT_IDLE);
+
+ // check for volatile slots
+ bool bVolatileSlotsPresent = false;
for ( sal_uInt16 n = 0; n < nCount; ++n )
{
SfxStateCache* pCache = (*pImp->pCaches)[n];
const SfxSlotServer *pSlotServer = pCache->GetSlotServer(*pDispatcher, pImp->xProv);
- if ( pSlotServer &&
- pSlotServer->GetSlot()->IsMode(SFX_SLOT_VOLATILE) )
+ if ( pSlotServer && pSlotServer->GetSlot()->IsMode(SFX_SLOT_VOLATILE) )
+ {
pCache->Invalidate(sal_False);
+ bVolatileSlotsPresent = true;
+ }
}
+ if (bVolatileSlotsPresent)
+ pImp->aTimer.SetTimeout(TIMEOUT_IDLE);
+ else
+ pImp->aTimer.Stop();
+
// Update-Runde ist beendet
pImp->bInNextJob = sal_False;
Broadcast(SfxSimpleHint(SFX_HINT_UPDATEDONE));
@@ -2213,35 +1839,6 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer )
//--------------------------------------------------------------------
sal_uInt16 SfxBindings::EnterRegistrations(const char *pFile, int nLine)
-
-/* [Beschreibung]
-
- Die An- oder Abmeldung von <SfxControllerItem> Instanzen mu"s in
- EnterRegistrations() und LeaveRegistrations() geklammert werden.
- W"ahrend dieser Zeit erfolgen keine Udates der <SfxContollerItem>
- Instanzen (weder der alten noch der neu angemeldeten).
-
- [Parameter]
-
- pFile, nLine Dateiname und Zeilennummer der rufenden
- Methode (nur Debug)
-
- [R"uckgabewert]
-
- sal_uInt16 Level der Registrierung. Dieser kann in
- <SfxBindings::LeaveRegistrations(sal_uInt16)> als
- Parameter angegeben werden, um die Paarigkeit
- der EnterRegistrations() und LeaveRegistrations()
- zu pr"ufen.
-
-
- [Querverweise]
- <SfxBindings::IsInRegistrations()>
- <SfxBindings::Register(SfxControllerItem&)>
- <SfxBindings::Release(SfxControllerItem&)>
- <SfxBindings::LeaveRegistrations()>
-*/
-
{
(void)pFile;
(void)nLine;
@@ -2299,36 +1896,6 @@ sal_uInt16 SfxBindings::EnterRegistrations(const char *pFile, int nLine)
//--------------------------------------------------------------------
void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int nLine )
-
-/* [Beschreibung]
-
- Die An- oder Abmeldung von <SfxControllerItem> Instanzen mu"s in
- EnterRegistrations() und LeaveRegistrations() geklammert werden.
- W"ahrend dieser Zeit erfolgen keine Udates der <SfxContollerItem>
- Instanzen (weder der alten noch der neu angemeldeten).
-
-
- [Parameter]
-
- sal_uInt16 nLevel == USRT_MAX
- keine Paarigkeits-Pr"ufung f"ur diese Klammerung
-
-
- pFile, nLine Dateiname und Zeilennummer der rufenden
- Methode (nur Debug)
-
- < USHRT_MAX
- R"uckgabewert des zugeh"origen EnterRegistrations()
- zum pr"ufen der Paarigkeit.
-
-
- [Querverweise]
- <SfxBindings::IsInRegistrations()>
- <SfxBindings::Register(SfxControllerItem&)>
- <SfxBindings::Release(SfxControllerItem&)>
- <SfxBindings::EnterRegistrations()>
-*/
-
{
(void)nLevel; // unused variable
(void)pFile;
@@ -2428,26 +1995,6 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int
//--------------------------------------------------------------------
const SfxSlot* SfxBindings::GetSlot(sal_uInt16 nSlotId)
-
-/* [Beschreibung]
-
- Diese Methode liefert einen Pointer auf den zur Zeit gecacheten
- SfxSlot f"ur die angegebene Slot-Id.
-
-
- [R"uckgabewert]
-
- const <SfxSlot>* 0
- Falls die Slot-Id nicht gebunden ist oder
- ein solcher Slot momentan in keiner aktiven
- <SfxShell> vorhanden ist.
-
- != 0
- Falls die Slot-Id gebunden ist und ein solcher
- Slot momentan in einer aktiven <SfxShell>
- vorhanden ist.
-*/
-
{
DBG_MEMTEST();
DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" );
@@ -2466,17 +2013,6 @@ const SfxSlot* SfxBindings::GetSlot(sal_uInt16 nSlotId)
//--------------------------------------------------------------------
void SfxBindings::SetDispatcher( SfxDispatcher *pDisp )
-
-/* [Beschreibung]
-
- Setzt den zur Zeit von dieser SfxBindings Instanz zu verwendenden
- Dispatcher um.
-
- Falls sich der Dispatcher dadurch "andert, wird intern
- <SFxBindings::InvalidateAll(sal_Bool)> mit sal_True gerufen, also jegliche
- gecachete Information der Bindings weggeworfen.
-*/
-
{
SfxDispatcher *pOldDispat = pDispatcher;
if ( pDisp != pDispatcher )
@@ -2544,17 +2080,11 @@ void SfxBindings::SetDispatcher( SfxDispatcher *pDisp )
//--------------------------------------------------------------------
void SfxBindings::ClearCache_Impl( sal_uInt16 nSlotId )
-
-// interne Methode zum forwarden dieses Methodenaufrufs
-
{
GetStateCache(nSlotId)->ClearCache();
}
//--------------------------------------------------------------------
-
-// interne Methode zum Ansto\sen des Statusupdates
-
void SfxBindings::StartUpdate_Impl( sal_Bool bComplete )
{
if ( pImp->pSubBindings )
@@ -2571,18 +2101,6 @@ void SfxBindings::StartUpdate_Impl( sal_Bool bComplete )
//-------------------------------------------------------------------------
SfxItemState SfxBindings::QueryState( sal_uInt16 nSlot, SfxPoolItem* &rpState )
-/* [Beschreibung]
-
- Wird gerufen, um den Status f"ur 'nSlot' zu erfragen. Wenn der return
- value SFX_ITEM_SET ist, wird ein SfxPoolItem zur"uckgegeben, indem der
- rpState entsprechend gesetzt wird. Es findet dabei ein Eigent"umer"ubergang
- statt, d.h. die aufrufende Methode mu\s das Item l"oschen.
-
- Anmerkung: diese Methode ist sehr teuer und sollte nur gerufen werden,
- wenn kein Controller f"ur das Erfragen des Status angelegt werden kann oder
- der Status unbedingt sofort geliefert werden mu\s.
-*/
-
{
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDisp;
SfxStateCache *pCache = GetStateCache( nSlot );
@@ -2873,15 +2391,6 @@ BOOL SfxBindings::ExecuteCommand_Impl( const String& rCommand )
return FALSE;
}
-//REMOVE SfxConfigManager* SfxBindings::GetConfigManager( USHORT nType ) const
-//{
-//REMOVE SfxConfigManager *pMgr = pDispatcher->GetFrame()->GetObjectShell()->GetConfigManager();
-//REMOVE if ( pMgr && pMgr->HasConfigItem( nType ) )
-//REMOVE return pMgr;
-//REMOVE else
-// return SFX_APP()->GetConfigManager_Impl();
-//}
-
com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > SfxBindings::GetRecorder() const
{
return pImp->xRecorder;
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 6de52384a90c..484e953f1cf4 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -899,7 +899,7 @@ void SfxDocumentPage::ImplUpdateSignatures()
{
String s;
Sequence< security::DocumentSignatureInformation > aInfos;
- aInfos = xD->verifyDocumentContentSignatures( pMedium->GetLastCommitReadStorage_Impl(),
+ aInfos = xD->verifyDocumentContentSignatures( pMedium->GetZipStorageToSign_Impl(),
uno::Reference< io::XInputStream >() );
if( aInfos.getLength() > 1 )
{
@@ -1619,7 +1619,7 @@ CustomPropertiesWindow::CustomPropertiesWindow( Window* pParent, const ResId& rR
m_aValueEdit ( this, SfxResId( SFX_ED_PROPERTY_VALUE ) ),
m_aYesNoButton ( this, SfxResId( SFX_WIN_PROPERTY_YESNO ) ),
m_aRemoveButton ( this, SfxResId( SFX_PB_PROPERTY_REMOVE ) ),
-
+ m_nScrollPos (0),
m_aNumberFormatter( ::comphelper::getProcessServiceFactory(),
Application::GetSettings().GetLanguage() )
@@ -1676,6 +1676,8 @@ IMPL_LINK( CustomPropertiesWindow, RemoveHdl, CustomPropertiesRemoveButton*, pBu
}
}
}
+
+ m_aRemovedHdl.Call(0);
return 0;
}
@@ -1852,6 +1854,7 @@ void CustomPropertiesWindow::AddLine( const ::rtl::OUString& sName, Any& rAny )
Size aSize = (*pCurrent)->GetSizePixel();
Point aPos = (*pCurrent)->GetPosPixel();
aPos.Y() += nPos;
+ aPos.Y() += m_nScrollPos;
(*pNewCurrent)->SetPosSizePixel( aPos, aSize );
(*pNewCurrent)->Show();
pCurrent++;
@@ -1974,10 +1977,12 @@ void CustomPropertiesWindow::ClearAllLines()
delete pLine;
}
m_aCustomPropertiesLines.clear();
+ m_nScrollPos = 0;
}
void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos )
{
+ m_nScrollPos += nNewPos;
std::vector< CustomPropertyLine* >::iterator pIter;
for ( pIter = m_aCustomPropertiesLines.begin();
pIter != m_aCustomPropertiesLines.end(); ++pIter )
@@ -2141,6 +2146,7 @@ CustomPropertiesControl::CustomPropertiesControl( Window* pParent, const ResId&
XubString sTEST = m_aHeaderBar.GetItemText( HI_NAME );
m_aPropertiesWin.InitControls( &m_aHeaderBar, &m_aVertScroll );
+ m_aPropertiesWin.SetRemovedHdl( LINK( this, CustomPropertiesControl, RemovedHdl ) );
m_aVertScroll.SetRangeMin( 0 );
sal_Int32 nScrollOffset = m_aPropertiesWin.GetLineHeight();
@@ -2156,7 +2162,7 @@ CustomPropertiesControl::CustomPropertiesControl( Window* pParent, const ResId&
Link aScrollLink = LINK( this, CustomPropertiesControl, ScrollHdl );
m_aVertScroll.SetScrollHdl( aScrollLink );
- m_aVertScroll.SetEndScrollHdl( aScrollLink );
+// m_aVertScroll.SetEndScrollHdl( aScrollLink );
}
CustomPropertiesControl::~CustomPropertiesControl()
@@ -2176,10 +2182,20 @@ IMPL_LINK( CustomPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar )
return 0;
}
-void CustomPropertiesControl::AddLine( const ::rtl::OUString& sName, Any& rAny )
+IMPL_LINK( CustomPropertiesControl, RemovedHdl, void*, EMPTYARG )
+{
+ m_aVertScroll.SetRangeMax( m_aPropertiesWin.GetVisibleLineCount() + 1 );
+ if ( m_aPropertiesWin.GetOutputSizePixel().Height() < m_aPropertiesWin.GetVisibleLineCount() * m_aPropertiesWin.GetLineHeight() )
+ m_aVertScroll.DoScrollAction ( SCROLL_LINEUP );
+ return 0;
+}
+
+void CustomPropertiesControl::AddLine( const ::rtl::OUString& sName, Any& rAny, bool bInteractive )
{
m_aPropertiesWin.AddLine( sName, rAny );
m_aVertScroll.SetRangeMax( m_aPropertiesWin.GetVisibleLineCount() + 1 );
+ if ( bInteractive && m_aPropertiesWin.GetOutputSizePixel().Height() < m_aPropertiesWin.GetVisibleLineCount() * m_aPropertiesWin.GetLineHeight() )
+ m_aVertScroll.DoScroll( m_aPropertiesWin.GetVisibleLineCount() + 1 );
}
// class SfxCustomPropertiesPage -----------------------------------------
@@ -2200,7 +2216,7 @@ SfxCustomPropertiesPage::SfxCustomPropertiesPage( Window* pParent, const SfxItem
IMPL_LINK( SfxCustomPropertiesPage, AddHdl, PushButton*, EMPTYARG )
{
Any aAny;
- m_aPropertiesCtrl.AddLine( ::rtl::OUString(), aAny );
+ m_aPropertiesCtrl.AddLine( ::rtl::OUString(), aAny, true );
return 0;
}
@@ -2250,7 +2266,7 @@ void SfxCustomPropertiesPage::Reset( const SfxItemSet& rItemSet )
std::vector< CustomProperty* > aCustomProps = pInfoItem->GetCustomProperties();
for ( sal_uInt32 i = 0; i < aCustomProps.size(); i++ )
{
- m_aPropertiesCtrl.AddLine( aCustomProps[i]->m_sName, aCustomProps[i]->m_aValue );
+ m_aPropertiesCtrl.AddLine( aCustomProps[i]->m_sName, aCustomProps[i]->m_aValue, false );
}
}
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index f31ed1724907..cf7d04ef0875 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -236,7 +236,8 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
}
Window* pContentWindow = VCLUnoHelper::GetWindow(xWindow);
- pContentWindow->SetStyle( pContentWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
+ if ( pContentWindow )
+ pContentWindow->SetStyle( pContentWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
pTitleDockWindow->SetWrappedWindow(pContentWindow);
}
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index d8989c6a21ea..5a0d2f4a69a0 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -467,6 +467,31 @@ sal_Bool FileDialogHelper_Impl::isInOpenMode() const
// ------------------------------------------------------------------------
+namespace {
+
+bool lclCheckODFPasswordCapability( const SfxFilter* pFilter )
+{
+ return pFilter && pFilter->IsOwnFormat() && pFilter->UsesStorage() && (pFilter->GetVersion() >= SOFFICE_FILEFORMAT_60);
+}
+
+bool lclCheckMSPasswordCapability( const SfxFilter* pFilter )
+{
+ // TODO #i105076# this should be in the filter configuration!!!
+ return pFilter && CheckMSPasswordCapabilityForExport( pFilter->GetFilterName() );
+}
+
+bool lclCheckPasswordCapability( const SfxFilter* pFilter )
+{
+ return
+ lclCheckODFPasswordCapability( pFilter ) ||
+ // TODO #i105076# this should be in the filter configuration!!!
+ lclCheckMSPasswordCapability( pFilter );
+}
+
+}
+
+// ------------------------------------------------------------------------
+
void FileDialogHelper_Impl::updateFilterOptionsBox()
{
if ( !m_bHaveFilterOptions )
@@ -550,40 +575,6 @@ void FileDialogHelper_Impl::updateSelectionBox()
}
// ------------------------------------------------------------------------
-
-namespace {
-
-bool lclCheckMSPasswordCapability( const String rFilterName )
-{
- return rFilterName.EqualsAscii("MS Word 97");
-}
-
-} // namespace
-
-// ------------------------------------------------------------------------
-struct CheckPasswordCapability
-{
- sal_Bool operator() ( const SfxFilter* _pFilter )
- {
- if (!_pFilter)
- return false;
-
-#if 0 // to be enabled in the future
- if (_pFilter->GetFilterName().EqualsAscii("MS Excel 97"))
- // For now, we eanble password protection for Excel 97 as a
- // special case. If we start having more filters supporting
- // export encryption with password, we should probably switch to
- // using a filter flag instead.
- return true;
-#endif
-
- return ( _pFilter->IsOwnFormat() && _pFilter->UsesStorage()
- && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() ) )
- || lclCheckMSPasswordCapability( _pFilter->GetFilterName() );
- }
-};
-
-// ------------------------------------------------------------------------
void FileDialogHelper_Impl::enablePasswordBox( sal_Bool bInit )
{
if ( ! mbHasPassword )
@@ -593,7 +584,7 @@ void FileDialogHelper_Impl::enablePasswordBox( sal_Bool bInit )
mbIsPwdEnabled = updateExtendedControl(
ExtendedFilePickerElementIds::CHECKBOX_PASSWORD,
- CheckPasswordCapability()( getCurentSfxFilter() )
+ lclCheckPasswordCapability( getCurentSfxFilter() )
);
if( bInit )
@@ -1665,9 +1656,8 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
if( xInteractionHandler.is() )
{
- // TODO: find out a way to set the 1-15 char limits on MS Excel 97 filter.
-
- bool bMSType = lclCheckMSPasswordCapability( rFilter );
+ // TODO: need a save way to distinguish MS filters from other filters
+ bool bMSType = CheckMSPasswordCapabilityForExport( rFilter );
::comphelper::DocPasswordRequestType eType = bMSType ?
::comphelper::DocPasswordRequestType_MS :
::comphelper::DocPasswordRequestType_STANDARD;
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 23093bfa066f..32ae33ec3c8b 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -84,6 +84,7 @@
#include <unotools/tempfile.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
+#include <framework/interaction.hxx>
#include <unotools/streamhelper.hxx>
#include <unotools/localedatawrapper.hxx>
#ifndef _MSGBOX_HXX //autogen
@@ -106,6 +107,7 @@
#include <unotools/streamwrap.hxx>
#include <rtl/logfile.hxx>
+#include <osl/file.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -373,10 +375,9 @@ public:
uno::Sequence < util::RevisionTag > aVersions;
- ::utl::TempFile* pTempDir;
::utl::TempFile* pTempFile;
- uno::Reference < embed::XStorage > m_xReadStorage;
+ uno::Reference < embed::XStorage > m_xZipStorage;
Reference < XInputStream > xInputStream;
Reference < XStream > xStream;
@@ -452,7 +453,6 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP )
nFileVersion( 0 ),
pOrigFilter( 0 ),
aExpireTime( Date() + 10, Time() ),
- pTempDir( NULL ),
pTempFile( NULL ),
nLastStorageError( 0 ),
m_bRemoveBackup( sal_False ),
@@ -470,9 +470,6 @@ SfxMedium_Impl::~SfxMedium_Impl()
if ( pTempFile )
delete pTempFile;
-
- if ( pTempDir )
- delete pTempDir;
}
//================================================================
@@ -491,18 +488,6 @@ SfxMedium_Impl::~SfxMedium_Impl()
pOutStream( 0 )
//------------------------------------------------------------------
-/*
-const SvGlobalName& SfxMedium::GetClassFilter()
-{
- GetMedium_Impl();
- if( GetError() )
- return aFilterClass;
- if( !bSetFilter && GetStorage() )
- SetClassFilter( GetStorage()->GetClassName() );
- return aFilterClass;
-}*/
-
-//------------------------------------------------------------------
void SfxMedium::ResetError()
{
eError = SVSTREAM_OK;
@@ -557,15 +542,6 @@ sal_uInt32 SfxMedium::GetErrorCode() const
}
//------------------------------------------------------------------
-long SfxMedium::GetFileVersion() const
-{
- if ( !pImp->nFileVersion && pFilter )
- return pFilter->GetVersion();
- else
- return pImp->nFileVersion;
-}
-
-//------------------------------------------------------------------
void SfxMedium::CheckFileDate( const util::DateTime& aInitDate )
{
GetInitFileDate( sal_True );
@@ -665,6 +641,7 @@ Reference < XContent > SfxMedium::GetContent() const
return pImp->aContent.get();
}
+//------------------------------------------------------------------
::rtl::OUString SfxMedium::GetBaseURL( bool bForSaving )
{
::rtl::OUString aBaseURL;
@@ -703,7 +680,7 @@ SvStream* SfxMedium::GetInStream()
if ( pInStream )
return pInStream;
- if ( pImp->pTempFile || pImp->pTempDir )
+ if ( pImp->pTempFile )
{
pInStream = new SvFileStream( aName, nStorOpenMode );
@@ -747,7 +724,7 @@ void SfxMedium::CloseInStream_Impl()
if ( pInStream && !GetContent().is() )
{
- CreateTempFile();
+ CreateTempFile( sal_True );
return;
}
@@ -755,7 +732,7 @@ void SfxMedium::CloseInStream_Impl()
if ( pSet )
pSet->ClearItem( SID_INPUTSTREAM );
- CloseReadStorage_Impl();
+ CloseZipStorage_Impl();
pImp->xInputStream = uno::Reference< io::XInputStream >();
if ( !pOutStream )
@@ -775,8 +752,7 @@ SvStream* SfxMedium::GetOutStream()
{
// Create a temp. file if there is none because we always
// need one.
- if ( !pImp->pTempFile )
- CreateTempFile();
+ CreateTempFile( sal_False );
if ( pImp->pTempFile )
{
@@ -844,8 +820,7 @@ void SfxMedium::CreateFileStream()
GetInStream();
if( pInStream )
{
- if ( !pImp->pTempFile )
- CreateTempFile();
+ CreateTempFile( sal_False );
pImp->bIsTemp = sal_True;
CloseInStream_Impl();
}
@@ -942,82 +917,17 @@ sal_Bool SfxMedium::IsPreview_Impl()
}
//------------------------------------------------------------------
-sal_Bool SfxMedium::TryStorage()
-{
- GetStorage();
-
- if ( pImp->xStorage.is() )
- return sal_True;
-
- // this code will be removed when binary filter components are available!
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr( ::comphelper::getProcessServiceFactory() );
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XArchiver >
- xPacker( xSMgr->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.util.Archiver" ) ), ::com::sun::star::uno::UNO_QUERY );
-
- if( !xPacker.is() )
- return sal_False;
-
- // extract extra data
- ::rtl::OUString aPath = GetURLObject().PathToFileName();
- ::rtl::OUString aExtraData = xPacker->getExtraData( aPath );
- const ::rtl::OUString aSig1( DEFINE_CONST_UNICODE( "private:" ) );
- String aTmp( '?' );
- aTmp += String::CreateFromAscii("simpress");//pFilter->GetFilterContainer()->GetName();
- const ::rtl::OUString aSig2( aTmp );
- sal_Int32 nIndex1 = aExtraData.indexOf( aSig1 );
- sal_Int32 nIndex2 = aExtraData.indexOf( aSig2 );
-
- if( nIndex1 != 0 || nIndex2 == -1 )
- return sal_False;
-
- nIndex1 += aSig1.getLength();
- ::rtl::OUString aTempDoku = aExtraData.copy( nIndex1, nIndex2 - nIndex1 );
-
- // create a temp dir to unpack to
- pImp->pTempDir = new ::utl::TempFile( NULL, sal_True );
- pImp->pTempDir->EnableKillingFile( sal_True );
-
- // unpack all files to temp dir
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
- com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler();
- if (xInteractionHandler.is())
- {
- aArgs.realloc(1);
- aArgs.getArray()[0].Name = DEFINE_CONST_UNICODE( "InteractionHandler" );
- aArgs.getArray()[0].Value <<= xInteractionHandler ;
- }
- ::com::sun::star::uno::Sequence< ::rtl::OUString > files(0);
-
- if( !xPacker->unpack( pImp->pTempDir->GetURL(), aPath, files, aArgs ) )
- return sal_False;
-
- String aNewName = pImp->pTempDir->GetURL();
- aNewName += '/';
- aNewName += String( aTempDoku );
- CloseInStream_Impl();
- String aTemp;
- ::utl::LocalFileHelper::ConvertURLToPhysicalName( aNewName, aTemp );
- SetPhysicalName_Impl( aTemp );
- GetStorage();
-
- return pImp->xStorage.is();
-}
-
-//------------------------------------------------------------------
-sal_Bool SfxMedium::BasedOnOriginalFile_Impl()
-{
- return ( !pImp->pTempFile && !( aLogicName.Len() && pImp->m_bSalvageMode )
- && GetURLObject().GetMainURL( INetURLObject::NO_DECODE ).getLength()
- && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) )
- && ::utl::UCBContentHelper::IsDocument( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) );
-}
-
-//------------------------------------------------------------------
void SfxMedium::StorageBackup_Impl()
{
::ucbhelper::Content aOriginalContent;
Reference< ::com::sun::star::ucb::XCommandEnvironment > xDummyEnv;
- if ( BasedOnOriginalFile_Impl() && !pImp->m_aBackupURL.getLength()
+
+ sal_Bool bBasedOnOriginalFile = ( !pImp->pTempFile && !( aLogicName.Len() && pImp->m_bSalvageMode )
+ && GetURLObject().GetMainURL( INetURLObject::NO_DECODE ).getLength()
+ && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) )
+ && ::utl::UCBContentHelper::IsDocument( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) );
+
+ if ( bBasedOnOriginalFile && !pImp->m_aBackupURL.getLength()
&& ::ucbhelper::Content::create( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, aOriginalContent ) )
{
DoInternalBackup_Impl( aOriginalContent );
@@ -1036,26 +946,6 @@ void SfxMedium::StorageBackup_Impl()
}
//------------------------------------------------------------------
-::rtl::OUString SfxMedium::GetOutputStorageURL_Impl()
-{
- String aStorageName;
-
- if ( aName.Len() )
- {
- if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aStorageName ) )
- {
- DBG_ERROR("Physical name not convertable!");
- }
- }
- else
- {
- aStorageName = GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
- }
-
- return aStorageName;
-}
-
-//------------------------------------------------------------------
uno::Reference < embed::XStorage > SfxMedium::GetOutputStorage()
{
if ( GetError() )
@@ -1231,24 +1121,38 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
if ( !bResult && !IsReadOnly() )
{
// check whether the file is readonly in fs
+ // the check is only necessary if
// do it only for loading, some contents still might have problems with this property, let them not affect the saving
sal_Bool bContentReadonly = sal_False;
- if ( bLoading )
+ if ( bLoading && ::utl::LocalFileHelper::IsLocalFile( aLogicName ) )
+ {
+ // let the stream be opened to check the possibility to open it for editing
+ GetMedium_Impl();
+ }
+
+ // "IsReadOnly" property does not allow to detect whether the file is readonly always
+ // so we try always to open the file for editing
+ // the file is readonly only in case the read-write stream can not be opened
+ SFX_ITEMSET_ARG( pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM, sal_False);
+ if ( bLoading && !pWriteStreamItem )
{
try
{
// MediaDescriptor does this check also, the duplication should be avoided in future
- pImp->aContent.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ) ) >>= bContentReadonly;
+ Reference< ::com::sun::star::ucb::XCommandEnvironment > xDummyEnv;
+ ::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
+ aContent.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ) ) >>= bContentReadonly;
}
catch( uno::Exception )
{}
}
+ // do further checks only if the file not readonly in fs
if ( !bContentReadonly )
{
+ // the special file locking should be used only for file URLs
if ( ::utl::LocalFileHelper::IsLocalFile( aLogicName ) )
{
- // the special file locking should be used only for file URLs
// in case of storing the document should request the output before locking
if ( bLoading )
@@ -1408,222 +1312,82 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
}
//------------------------------------------------------------------
-uno::Reference < embed::XStorage > SfxMedium::GetStorage()
+uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIfNo )
{
if ( pImp->xStorage.is() || bTriedStorage )
return pImp->xStorage;
uno::Sequence< uno::Any > aArgs( 2 );
- String aStorageName;
- if ( pImp->pTempFile || pImp->pTempDir )
- {
- // open storage from the temporary file
- if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aStorageName ) )
- {
- DBG_ERROR("Physical name not convertable!");
- }
+ // the medium should be retrieved before temporary file creation
+ // to let the MediaDescriptor be filled with the streams
+ GetMedium_Impl();
- CloseOutStream();
- // create the set of the streams based on the temporary file
- GetMedium_Impl();
+ if ( bCreateTempIfNo )
+ CreateTempFile( sal_False );
- OSL_ENSURE( pImp->xStream.is(), "It must be possible to create read write stream access!" );
- if ( pImp->xStream.is() )
- {
- aArgs[0] <<= pImp->xStream;
- pImp->bStorageBasedOnInStream = sal_True;
- }
- else
- {
- CloseStreams_Impl();
- aArgs[0] <<= ::rtl::OUString( aName );
- pImp->bStorageBasedOnInStream = sal_False;
- }
+ GetMedium_Impl();
- aArgs[1] <<= ( nStorOpenMode&STREAM_WRITE ? embed::ElementModes::READWRITE : embed::ElementModes::READ );
+ if ( GetError() )
+ return pImp->xStorage;
- try
- {
- pImp->xStorage = uno::Reference< embed::XStorage >(
- ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ),
- uno::UNO_QUERY );
- }
- catch( uno::Exception& )
- {
- //TODO/LATER: error handling; Error and LastStorageError
- }
- }
- else
+ SFX_ITEMSET_ARG( GetItemSet(), pRepairItem, SfxBoolItem, SID_REPAIRPACKAGE, sal_False);
+ if ( pRepairItem && pRepairItem->GetValue() )
{
- // open the storage from original location
- {
- GetMedium_Impl();
- if ( GetError() )
- return pImp->xStorage;
-
- try
- {
- if ( IsReadOnly() && ::utl::LocalFileHelper::IsLocalFile( aLogicName ) )
- {
- //TODO/LATER: performance problem if not controlled by special Mode in SfxMedium
- //(should be done only for permanently open storages)
- // create a copy, the following method will close all existing streams
- CreateTempFile();
-
- // create the set of the streams based on the temporary file
- GetMedium_Impl();
-
- OSL_ENSURE( pImp->xStream.is(), "It must be possible to create read write stream access!" );
- if ( pImp->xStream.is() )
- {
- aArgs[0] <<= pImp->xStream;
- pImp->bStorageBasedOnInStream = sal_True;
- }
- else
- {
- CloseStreams_Impl();
- aArgs[0] <<= ::rtl::OUString( aName );
- pImp->bStorageBasedOnInStream = sal_False;
- }
-
- aArgs[1] <<= embed::ElementModes::READWRITE;
-
- }
- else
- {
- // there is no explicit request to open the document readonly
-
- // create a storage on the stream
- if ( pImp->xStream.is() )
- {
- aArgs[0] <<= pImp->xStream;
- aArgs[1] <<= ( ( nStorOpenMode & STREAM_WRITE ) ?
- embed::ElementModes::READWRITE : embed::ElementModes::READ );
-
- pImp->bStorageBasedOnInStream = sal_True;
- }
- else
- {
- // no readwrite stream, but it can be a case of http protocol
- sal_Bool bReadOnly = sal_False;
-
- if ( aLogicName.CompareToAscii( "private:stream", 14 ) != COMPARE_EQUAL
- && GetContent().is() )
- {
- // unfortunately the content can not always have the interaction handler
- // so in some cases it has to be set for some time
- Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
- Reference < ::com::sun::star::ucb::XCommandEnvironment > xOldEnv;
- Reference < ::com::sun::star::task::XInteractionHandler > xInteractionHandler = ((SfxMedium*)this)->GetInteractionHandler();
- if ( xInteractionHandler.is() )
- xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler,
- Reference< ::com::sun::star::ucb::XProgressHandler >() );
-
- if ( xEnv.is() )
- {
- xOldEnv = pImp->aContent.getCommandEnvironment();
- pImp->aContent.setCommandEnvironment( xEnv );
- }
-
- try
- {
- Any aAny = pImp->aContent.getPropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsReadOnly" )) );
-
- if ( ( aAny >>= bReadOnly ) && bReadOnly )
- {
- GetItemSet()->Put( SfxBoolItem(SID_DOC_READONLY, sal_True));
- SetOpenMode( SFX_STREAM_READONLY, sal_False, sal_True );
- }
- }
- catch( uno::Exception& )
- {}
-
- if ( xEnv.is() )
- pImp->aContent.setCommandEnvironment( xOldEnv );
- }
-
- // if the document is opened as readonly the copy should be done according to selected approach
- // if the document is opened for editing the copy should be done to use it as a temporary location for changes before the final transfer
- // the following method will close all existing streams
- CreateTempFile();
-
- // create the set of the streams based on the temporary file
- GetMedium_Impl();
-
- OSL_ENSURE( pImp->xStream.is(), "It must be possible to create read write stream access!" );
- if ( pImp->xStream.is() )
- {
- aArgs[0] <<= pImp->xStream;
- pImp->bStorageBasedOnInStream = sal_True;
- }
- else
- {
- CloseStreams_Impl();
- aArgs[0] <<= ::rtl::OUString( aName );
- pImp->bStorageBasedOnInStream = sal_False;
- }
+ // the storage should be created for repairing mode
+ CreateTempFile( sal_False );
+ GetMedium_Impl();
- if ( bReadOnly )
- aArgs[1] <<= embed::ElementModes::READ;
- else
- aArgs[1] <<= embed::ElementModes::READWRITE;
- }
- }
+ Reference< ::com::sun::star::ucb::XProgressHandler > xProgressHandler;
+ Reference< ::com::sun::star::task::XStatusIndicator > xStatusIndicator;
- SFX_ITEMSET_ARG( GetItemSet(), pRepairItem, SfxBoolItem, SID_REPAIRPACKAGE, sal_False);
- if ( pRepairItem && pRepairItem->GetValue() )
- {
- // the storage should be created for repairing mode
- CreateTempFile();
- Reference< ::com::sun::star::ucb::XProgressHandler > xProgressHandler;
- Reference< ::com::sun::star::task::XStatusIndicator > xStatusIndicator;
-
- SFX_ITEMSET_ARG( GetItemSet(), pxProgressItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, sal_False );
- if( pxProgressItem && ( pxProgressItem->GetValue() >>= xStatusIndicator ) )
- xProgressHandler = Reference< ::com::sun::star::ucb::XProgressHandler >(
- new utl::ProgressHandlerWrap( xStatusIndicator ) );
-
- uno::Sequence< beans::PropertyValue > aAddProps( 2 );
- aAddProps[0].Name = ::rtl::OUString::createFromAscii( "RepairPackage" );
- aAddProps[0].Value <<= (sal_Bool)sal_True;
- aAddProps[1].Name = ::rtl::OUString::createFromAscii( "StatusIndicator" );
- aAddProps[1].Value <<= xProgressHandler;
-
- aArgs.realloc( 3 );
- aArgs[0] <<= ::rtl::OUString( aName );
- aArgs[1] <<= embed::ElementModes::READWRITE;
- aArgs[2] <<= aAddProps;
+ SFX_ITEMSET_ARG( GetItemSet(), pxProgressItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, sal_False );
+ if( pxProgressItem && ( pxProgressItem->GetValue() >>= xStatusIndicator ) )
+ xProgressHandler = Reference< ::com::sun::star::ucb::XProgressHandler >(
+ new utl::ProgressHandlerWrap( xStatusIndicator ) );
- pImp->bStorageBasedOnInStream = sal_False;
- }
+ uno::Sequence< beans::PropertyValue > aAddProps( 2 );
+ aAddProps[0].Name = ::rtl::OUString::createFromAscii( "RepairPackage" );
+ aAddProps[0].Value <<= (sal_Bool)sal_True;
+ aAddProps[1].Name = ::rtl::OUString::createFromAscii( "StatusIndicator" );
+ aAddProps[1].Value <<= xProgressHandler;
- pImp->xStorage = uno::Reference< embed::XStorage >(
- ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ),
- uno::UNO_QUERY );
+ // the first arguments will be filled later
+ aArgs.realloc( 3 );
+ aArgs[2] <<= aAddProps;
+ }
- if ( !pImp->xStorage.is() )
- throw uno::RuntimeException();
+ if ( pImp->xStream.is() )
+ {
+ // since the storage is based on temporary stream we open it always read-write
+ aArgs[0] <<= pImp->xStream;
+ aArgs[1] <<= embed::ElementModes::READWRITE;
+ pImp->bStorageBasedOnInStream = sal_True;
+ }
+ else if ( pImp->xInputStream.is() )
+ {
+ // since the storage is based on temporary stream we open it always read-write
+ aArgs[0] <<= pImp->xInputStream;
+ aArgs[1] <<= embed::ElementModes::READ;
+ pImp->bStorageBasedOnInStream = sal_True;
+ }
+ else
+ {
+ CloseStreams_Impl();
+ aArgs[0] <<= ::rtl::OUString( aName );
+ aArgs[1] <<= embed::ElementModes::READ;
+ pImp->bStorageBasedOnInStream = sal_False;
+ }
- if ( pRepairItem && pRepairItem->GetValue() )
- {
- // in repairing mode the mediatype required by filter should be used
- ::rtl::OUString aMediaType;
- ::rtl::OUString aMediaTypePropName( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) );
- uno::Reference < beans::XPropertySet > xPropSet( pImp->xStorage, uno::UNO_QUERY_THROW );
- xPropSet->getPropertyValue( aMediaTypePropName ) >>= aMediaType;
- if ( !aMediaType.getLength() && pFilter )
- xPropSet->setPropertyValue( aMediaTypePropName,
- uno::makeAny( ::rtl::OUString( pFilter->GetMimeType() ) ) );
- }
- }
- catch ( uno::Exception& )
- {
- //TODO/MBA: error handling; Error and LastStorageError
- pImp->bStorageBasedOnInStream = sal_False;
- }
- }
+ try
+ {
+ pImp->xStorage = uno::Reference< embed::XStorage >(
+ ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ),
+ uno::UNO_QUERY );
+ }
+ catch( uno::Exception& )
+ {
+ // impossibility to create the storage is no error
}
if( ( pImp->nLastStorageError = GetError() ) != SVSTREAM_OK )
@@ -1631,13 +1395,12 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage()
pImp->xStorage = 0;
if ( pInStream )
pInStream->Seek(0);
- return NULL;
+ return uno::Reference< embed::XStorage >();
}
bTriedStorage = sal_True;
- //TODO/MBA: error handling; Error and LastStorageError
- //if ( aStorage->GetError() == SVSTREAM_OK )
+ // TODO/LATER: Get versionlist on demand
if ( pImp->xStorage.is() )
{
SetPasswordToStorage_Impl();
@@ -1704,15 +1467,6 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage()
bResetStorage = TRUE;
}
- //TODO/MBA: error handling; Error and LastStorageError
- if ( pImp->xStorage.is() )
- { /*
- if( ( pImp->nLastStorageError = aStorage->GetError() ) != SVSTREAM_OK )
- bResetStorage = TRUE;
- else if ( GetFilter() )
- aStorage->SetVersion( GetFilter()->GetVersion() );*/
- }
-
if ( bResetStorage )
{
pImp->xStorage = 0;
@@ -1725,28 +1479,25 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage()
}
//------------------------------------------------------------------
-uno::Reference< embed::XStorage > SfxMedium::GetLastCommitReadStorage_Impl()
+uno::Reference< embed::XStorage > SfxMedium::GetZipStorageToSign_Impl( sal_Bool bReadOnly )
{
- if ( !GetError() && !pImp->m_xReadStorage.is() )
+ if ( !GetError() && !pImp->m_xZipStorage.is() )
{
+ // very careful!!!
+ // if bReadOnly == sal_False and there is no temporary file the original file might be used
GetMedium_Impl();
try
{
- if ( pImp->xInputStream.is() )
+ // we can not sign document if there is no stream
+ // should it be possible at all?
+ if ( !bReadOnly && pImp->xStream.is() )
{
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] <<= pImp->xInputStream;
- aArgs[1] <<= embed::ElementModes::READ;
- pImp->m_xReadStorage = uno::Reference< embed::XStorage >(
- ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ),
- uno::UNO_QUERY );
+ pImp->m_xZipStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( ZIP_STORAGE_FORMAT_STRING, pImp->xStream, embed::ElementModes::READWRITE );
}
- else if ( GetStorage().is() )
+ else if ( pImp->xInputStream.is() )
{
- uno::Reference< embed::XStorage > xTempStor = ::comphelper::OStorageHelper::GetTemporaryStorage();
- GetStorage()->copyLastCommitTo( xTempStor );
- pImp->m_xReadStorage = xTempStor;
+ pImp->m_xZipStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( ZIP_STORAGE_FORMAT_STRING, pImp->xInputStream );
}
}
catch( uno::Exception& )
@@ -1758,20 +1509,20 @@ uno::Reference< embed::XStorage > SfxMedium::GetLastCommitReadStorage_Impl()
ResetError();
}
- return pImp->m_xReadStorage;
+ return pImp->m_xZipStorage;
}
//------------------------------------------------------------------
-void SfxMedium::CloseReadStorage_Impl()
+void SfxMedium::CloseZipStorage_Impl()
{
- if ( pImp->m_xReadStorage.is() )
+ if ( pImp->m_xZipStorage.is() )
{
try {
- pImp->m_xReadStorage->dispose();
+ pImp->m_xZipStorage->dispose();
} catch( uno::Exception& )
{}
- pImp->m_xReadStorage = uno::Reference< embed::XStorage >();
+ pImp->m_xZipStorage = uno::Reference< embed::XStorage >();
}
}
@@ -1873,11 +1624,12 @@ sal_Bool SfxMedium::StorageCommit_Impl()
try
{
xTrans->commit();
- CloseReadStorage_Impl();
+ CloseZipStorage_Impl();
bResult = sal_True;
}
catch ( embed::UseBackupException& aBackupExc )
{
+ // since the temporary file is created always now, the scenario is close to be impossible
if ( !pImp->pTempFile )
{
OSL_ENSURE( pImp->m_aBackupURL.getLength(), "No backup on storage commit!\n" );
@@ -1924,9 +1676,6 @@ sal_Bool SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource,
Reference< XOutputStream > aDestStream;
::ucbhelper::Content aOriginalContent;
-// actualy it should work even for contents different from file content
-// DBG_ASSERT( ::utl::LocalFileHelper::IsLocalFile( aDest.GetMainURL( INetURLObject::NO_DECODE ) ),
-// "SfxMedium::TransactedTransferForFS() should be used only for local contents!" );
try
{
aOriginalContent = ::ucbhelper::Content( aDest.GetMainURL( INetURLObject::NO_DECODE ), xComEnv );
@@ -2229,57 +1978,10 @@ void SfxMedium::Transfer_Impl()
catch ( uno::Exception& )
{
//TODO/MBA: error handling
- //if ( !GetError() )
- // SetError( xStor->GetError(, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )) );
}
return;
}
- if ( pFilter && SOFFICE_FILEFORMAT_60 <= pFilter->GetVersion() )
- {
- //TODO/LATER: how?!
- /*
- SFX_ITEMSET_ARG( GetItemSet(), pItem, SfxBoolItem, SID_UNPACK, sal_False);
- if ( pItem && pItem->GetValue() )
- {
- // this file must be stored without packing into a JAR file
- // check for an existing unpacked storage
- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( GetName(), STREAM_STD_READ );
- if ( !pStream->GetError() )
- {
- String aURL = UCBStorage::GetLinkedFile( *pStream );
- if ( aURL.Len() )
- // remove a possibly existing old folder
- ::utl::UCBContentHelper::Kill( aURL );
-
- DELETEZ( pStream );
- }
-
- // create a new folder based storage
- SvStorageRef xStor = new SvStorage( TRUE, GetName(), STREAM_STD_READWRITE, STORAGE_CREATE_UNPACKED );
-
- // copy package into unpacked storage
- if ( xStor->GetError() == ERRCODE_NONE && GetStorage()->copyToStorage( xStor ) )
- {
- // commit changes, writing will happen now
- xStor->Commit();
-
- // take new unpacked storage as own storage
- if ( pImp->xStorage.is() )
- CloseStorage();
-
- CloseStreams_Impl();
-
- DELETEZ( pImp->pTempFile );
- ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aName );
- SetStorage_Impl( xStor );
- }
- else if ( !GetError() )
- SetError( xStor->GetError(, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )) );
- return;
- }*/
- }
-
INetURLObject aDest( GetURLObject() );
// source is the temp file written so far
@@ -2594,7 +2296,7 @@ void SfxMedium::GetMedium_Impl()
// in case the temporary file exists the streams should be initialized from it,
// but the original MediaDescriptor should not be changed
- sal_Bool bFromTempFile = ( pImp->pTempFile || pImp->pTempDir );
+ sal_Bool bFromTempFile = ( pImp->pTempFile != NULL );
if ( !bFromTempFile )
{
@@ -2691,54 +2393,6 @@ void SfxMedium::CancelTransfers()
pImp->xCancelManager->Cancel();
}
-//----------------------------------------------------------------
-/*
-String SfxMedium::GetStatusString( const SvProgressArg* pArg )
-{
- String aString;
- StringList_Impl aSL( SfxResId( RID_DLSTATUS2 ), (USHORT)pArg->eStatus );
- USHORT nTotal = 0;
-
- if ( pArg->eStatus == SVBINDSTATUS_ENDDOWNLOADDATA && nTotal <= 1 )
- return aString;
-
- if( aSL )
- {
- INetURLObject aObj( pArg->rStatus );
- aString = aSL.GetString();
- aString.SearchAndReplaceAscii( "$(HOST)", aObj.GetHost() );
- String aTarget = aObj.GetFull();
- if( aTarget.Len() <= 1 && pArg->eStatus != SVBINDSTATUS_CONNECTING )
- aTarget = aObj.GetHost();
- if( pArg->nMax )
- {
- aTarget += DEFINE_CONST_UNICODE( " (" );
- AddNumber_Impl( aTarget, pArg->nMax );
- aTarget += ')';
- }
-
- aString.SearchAndReplaceAscii( "$(TARGET)",aTarget );
- String aNumber;
- AddNumber_Impl( aNumber, pArg->nProgress );
- if( pArg->nRate )
- {
- aNumber+= DEFINE_CONST_UNICODE( " (" );
- AddNumber_Impl( aNumber, (ULONG)pArg->nRate );
- aNumber+= DEFINE_CONST_UNICODE( "/s)" );
- }
- if( pArg->nMax && pArg->nProgress && pArg->nMax != pArg->nProgress )
- {
- aNumber += DEFINE_CONST_UNICODE( " [" );
- float aPerc = pArg->nProgress / (float)pArg->nMax;
- aNumber += String::CreateFromInt32( (USHORT)(aPerc * 100) );
- aNumber += DEFINE_CONST_UNICODE( "%]" );
- }
- aString.SearchAndReplaceAscii( "$(BYTE)", aNumber );
- }
- return aString;
-}
-*/
-
sal_Bool SfxMedium::IsRemote()
{
return bRemote;
@@ -2898,7 +2552,7 @@ SfxMedium::SfxMedium( const SfxMedium& rMedium, sal_Bool bTemporary )
pFilter = rMedium.pFilter;
Init_Impl();
if( bTemporary )
- CreateTempFile();
+ CreateTempFile( sal_True );
}
//------------------------------------------------------------------
@@ -2977,7 +2631,7 @@ void SfxMedium::Close()
const SvStream *pStream = aStorage->GetSvStream();
if ( pStream && pStream == pInStream )
{
- CloseReadStorage_Impl();
+ CloseZipStorage_Impl();
pInStream = NULL;
pImp->xInputStream = Reference < XInputStream >();
pImp->xLockBytes.Clear();
@@ -3010,7 +2664,7 @@ void SfxMedium::CloseAndRelease()
const SvStream *pStream = aStorage->GetSvStream();
if ( pStream && pStream == pInStream )
{
- CloseReadStorage_Impl();
+ CloseZipStorage_Impl();
pInStream = NULL;
pImp->xInputStream = Reference < XInputStream >();
pImp->xLockBytes.Clear();
@@ -3050,7 +2704,7 @@ void SfxMedium::UnlockFile()
void SfxMedium::CloseAndReleaseStreams_Impl()
{
- CloseReadStorage_Impl();
+ CloseZipStorage_Impl();
uno::Reference< io::XInputStream > xInToClose = pImp->xInputStream;
uno::Reference< io::XOutputStream > xOutToClose;
@@ -3172,26 +2826,6 @@ void SfxMedium::SetPhysicalName_Impl( const String& rNameP )
}
}
-//----------------------------------------------------------------
-void SfxMedium::MoveTempTo_Impl( SfxMedium* pMedium )
-{
- if ( pMedium && pMedium != this && pImp->pTempFile )
- {
- if( pMedium->pImp->pTempFile )
- delete pMedium->pImp->pTempFile;
- pMedium->pImp->pTempFile = pImp->pTempFile;
-
- pImp->pTempFile->EnableKillingFile( sal_True );
- pImp->pTempFile = NULL;
-
- pMedium->aName = pMedium->pImp->pTempFile->GetFileName();
-
- pMedium->CloseInStream();
- pMedium->CloseStorage();
- pMedium->pImp->aContent = ::ucbhelper::Content();
- }
-}
-
//------------------------------------------------------------------
void SfxMedium::SetTemporary( sal_Bool bTemp )
{
@@ -3395,22 +3029,15 @@ SfxMedium::~SfxMedium()
delete pURLObj;
delete pImp;
}
-//------------------------------------------------------------------
+//------------------------------------------------------------------
void SfxMedium::SetItemSet(SfxItemSet *pNewSet)
{
delete pSet;
pSet = pNewSet;
}
-//------------------------------------------------------------------
-void SfxMedium::SetClassFilter( const SvGlobalName & rFilterClass )
-{
- bSetFilter = sal_True;
- aFilterClass = rFilterClass;
-}
//----------------------------------------------------------------
-
const INetURLObject& SfxMedium::GetURLObject() const
{
if( !pURLObj )
@@ -3743,131 +3370,122 @@ sal_Bool SfxMedium::IsReadOnly()
}
//----------------------------------------------------------------
-void SfxMedium::TryToSwitchToRepairedTemp()
+sal_Bool SfxMedium::SetWritableForUserOnly( const ::rtl::OUString& aURL )
{
- // the medium should be opened in repair mode
- SFX_ITEMSET_ARG( GetItemSet(), pRepairItem, SfxBoolItem, SID_REPAIRPACKAGE, FALSE );
- if ( pRepairItem && pRepairItem->GetValue() )
+ // UCB does not allow to allow write access only for the user,
+ // use osl API
+ sal_Bool bResult = sal_False;
+
+ ::osl::DirectoryItem aDirItem;
+ if ( ::osl::DirectoryItem::get( aURL, aDirItem ) == ::osl::FileBase::E_None )
{
- DBG_ASSERT( pImp->xStorage.is(), "Possible performance problem" );
- if ( GetStorage().is() )
+ ::osl::FileStatus aFileStatus( FileStatusMask_Attributes );
+ if ( aDirItem.getFileStatus( aFileStatus ) == osl::FileBase::E_None
+ && aFileStatus.isValid( FileStatusMask_Attributes ) )
{
- ::utl::TempFile* pTmpFile = new ::utl::TempFile();
- pTmpFile->EnableKillingFile( sal_True );
- ::rtl::OUString aNewName = pTmpFile->GetFileName();
-
- if( aNewName.getLength() )
- {
- try
- {
- uno::Reference < embed::XStorage > xNewStorage = comphelper::OStorageHelper::GetStorageFromURL( aNewName,
- embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
- //SvStorageRef aNewStorage = new SvStorage( sal_True, aNewName, STREAM_WRITE | STREAM_TRUNC, STORAGE_TRANSACTED );
+ sal_uInt64 nAttributes = aFileStatus.getAttributes();
- pImp->xStorage->copyToStorage( xNewStorage );
- //if ( aNewStorage->GetError() == SVSTREAM_OK )
- {
- CloseInStream();
- CloseStorage();
- if ( pImp->pTempFile )
- DELETEZ( pImp->pTempFile );
-
- pImp->pTempFile = pTmpFile;
- aName = aNewName;
- }
- }
- catch ( uno::Exception& )
- {
- //TODO/MBA: error handling
- //SetError( aNewStorage->GetError(, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )) );
- }
- }
- else
- SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ nAttributes &= ~(Attribute_OwnWrite |
+ Attribute_GrpWrite |
+ Attribute_OthWrite |
+ Attribute_ReadOnly);
+ nAttributes |= Attribute_OwnWrite;
- if (pImp->pTempFile != pTmpFile)
- delete pTmpFile;
+ bResult = ( osl::File::setAttributes( aURL, nAttributes ) == ::osl::FileBase::E_None );
}
- else
- SetError( ERRCODE_IO_CANTREAD, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
+
+ return bResult;
}
//----------------------------------------------------------------
-void SfxMedium::CreateTempFile()
+void SfxMedium::CreateTempFile( sal_Bool bReplace )
{
if ( pImp->pTempFile )
{
+ if ( !bReplace )
+ return;
+
DELETEZ( pImp->pTempFile );
aName = String();
}
- StreamMode nOpenMode = nStorOpenMode;
- BOOL bCopy = ( nStorOpenMode == nOpenMode && ! ( nOpenMode & STREAM_TRUNC ) );
- if ( bCopy && !pInStream )
- {
- if ( GetContent().is() )
- {
- try
- {
- // make sure that the desired file exists before trying to open
- SvMemoryStream aStream(0,0);
- ::utl::OInputStreamWrapper* pInput = new ::utl::OInputStreamWrapper( aStream );
- Reference< XInputStream > xInput( pInput );
-
- InsertCommandArgument aInsertArg;
- aInsertArg.Data = xInput;
-
- aInsertArg.ReplaceExisting = sal_False;
- Any aCmdArg;
- aCmdArg <<= aInsertArg;
- pImp->aContent.executeCommand( ::rtl::OUString::createFromAscii( "insert" ), aCmdArg );
- }
- catch ( Exception& )
- {
- // it is NOT an error when the stream already exists!
- GetInStream();
- }
- }
- }
-
- nStorOpenMode = nOpenMode;
- ResetError();
-
pImp->pTempFile = new ::utl::TempFile();
pImp->pTempFile->EnableKillingFile( sal_True );
aName = pImp->pTempFile->GetFileName();
- if ( !aName.Len() )
+ ::rtl::OUString aTmpURL = pImp->pTempFile->GetURL();
+ if ( !aName.Len() || !aTmpURL.getLength() )
{
SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
return;
}
- if ( bCopy && pInStream )
+ if ( !( nStorOpenMode & STREAM_TRUNC ) )
{
- GetOutStream();
- if ( pOutStream )
+ if ( GetContent().is()
+ && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) )
+ && ::utl::UCBContentHelper::IsDocument( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
{
- char *pBuf = new char [8192];
- sal_uInt32 nErr = ERRCODE_NONE;
-
- pInStream->Seek(0);
- pOutStream->Seek(0);
+ // if there is already such a document, we should copy it
+ // if it is a file system use OS copy process
+ sal_Bool bTransferSuccess = sal_False;
+ try
+ {
+ uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > xComEnv;
+ INetURLObject aTmpURLObj( aTmpURL );
+ ::rtl::OUString aFileName = aTmpURLObj.getName( INetURLObject::LAST_SEGMENT,
+ true,
+ INetURLObject::DECODE_WITH_CHARSET );
+ if ( aFileName.getLength() && aTmpURLObj.removeSegment() )
+ {
+ ::ucbhelper::Content aTargetContent( aTmpURLObj.GetMainURL( INetURLObject::NO_DECODE ), xComEnv );
+ if ( aTargetContent.transferContent( pImp->aContent, ::ucbhelper::InsertOperation_COPY, aFileName, NameClash::OVERWRITE ) )
+ {
+ SetWritableForUserOnly( aTmpURL );
+ bTransferSuccess = sal_True;
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {}
- while( !pInStream->IsEof() && nErr == ERRCODE_NONE )
+ if ( !bTransferSuccess )
{
- sal_uInt32 nRead = pInStream->Read( pBuf, 8192 );
- nErr = pInStream->GetError();
- pOutStream->Write( pBuf, nRead );
+ SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ return;
}
- delete[] pBuf;
+ CloseOutStream();
CloseInStream();
}
- CloseOutStream_Impl();
+ else if ( pInStream )
+ {
+ // the case when there is no URL-access available or this is a remote protocoll
+ // but there is an input stream
+ GetOutStream();
+ if ( pOutStream )
+ {
+ char *pBuf = new char [8192];
+ sal_uInt32 nErr = ERRCODE_NONE;
+
+ pInStream->Seek(0);
+ pOutStream->Seek(0);
+
+ while( !pInStream->IsEof() && nErr == ERRCODE_NONE )
+ {
+ sal_uInt32 nRead = pInStream->Read( pBuf, 8192 );
+ nErr = pInStream->GetError();
+ pOutStream->Write( pBuf, nRead );
+ }
+
+ delete[] pBuf;
+ CloseInStream();
+ }
+ CloseOutStream_Impl();
+ }
+ else
+ CloseInStream();
}
- else
- CloseInStream();
CloseStorage();
}
@@ -3875,6 +3493,7 @@ void SfxMedium::CreateTempFile()
//----------------------------------------------------------------
void SfxMedium::CreateTempFileNoCopy()
{
+ // this call always replaces the existing temporary file
if ( pImp->pTempFile )
delete pImp->pTempFile;
@@ -3932,100 +3551,120 @@ void SfxMedium::SetCharset( ::rtl::OUString aChs )
pImp->aCharset = aChs;
}
-sal_Bool SfxMedium::SignContents_Impl( sal_Bool bScriptingContent )
+sal_Bool SfxMedium::SignContents_Impl( sal_Bool bScriptingContent, const ::rtl::OUString& aODFVersion, sal_Bool bHasValidDocumentSignature )
{
- DBG_ASSERT( GetStorage().is(), "SfxMedium::SignContents_Impl - Storage doesn't exist!" );
-
sal_Bool bChanges = FALSE;
- ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures > xD(
- comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), ::com::sun::star::uno::UNO_QUERY );
-
- // TODO/LATER: error handling
- if ( xD.is() && GetStorage().is() )
+ // the medium should be closed to be able to sign, the caller is responsible to close it
+ if ( !IsOpen() && !GetError() )
{
- sal_Int32 nEncrMode = IsReadOnly() ? embed::ElementModes::READ
- : embed::ElementModes::READWRITE;
+ // The component should know if there was a valid document signature, since
+ // it should show a warning in this case
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[0] <<= aODFVersion;
+ aArgs[1] <<= bHasValidDocumentSignature;
+ ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures > xSigner(
+ comphelper::getProcessServiceFactory()->createInstanceWithArguments(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ),
+ aArgs ),
+ ::com::sun::star::uno::UNO_QUERY );
- try
+ if ( xSigner.is() )
{
- uno::Reference< embed::XStorage > xMetaInf = GetStorage()->openStorageElement(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) ),
- nEncrMode );
- if ( !xMetaInf.is() )
- throw uno::RuntimeException();
-
- if ( bScriptingContent )
+ uno::Reference< embed::XStorage > xWriteableZipStor;
+ if ( !IsReadOnly() )
{
- if ( !IsReadOnly() )
+ // we can reuse the temporary file if there is one already
+ CreateTempFile( sal_False );
+ GetMedium_Impl();
+
+ try
{
- uno::Reference< io::XStream > xStream = xMetaInf->openStreamElement(
- xD->getScriptingContentSignatureDefaultStreamName(),
- nEncrMode );
- if ( !xStream.is() )
+ if ( !pImp->xStream.is() )
throw uno::RuntimeException();
- try
+ xWriteableZipStor = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( ZIP_STORAGE_FORMAT_STRING, pImp->xStream );
+ if ( !xWriteableZipStor.is() )
+ throw uno::RuntimeException();
+
+ uno::Reference< embed::XStorage > xMetaInf = xWriteableZipStor->openStorageElement(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) ),
+ embed::ElementModes::READWRITE );
+ if ( !xMetaInf.is() )
+ throw uno::RuntimeException();
+
+ if ( bScriptingContent )
{
- // to leave the stream unencrypted as before
- uno::Reference< beans::XPropertySet > xStrmProps( xStream, uno::UNO_QUERY_THROW );
- xStrmProps->setPropertyValue(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" ) ),
- uno::makeAny( (sal_Bool)sal_False ) );
+ // If the signature has already the document signature it will be removed
+ // after the scripting signature is inserted.
+ uno::Reference< io::XStream > xStream(
+ xMetaInf->openStreamElement( xSigner->getScriptingContentSignatureDefaultStreamName(),
+ embed::ElementModes::READWRITE ),
+ uno::UNO_SET_THROW );
+
+ if ( xSigner->signScriptingContent( GetZipStorageToSign_Impl(), xStream ) )
+ {
+ // remove the document signature if any
+ ::rtl::OUString aDocSigName = xSigner->getDocumentContentSignatureDefaultStreamName();
+ if ( aDocSigName.getLength() && xMetaInf->hasByName( aDocSigName ) )
+ xMetaInf->removeElement( aDocSigName );
+
+ uno::Reference< embed::XTransactedObject > xTransact( xMetaInf, uno::UNO_QUERY_THROW );
+ xTransact->commit();
+ xTransact.set( xWriteableZipStor, uno::UNO_QUERY_THROW );
+ xTransact->commit();
+
+ // the temporary file has been written, commit it to the original file
+ Commit();
+ bChanges = TRUE;
+ }
}
- catch ( uno::Exception& )
- {}
-
- if ( xD->signScriptingContent( GetLastCommitReadStorage_Impl(), xStream ) )
+ else
{
- uno::Reference< embed::XTransactedObject > xTrans( xMetaInf, uno::UNO_QUERY );
- xTrans->commit();
- Commit();
- bChanges = TRUE;
+ uno::Reference< io::XStream > xStream(
+ xMetaInf->openStreamElement( xSigner->getDocumentContentSignatureDefaultStreamName(),
+ embed::ElementModes::READWRITE ),
+ uno::UNO_SET_THROW );
+
+ if ( xSigner->signDocumentContent( GetZipStorageToSign_Impl(), xStream ) )
+ {
+ uno::Reference< embed::XTransactedObject > xTransact( xMetaInf, uno::UNO_QUERY_THROW );
+ xTransact->commit();
+ xTransact.set( xWriteableZipStor, uno::UNO_QUERY_THROW );
+ xTransact->commit();
+
+ // the temporary file has been written, commit it to the original file
+ Commit();
+ bChanges = TRUE;
+ }
}
}
- else
- xD->showScriptingContentSignatures( GetLastCommitReadStorage_Impl(), uno::Reference< io::XInputStream >() );
+ catch ( uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "Couldn't use signing functionality!\n" );
+ }
+
+ CloseAndRelease();
}
else
{
- if ( !IsReadOnly() )
+ try
{
- uno::Reference< io::XStream > xStream = xMetaInf->openStreamElement(
- xD->getDocumentContentSignatureDefaultStreamName(),
- nEncrMode );
- if ( !xStream.is() )
- throw uno::RuntimeException();
-
- try
- {
- // to leave the stream unencrypted as before
- uno::Reference< beans::XPropertySet > xStrmProps( xStream, uno::UNO_QUERY_THROW );
- xStrmProps->setPropertyValue(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" ) ),
- uno::makeAny( (sal_Bool)sal_False ) );
- }
- catch ( uno::Exception& )
- {}
-
- if ( xD->signDocumentContent( GetLastCommitReadStorage_Impl(), xStream ) )
- {
- uno::Reference< embed::XTransactedObject > xTrans( xMetaInf, uno::UNO_QUERY );
- xTrans->commit();
- Commit();
- bChanges = TRUE;
- }
-
+ if ( bScriptingContent )
+ xSigner->showScriptingContentSignatures( GetZipStorageToSign_Impl(), uno::Reference< io::XInputStream >() );
+ else
+ xSigner->showDocumentContentSignatures( GetZipStorageToSign_Impl(), uno::Reference< io::XInputStream >() );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "Couldn't use signing functionality!\n" );
}
- else
- xD->showDocumentContentSignatures( GetLastCommitReadStorage_Impl(), uno::Reference< io::XInputStream >() );
}
}
- catch( uno::Exception& )
- {
- OSL_ENSURE( sal_False, "Couldn't use signing functionality!\n" );
- }
+
+ ResetError();
}
+
return bChanges;
}
@@ -4140,6 +3779,38 @@ BOOL SfxMedium::IsOpen() const
return aResult;
}
+sal_Bool SfxMedium::CallApproveHandler( const uno::Reference< task::XInteractionHandler >& xHandler, uno::Any aRequest, sal_Bool bAllowAbort )
+{
+ sal_Bool bResult = sal_False;
+
+ if ( xHandler.is() )
+ {
+ try
+ {
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( bAllowAbort ? 2 : 1 );
+
+ ::rtl::Reference< ::framework::ContinuationApprove > pApprove( new ::framework::ContinuationApprove() );
+ aContinuations[ 0 ] = pApprove.get();
+
+ if ( bAllowAbort )
+ {
+ ::rtl::Reference< ::framework::ContinuationAbort > pAbort( new ::framework::ContinuationAbort() );
+ aContinuations[ 1 ] = pAbort.get();
+ }
+
+ uno::Reference< task::XInteractionRequest > xRequest( new ::framework::InteractionRequest( aRequest, aContinuations ) );
+ xHandler->handle( xRequest );
+
+ bResult = pApprove->isSelected();
+ }
+ catch( const Exception& )
+ {
+ }
+ }
+
+ return bResult;
+}
+
::rtl::OUString SfxMedium::SwitchDocumentToTempFile()
{
// the method returns empty string in case of failure
@@ -4177,7 +3848,7 @@ BOOL SfxMedium::IsOpen() const
GetMedium_Impl();
LockOrigFileOnDemand( sal_False, sal_False );
- CreateTempFile();
+ CreateTempFile( sal_True );
GetMedium_Impl();
if ( pImp->xStream.is() )
@@ -4235,7 +3906,7 @@ sal_Bool SfxMedium::SwitchDocumentToFile( ::rtl::OUString aURL )
// open the temporary file based document
GetMedium_Impl();
LockOrigFileOnDemand( sal_False, sal_False );
- CreateTempFile();
+ CreateTempFile( sal_True );
GetMedium_Impl();
if ( pImp->xStream.is() )
diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx
index 929e486f824a..d8b6d23b8d03 100644
--- a/sfx2/source/doc/docfilt.cxx
+++ b/sfx2/source/doc/docfilt.cxx
@@ -52,6 +52,20 @@
using namespace ::com::sun::star;
+namespace sfx2 {
+
+// TODO #i105076# this should be in the filter configuration!!!
+bool CheckMSPasswordCapabilityForExport( const String& rFilterName )
+{
+ return
+ rFilterName.EqualsAscii( "MS Word 97" ) ||
+ rFilterName.EqualsAscii( "MS Word 97 Vorlage" ) ||
+ rFilterName.EqualsAscii( "MS Excel 97" ) ||
+ rFilterName.EqualsAscii( "MS Excel 97 Vorlage/Template" );
+}
+
+} // namespace sfx2
+
// STATIC DATA -----------------------------------------------------------
DBG_NAME(SfxFilter)
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index e56a65d3f551..f1b889821de7 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -33,6 +33,7 @@
#include "sfx2/docmacromode.hxx"
#include "sfx2/signaturestate.hxx"
+#include "sfx2/docfile.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/document/MacroExecMode.hpp>
@@ -85,14 +86,14 @@ namespace sfx2
//====================================================================
struct DocumentMacroMode_Data
{
- IMacroDocumentAccess& rDocumentAccess;
- sal_Bool bMacroDisabledMessageShown;
- sal_Bool bDocMacroDisabledMessageShown;
-
- DocumentMacroMode_Data( IMacroDocumentAccess& _rDocumentAccess )
- :rDocumentAccess( _rDocumentAccess )
- ,bMacroDisabledMessageShown( sal_False )
- ,bDocMacroDisabledMessageShown( sal_False )
+ IMacroDocumentAccess& m_rDocumentAccess;
+ sal_Bool m_bMacroDisabledMessageShown;
+ sal_Bool m_bDocMacroDisabledMessageShown;
+
+ DocumentMacroMode_Data( IMacroDocumentAccess& rDocumentAccess )
+ :m_rDocumentAccess( rDocumentAccess )
+ ,m_bMacroDisabledMessageShown( sal_False )
+ ,m_bDocMacroDisabledMessageShown( sal_False )
{
}
};
@@ -103,85 +104,37 @@ namespace sfx2
namespace
{
//................................................................
- /** calls the given interaction handler with the given interaction request, offering
- the two continuations "Approve" and "Abort"
-
- @return
- <TRUE/> if and only if the given handler handled the the request, and the "Approve"
- continuation was selected.
- */
- sal_Bool lcl_callInterActionHandler( const Reference< XInteractionHandler >& _rxHandler, const Any& _rRequest )
+ void lcl_showGeneralSfxErrorOnce( const Reference< XInteractionHandler >& rxHandler, const sal_Int32 nSfxErrorCode, sal_Bool& rbAlreadyShown )
{
- if ( !_rxHandler.is() )
- return sal_False;
-
- try
- {
- Sequence< Reference< XInteractionContinuation > > aContinuations(2);
-
- ::rtl::Reference< ::framework::ContinuationAbort > pAbort( new ::framework::ContinuationAbort() );
- aContinuations[ 0 ] = pAbort.get();
-
- ::rtl::Reference< ::framework::ContinuationApprove > pApprove( new ::framework::ContinuationApprove() );
- aContinuations[ 1 ] = pApprove.get();
-
- Reference< XInteractionRequest > xRequest( new ::framework::InteractionRequest( _rRequest, aContinuations ) );
- _rxHandler->handle( xRequest );
-
- if ( pApprove->isSelected() )
- return sal_True;
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return sal_False;
- }
-
- //................................................................
- void lcl_showGeneralSfxErrorOnce( const Reference< XInteractionHandler >& _rxHandler, const sal_Int32 _nSfxErrorCode, sal_Bool& _rbAlreadyShown )
- {
- if ( _rbAlreadyShown )
+ if ( rbAlreadyShown )
return;
ErrorCodeRequest aErrorCodeRequest;
- aErrorCodeRequest.ErrCode = _nSfxErrorCode;
-
- _rbAlreadyShown = lcl_callInterActionHandler( _rxHandler, makeAny( aErrorCodeRequest ) );
- }
+ aErrorCodeRequest.ErrCode = nSfxErrorCode;
- //................................................................
- void lcl_showMacrosDisabledError( const Reference< XInteractionHandler >& _rxHandler, sal_Bool& _rbAlreadyShown )
- {
- lcl_showGeneralSfxErrorOnce( _rxHandler, ERRCODE_SFX_MACROS_SUPPORT_DISABLED, _rbAlreadyShown );
+ SfxMedium::CallApproveHandler( rxHandler, makeAny( aErrorCodeRequest ), sal_False );
+ rbAlreadyShown = sal_True;
}
//................................................................
- void lcl_showDocumentMacrosDisabledError( const Reference< XInteractionHandler >& _rxHandler, sal_Bool& _rbAlreadyShown )
+ void lcl_showMacrosDisabledError( const Reference< XInteractionHandler >& rxHandler, sal_Bool& rbAlreadyShown )
{
- lcl_showGeneralSfxErrorOnce( _rxHandler, ERRCODE_SFX_DOCUMENT_MACRO_DISABLED, _rbAlreadyShown );
+ lcl_showGeneralSfxErrorOnce( rxHandler, ERRCODE_SFX_MACROS_SUPPORT_DISABLED, rbAlreadyShown );
}
//................................................................
- sal_Bool lcl_showMacroWarning( const Reference< XInteractionHandler >& _rxHandler,
- const ::rtl::OUString& _rDocumentLocation )
+ void lcl_showDocumentMacrosDisabledError( const Reference< XInteractionHandler >& rxHandler, sal_Bool& rbAlreadyShown )
{
- DocumentMacroConfirmationRequest aRequest;
- aRequest.DocumentURL = _rDocumentLocation;
- return lcl_callInterActionHandler( _rxHandler, makeAny( aRequest ) );
+ lcl_showGeneralSfxErrorOnce( rxHandler, ERRCODE_SFX_DOCUMENT_MACRO_DISABLED, rbAlreadyShown );
}
//................................................................
- sal_Bool lcl_showMacroWarning( const Reference< XInteractionHandler >& _rxHandler,
- const ::rtl::OUString& _rDocumentLocation, const Reference< XStorage >& _rxDocStor,
- const Sequence< DocumentSignatureInformation >& _rDocSigInfo )
+ sal_Bool lcl_showMacroWarning( const Reference< XInteractionHandler >& rxHandler,
+ const ::rtl::OUString& rDocumentLocation )
{
DocumentMacroConfirmationRequest aRequest;
- aRequest.DocumentURL = _rDocumentLocation;
- aRequest.DocumentStorage = _rxDocStor;
- aRequest.DocumentSignatureInformation = _rDocSigInfo;
- aRequest.Classification = InteractionClassification_QUERY;
- return lcl_callInterActionHandler( _rxHandler, makeAny( aRequest ) );
+ aRequest.DocumentURL = rDocumentLocation;
+ return SfxMedium::CallApproveHandler( rxHandler, makeAny( aRequest ), sal_True );
}
}
@@ -189,8 +142,8 @@ namespace sfx2
//= DocumentMacroMode
//====================================================================
//--------------------------------------------------------------------
- DocumentMacroMode::DocumentMacroMode( IMacroDocumentAccess& _rDocumentAccess )
- :m_pData( new DocumentMacroMode_Data( _rDocumentAccess ) )
+ DocumentMacroMode::DocumentMacroMode( IMacroDocumentAccess& rDocumentAccess )
+ :m_pData( new DocumentMacroMode_Data( rDocumentAccess ) )
{
}
@@ -202,26 +155,26 @@ namespace sfx2
//--------------------------------------------------------------------
sal_Bool DocumentMacroMode::allowMacroExecution()
{
- m_pData->rDocumentAccess.setCurrentMacroExecMode( MacroExecMode::ALWAYS_EXECUTE_NO_WARN );
+ m_pData->m_rDocumentAccess.setCurrentMacroExecMode( MacroExecMode::ALWAYS_EXECUTE_NO_WARN );
return sal_True;
}
//--------------------------------------------------------------------
sal_Bool DocumentMacroMode::disallowMacroExecution()
{
- m_pData->rDocumentAccess.setCurrentMacroExecMode( MacroExecMode::NEVER_EXECUTE );
+ m_pData->m_rDocumentAccess.setCurrentMacroExecMode( MacroExecMode::NEVER_EXECUTE );
return sal_False;
}
//--------------------------------------------------------------------
- sal_Bool DocumentMacroMode::adjustMacroMode( const Reference< XInteractionHandler >& _rxInteraction )
+ sal_Bool DocumentMacroMode::adjustMacroMode( const Reference< XInteractionHandler >& rxInteraction )
{
- sal_uInt16 nMacroExecutionMode = m_pData->rDocumentAccess.getCurrentMacroExecMode();
+ sal_uInt16 nMacroExecutionMode = m_pData->m_rDocumentAccess.getCurrentMacroExecMode();
if ( SvtSecurityOptions().IsMacroDisabled() )
{
// no macro should be executed at all
- lcl_showMacrosDisabledError( _rxInteraction, m_pData->bMacroDisabledMessageShown );
+ lcl_showMacrosDisabledError( rxInteraction, m_pData->m_bMacroDisabledMessageShown );
return disallowMacroExecution();
}
@@ -273,9 +226,10 @@ namespace sfx2
try
{
- ::rtl::OUString sReferrer( m_pData->rDocumentAccess.getDocumentLocation() );
+ ::rtl::OUString sReferrer( m_pData->m_rDocumentAccess.getDocumentLocation() );
// get document location from medium name and check whether it is a trusted one
+ // the service is created ohne document version, since it is not of interest here
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
Reference< XDocumentDigitalSignatures > xSignatures;
if ( aContext.createComponent( "com.sun.star.security.DocumentDigitalSignatures", xSignatures ) )
@@ -295,61 +249,35 @@ namespace sfx2
// at this point it is clear that the document is not in the secure location
if ( nMacroExecutionMode == MacroExecMode::FROM_LIST_NO_WARN )
{
- lcl_showDocumentMacrosDisabledError( _rxInteraction, m_pData->bDocMacroDisabledMessageShown );
+ lcl_showDocumentMacrosDisabledError( rxInteraction, m_pData->m_bDocMacroDisabledMessageShown );
return disallowMacroExecution();
}
// check whether the document is signed with trusted certificate
- if ( xSignatures.is() && nMacroExecutionMode != MacroExecMode::FROM_LIST )
+ if ( nMacroExecutionMode != MacroExecMode::FROM_LIST )
{
- Sequence< DocumentSignatureInformation > aScriptingSignatureInformations;
- Reference < XStorage > xStore( m_pData->rDocumentAccess.getLastCommitDocumentStorage() );
+ // the trusted macro check will also retrieve the signature state ( small optimization )
+ sal_Bool bHasTrustedMacroSignature = m_pData->m_rDocumentAccess.hasTrustedScriptingSignature( nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN );
- sal_uInt16 nSignatureState = m_pData->rDocumentAccess.getScriptingSignatureState();
+ sal_uInt16 nSignatureState = m_pData->m_rDocumentAccess.getScriptingSignatureState();
if ( nSignatureState == SIGNATURESTATE_SIGNATURES_BROKEN )
{
+ // the signature is broken, no macro execution
if ( nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN )
- {
- m_pData->rDocumentAccess.showBrokenSignatureWarning( _rxInteraction );
- return disallowMacroExecution();
- }
+ m_pData->m_rDocumentAccess.showBrokenSignatureWarning( rxInteraction );
+
+ return disallowMacroExecution();
}
- else
+ else if ( bHasTrustedMacroSignature )
{
- if ( ( ( nSignatureState == SIGNATURESTATE_SIGNATURES_OK )
- || ( nSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED )
- )
- && xStore.is()
- )
- {
- aScriptingSignatureInformations =
- xSignatures->verifyScriptingContentSignatures( xStore, NULL );
- }
+ // there is trusted macro signature, allow macro execution
+ return allowMacroExecution();
}
-
- sal_Int32 nNumOfInfos = aScriptingSignatureInformations.getLength();
-
- // from now on sReferrer is the system file path
- // sReferrer = INetURLObject::decode( sReferrer, '%', INetURLObject::DECODE_WITH_CHARSET );
- ::rtl::OUString aSystemFileURL;
- if ( osl::FileBase::getSystemPathFromFileURL( sReferrer, aSystemFileURL ) == osl::FileBase::E_None )
- sReferrer = aSystemFileURL;
-
- if ( nNumOfInfos )
+ else if ( nSignatureState == SIGNATURESTATE_SIGNATURES_OK
+ || nSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED )
{
- for ( sal_Int32 i = 0; i < nNumOfInfos; i++ )
- if ( xSignatures->isAuthorTrusted( aScriptingSignatureInformations[i].Signer ) )
- {
- // there's at least one author we trust which signed the doc
- return allowMacroExecution();
- }
-
- if ( nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN )
- {
- sal_Bool bApproved = lcl_showMacroWarning( _rxInteraction,
- sReferrer, xStore, aScriptingSignatureInformations );
- return ( bApproved ? allowMacroExecution() : disallowMacroExecution() );
- }
+ // there is valid signature, but it is not from the trusted author
+ return disallowMacroExecution();
}
}
@@ -359,9 +287,8 @@ namespace sfx2
)
{
if ( nMacroExecutionMode == MacroExecMode::FROM_LIST_AND_SIGNED_WARN )
- {
- lcl_showDocumentMacrosDisabledError( _rxInteraction, m_pData->bDocMacroDisabledMessageShown );
- }
+ lcl_showDocumentMacrosDisabledError( rxInteraction, m_pData->m_bDocMacroDisabledMessageShown );
+
return disallowMacroExecution();
}
}
@@ -381,13 +308,13 @@ namespace sfx2
if ( eAutoConfirm == eNoAutoConfirm )
{
- ::rtl::OUString sReferrer( m_pData->rDocumentAccess.getDocumentLocation() );
+ ::rtl::OUString sReferrer( m_pData->m_rDocumentAccess.getDocumentLocation() );
::rtl::OUString aSystemFileURL;
if ( osl::FileBase::getSystemPathFromFileURL( sReferrer, aSystemFileURL ) == osl::FileBase::E_None )
sReferrer = aSystemFileURL;
- bSecure = lcl_showMacroWarning( _rxInteraction, sReferrer );
+ bSecure = lcl_showMacroWarning( rxInteraction, sReferrer );
}
else
bSecure = ( eAutoConfirm == eAutoConfirmApprove );
@@ -398,7 +325,7 @@ namespace sfx2
//--------------------------------------------------------------------
sal_Bool DocumentMacroMode::isMacroExecutionDisallowed() const
{
- return m_pData->rDocumentAccess.getCurrentMacroExecMode() == MacroExecMode::NEVER_EXECUTE;
+ return m_pData->m_rDocumentAccess.getCurrentMacroExecMode() == MacroExecMode::NEVER_EXECUTE;
}
//--------------------------------------------------------------------
@@ -407,7 +334,7 @@ namespace sfx2
sal_Bool bHasMacroLib = sal_False;
try
{
- Reference< XEmbeddedScripts > xScripts( m_pData->rDocumentAccess.getEmbeddedDocumentScripts() );
+ Reference< XEmbeddedScripts > xScripts( m_pData->m_rDocumentAccess.getEmbeddedDocumentScripts() );
Reference< XLibraryContainer > xContainer;
if ( xScripts.is() )
xContainer.set( xScripts->getBasicLibraries(), UNO_QUERY_THROW );
@@ -457,21 +384,21 @@ namespace sfx2
}
//--------------------------------------------------------------------
- sal_Bool DocumentMacroMode::storageHasMacros( const Reference< XStorage >& _rxStorage )
+ sal_Bool DocumentMacroMode::storageHasMacros( const Reference< XStorage >& rxStorage )
{
sal_Bool bHasMacros = sal_False;
- if ( _rxStorage.is() )
+ if ( rxStorage.is() )
{
try
{
static const ::rtl::OUString s_sBasicStorageName( ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "Basic" ) ) );
static const ::rtl::OUString s_sScriptsStorageName( ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "Scripts" ) ) );
- bHasMacros =( ( _rxStorage->hasByName( s_sBasicStorageName )
- && _rxStorage->isStorageElement( s_sBasicStorageName )
+ bHasMacros =( ( rxStorage->hasByName( s_sBasicStorageName )
+ && rxStorage->isStorageElement( s_sBasicStorageName )
)
- || ( _rxStorage->hasByName( s_sScriptsStorageName )
- && _rxStorage->isStorageElement( s_sScriptsStorageName )
+ || ( rxStorage->hasByName( s_sScriptsStorageName )
+ && rxStorage->isStorageElement( s_sScriptsStorageName )
)
);
}
@@ -484,7 +411,7 @@ namespace sfx2
}
//--------------------------------------------------------------------
- sal_Bool DocumentMacroMode::checkMacrosOnLoading( const Reference< XInteractionHandler >& _rxInteraction )
+ sal_Bool DocumentMacroMode::checkMacrosOnLoading( const Reference< XInteractionHandler >& rxInteraction )
{
sal_Bool bAllow = sal_False;
if ( SvtSecurityOptions().IsMacroDisabled() )
@@ -494,9 +421,9 @@ namespace sfx2
}
else
{
- if ( m_pData->rDocumentAccess.documentStorageHasMacros() || hasMacroLibrary() )
+ if ( m_pData->m_rDocumentAccess.documentStorageHasMacros() || hasMacroLibrary() )
{
- bAllow = adjustMacroMode( _rxInteraction );
+ bAllow = adjustMacroMode( rxInteraction );
}
else if ( !isMacroExecutionDisallowed() )
{
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 7df93afaa63e..099e649506c0 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -72,6 +72,7 @@
#include "sfxurlrelocator.hxx"
#include "doctemplateslocal.hxx"
#include <sfx2/docfac.hxx>
+#include <sfx2/docfile.hxx>
#include "doc.hrc"
//-----------------------------------------------------------------------------
@@ -909,7 +910,8 @@ sal_Bool SfxDocTplService_Impl::CreateNewUniqueFolderWithPrefix( const ::rtl::OU
Content aParent;
- if ( Content::create( aDirPath.GetMainURL( INetURLObject::NO_DECODE ), maCmdEnv, aParent ) )
+ uno::Reference< XCommandEnvironment > aQuietEnv;
+ if ( Content::create( aDirPath.GetMainURL( INetURLObject::NO_DECODE ), aQuietEnv, aParent ) )
{
for ( sal_Int32 nInd = 0; nInd < 32000; nInd++ )
{
@@ -1919,7 +1921,11 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName,
aStoreArgs[1].Name = ::rtl::OUString::createFromAscii( "DocumentTitle" );
aStoreArgs[1].Value <<= rTemplateName;
- rStorable->storeToURL( aNewTemplateTargetURL, aStoreArgs );
+ ::rtl::OUString aCurrentDocumentURL = rStorable->getLocation();
+ if( !SfxMedium::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() ))
+ rStorable->storeToURL( aNewTemplateTargetURL, aStoreArgs );
+ else
+ rStorable->store();
// the storing was successful, now the old template with the same name can be removed if it existed
if ( aTemplateToRemoveTargetURL.getLength() )
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index f1e6cc80812e..bd0e65830870 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -374,32 +374,7 @@ sal_Bool GraphicHelper::createThumb_Impl( const GDIMetaFile& rMtf,
if ( aBmp.GetBitCount() != 24 )
aBmp.Convert( BMP_CONVERSION_24BIT );
- // create resulting mask bitmap with metafile output set to black
- GDIMetaFile aMonchromeMtf( rMtf.GetMonochromeMtf( COL_BLACK ) );
- aVDev.DrawWallpaper( Rectangle( aNullPt, aSizePix ), Wallpaper( Color( COL_WHITE ) ) );
- aMonchromeMtf.WindStart();
- aMonchromeMtf.Play( &aVDev, aBackPosPix, aDrawSize );
-
- // watch for overlay mask
- if ( pOverlay )
- {
- Bitmap aOverlayMergeBmp( aVDev.GetBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize() ) );
-
- // create ANDed resulting mask at overlay area
- if ( pOverlay->IsTransparent() )
- aVDev.DrawBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), pOverlay->GetMask() );
- else
- {
- aVDev.SetLineColor( COL_BLACK );
- aVDev.SetFillColor( COL_BLACK );
- aVDev.DrawRect( aOverlayRect);
- }
-
- aOverlayMergeBmp.CombineSimple( aVDev.GetBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize() ), BMP_COMBINE_AND );
- aVDev.DrawBitmap( aOverlayRect.TopLeft(), aOverlayRect.GetSize(), aOverlayMergeBmp );
- }
-
- rBmpEx = BitmapEx( aBmp, aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) );
+ rBmpEx = BitmapEx( aBmp );
}
return !rBmpEx.IsEmpty();
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index c46a467fa41d..5916fb625787 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -87,6 +87,8 @@
#include <sfxtypes.hxx>
#include "alienwarn.hxx"
+#include "../appl/app.hrc"
+
#define DOCPROPSNUM 17
// flags that specify requested operation
@@ -1227,7 +1229,8 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >&
const ::rtl::OUString& aSlotName,
uno::Sequence< beans::PropertyValue >& aArgsSequence,
sal_Bool bPreselectPassword,
- ::rtl::OUString aSuggestedName )
+ ::rtl::OUString aSuggestedName,
+ sal_uInt16 nDocumentSignatureState )
{
ModelData_Impl aModelData( *this, xModel, aArgsSequence );
@@ -1308,6 +1311,24 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >&
}
}
+ if ( !( nStoreMode & EXPORT_REQUESTED ) )
+ {
+ // if it is no export, warn user that the signature will be removed
+ if ( SIGNATURESTATE_SIGNATURES_OK == nDocumentSignatureState
+ || SIGNATURESTATE_SIGNATURES_INVALID == nDocumentSignatureState
+ || SIGNATURESTATE_SIGNATURES_NOTVALIDATED == nDocumentSignatureState
+ || SIGNATURESTATE_SIGNATURES_PARTIAL_OK == nDocumentSignatureState)
+ {
+ if ( QueryBox( NULL, SfxResId( RID_XMLSEC_QUERY_LOSINGSIGNATURE ) ).Execute() != RET_YES )
+ {
+ // the user has decided not to store the document
+ throw task::ErrorCodeIOException( ::rtl::OUString(),
+ uno::Reference< uno::XInterface >(),
+ ERRCODE_IO_ABORT );
+ }
+ }
+ }
+
// preselect a filter for the storing process
uno::Sequence< beans::PropertyValue > aFilterProps = aModelData.GetPreselectedFilter_Impl( nStoreMode );
diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk
index 4c893288ebb8..1b42844491e0 100644
--- a/sfx2/source/doc/makefile.mk
+++ b/sfx2/source/doc/makefile.mk
@@ -48,14 +48,13 @@ CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS)
SRS1NAME=$(TARGET)
SRC1FILES = \
- doc.src new.src doctdlg.src docvor.src doctempl.src sfxbasemodel.src graphhelp.src
+ doc.src new.src doctdlg.src docvor.src doctempl.src graphhelp.src
SLOFILES = \
$(SLO)$/printhelper.obj \
$(SLO)$/docinf.obj \
$(SLO)$/oleprops.obj \
$(SLO)$/iframe.obj \
- $(SLO)$/applet.obj \
$(SLO)$/plugin.obj \
$(SLO)$/docfile.obj \
$(SLO)$/objuno.obj \
@@ -90,6 +89,8 @@ SLOFILES = \
$(SLO)$/docstoragemodifylistener.obj \
$(SLO)$/querytemplate.obj
+# $(SLO)$/applet.obj \
+
# --- Tagets -------------------------------------------------------
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index 866c7b029cb5..f9c675372307 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -1383,54 +1383,6 @@ void SfxObjectShell::UpdateFromTemplate_Impl( )
}
}
-/*
-SfxEventConfigItem_Impl* SfxObjectShell::GetEventConfig_Impl( BOOL bForce )
-{
- if ( bForce && !pImp->pEventConfig )
- {
- pImp->pEventConfig = new SfxEventConfigItem_Impl( SFX_ITEMTYPE_DOCEVENTCONFIG,
- SFX_APP()->GetEventConfig(), this );
- if (pImp->pCfgMgr)
- pImp->pEventConfig->Connect( pImp->pCfgMgr );
- pImp->pEventConfig->Initialize();
- }
-
- return pImp->pEventConfig;
-} */
-
-//REMOVE SvStorageRef SfxObjectShell::GetConfigurationStorage( SotStorage* pStor )
-//REMOVE {
-//REMOVE // configuration storage shall be opened in own storage or a new storage, if the
-//REMOVE // document is getting stored into this storage
-//REMOVE if ( !pStor )
-//REMOVE pStor = GetStorage();
-//REMOVE
-//REMOVE if ( pStor->IsOLEStorage() )
-//REMOVE return (SvStorageRef) SotStorageRef();
-//REMOVE
-//REMOVE // storage is always opened in transacted mode, so changes must be commited
-//REMOVE SotStorageRef xStorage = pStor->OpenSotStorage( DEFINE_CONST_UNICODE("Configurations"),
-//REMOVE IsReadOnly() ? STREAM_STD_READ : STREAM_STD_READWRITE );
-//REMOVE if ( xStorage.Is() && xStorage->GetError() )
-//REMOVE xStorage.Clear();
-//REMOVE return (SvStorageRef) xStorage;
-//REMOVE }
-
-//REMOVE SotStorageStreamRef SfxObjectShell::GetConfigurationStream( const String& rName, BOOL bCreate )
-//REMOVE {
-//REMOVE SotStorageStreamRef xStream;
-//REMOVE SvStorageRef xStorage = GetConfigurationStorage();
-//REMOVE if ( xStorage.Is() )
-//REMOVE {
-//REMOVE xStream = xStorage->OpenSotStream( rName,
-//REMOVE bCreate ? STREAM_STD_READWRITE|STREAM_TRUNC : STREAM_STD_READ );
-//REMOVE if ( xStream.Is() && xStream->GetError() )
-//REMOVE xStream.Clear();
-//REMOVE }
-//REMOVE
-//REMOVE return xStream;
-//REMOVE }
-
SfxObjectShellRef MakeObjectShellForOrganizer_Impl( const String& aTargetURL, BOOL bForWriting )
{
// check for own format
diff --git a/sfx2/source/doc/objembed.cxx b/sfx2/source/doc/objembed.cxx
index 235451b8c3dd..7b7a1bea1ea0 100644
--- a/sfx2/source/doc/objembed.cxx
+++ b/sfx2/source/doc/objembed.cxx
@@ -136,7 +136,7 @@ void SfxObjectShell::SetVisArea( const Rectangle & rVisArea )
if ( IsEnableSetModified() )
SetModified( TRUE );
- SFX_APP()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, this));
+ SFX_APP()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(STR_EVENT_VISAREACHANGED), this));
/*
Size aSize (GetVisArea().GetSize());
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index bc0dd3762acd..efd3f04444ba 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -87,6 +87,8 @@
#include <comphelper/configurationhelper.hxx>
#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/task/DocumentMacroConfirmationRequest2.hpp>
+#include <com/sun/star/task/InteractionClassification.hpp>
#include <com/sun/star/frame/XModel.hpp>
using namespace ::com::sun::star;
@@ -120,6 +122,7 @@ using namespace ::com::sun::star::container;
#include <vcl/svapp.hxx>
#include <framework/interaction.hxx>
#include <comphelper/storagehelper.hxx>
+#include <comphelper/documentconstants.hxx>
#include <sfx2/signaturestate.hxx>
#include <sfx2/app.hxx>
@@ -285,8 +288,6 @@ sal_uInt32 SfxObjectShell::GetErrorCode() const
sal_uInt32 lError=pImp->lErr;
if(!lError && GetMedium())
lError=GetMedium()->GetErrorCode();
-//REMOVE if(!lError && HasStorage())
-//REMOVE lError= GetStorage()->GetErrorCode();
return lError;
}
@@ -301,9 +302,6 @@ void SfxObjectShell::ResetError()
SfxMedium * pMed = GetMedium();
if( pMed )
pMed->ResetError();
-//REMOVE SvStorage *pStor= HasStorage() ? GetStorage() : 0;
-//REMOVE if( pStor )
-//REMOVE pStor->ResetError();
}
//-------------------------------------------------------------------------
@@ -425,7 +423,7 @@ void SfxObjectShell::ModifyChanged()
Invalidate( SID_MACRO_SIGNATURE );
Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); // xmlsec05, signed state might change in title...
- SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_MODIFYCHANGED, this ) );
+ SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_MODIFYCHANGED, GlobalEventConfig::GetEventName(STR_EVENT_MODIFYCHANGED), this ) );
}
//-------------------------------------------------------------------------
@@ -1146,8 +1144,10 @@ void SfxObjectShell::PostActivateEvent_Impl( SfxViewFrame* pFrame )
{
sal_uInt16 nId = pImp->nEventId;
pImp->nEventId = 0;
- if ( nId )
- pSfxApp->NotifyEvent(SfxEventHint( nId, this ), sal_False);
+ if ( nId == SFX_EVENT_OPENDOC )
+ pSfxApp->NotifyEvent(SfxEventHint( nId, GlobalEventConfig::GetEventName(STR_EVENT_OPENDOC), this ), sal_False);
+ else if (nId == SFX_EVENT_CREATEDOC )
+ pSfxApp->NotifyEvent(SfxEventHint( nId, GlobalEventConfig::GetEventName(STR_EVENT_CREATEDOC), this ), sal_False);
}
}
}
@@ -1241,10 +1241,52 @@ void SfxObjectShell::CheckSecurityOnLoading_Impl()
if ( GetMedium() )
xInteraction = GetMedium()->GetInteractionHandler();
- // check macro security
- pImp->aMacroMode.checkMacrosOnLoading( xInteraction );
// check if there is a broken signature...
CheckForBrokenDocSignatures_Impl( xInteraction );
+
+ CheckEncryption_Impl( xInteraction );
+
+ // check macro security
+ pImp->aMacroMode.checkMacrosOnLoading( xInteraction );
+}
+
+//-------------------------------------------------------------------------
+void SfxObjectShell::CheckEncryption_Impl( const uno::Reference< task::XInteractionHandler >& xHandler )
+{
+ ::rtl::OUString aVersion;
+ sal_Bool bIsEncrypted = sal_False;
+ sal_Bool bHasNonEncrypted = sal_False;
+
+ try
+ {
+ uno::Reference < beans::XPropertySet > xPropSet( GetStorage(), uno::UNO_QUERY_THROW );
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= aVersion;
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasEncryptedEntries" ) ) ) >>= bIsEncrypted;
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasNonEncryptedEntries" ) ) ) >>= bHasNonEncrypted;
+ }
+ catch( uno::Exception& )
+ {
+ }
+
+ if ( aVersion.compareTo( ODFVER_012_TEXT ) >= 0 )
+ {
+ // this is ODF1.2 or later
+ if ( bIsEncrypted && bHasNonEncrypted )
+ {
+ if ( !pImp->m_bIncomplEncrWarnShown )
+ {
+ // this is an encrypted document with nonencrypted streams inside, show the warning
+ ::com::sun::star::task::ErrorCodeRequest aErrorCode;
+ aErrorCode.ErrCode = ERRCODE_SFX_INCOMPLETE_ENCRYPTION;
+
+ SfxMedium::CallApproveHandler( xHandler, uno::makeAny( aErrorCode ), sal_False );
+ pImp->m_bIncomplEncrWarnShown = sal_True;
+ }
+
+ // broken signatures imply no macro execution at all
+ pImp->aMacroMode.disallowMacroExecution();
+ }
+ }
}
//-------------------------------------------------------------------------
@@ -1399,7 +1441,7 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags )
}
pImp->bInitialized = sal_True;
- SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, this ) );
+ SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) );
// Title is not available until loading has finished
Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) );
@@ -1483,7 +1525,7 @@ void SfxObjectShell::TemplateDisconnectionAfterLoad()
{
// some further initializations for templates
SetTemplate_Impl( aName, aTemplateName, this );
- pTmpMedium->CreateTempFile();
+ pTmpMedium->CreateTempFile( sal_True );
}
// templates are never readonly
@@ -2093,14 +2135,16 @@ void SfxObjectShell::Invalidate( USHORT nId )
Invalidate_Impl( pFrame->GetBindings(), nId );
}
-bool SfxObjectShell::AdjustMacroMode( const String& /*rScriptType*/, bool _bSuppressUI )
+bool SfxObjectShell::AdjustMacroMode( const String& /*rScriptType*/, bool bSuppressUI )
{
uno::Reference< task::XInteractionHandler > xInteraction;
- if ( pMedium && !_bSuppressUI )
+ if ( pMedium && !bSuppressUI )
xInteraction = pMedium->GetInteractionHandler();
CheckForBrokenDocSignatures_Impl( xInteraction );
+ CheckEncryption_Impl( xInteraction );
+
return pImp->aMacroMode.adjustMacroMode( xInteraction );
}
@@ -2332,16 +2376,15 @@ sal_Bool SfxObjectShell_Impl::setCurrentMacroExecMode( sal_uInt16 nMacroMode )
return sLocation;
}
-uno::Reference< embed::XStorage > SfxObjectShell_Impl::getLastCommitDocumentStorage()
+uno::Reference< embed::XStorage > SfxObjectShell_Impl::getZipStorageToSign()
{
Reference < embed::XStorage > xStore;
SfxMedium* pMedium( rDocShell.GetMedium() );
OSL_PRECOND( pMedium, "SfxObjectShell_Impl::getLastCommitDocumentStorage: no medium!" );
if ( pMedium )
- {
- xStore = pMedium->GetLastCommitReadStorage_Impl();
- }
+ xStore = pMedium->GetZipStorageToSign_Impl();
+
return xStore;
}
@@ -2355,7 +2398,7 @@ Reference< XEmbeddedScripts > SfxObjectShell_Impl::getEmbeddedDocumentScripts()
return Reference< XEmbeddedScripts >( rDocShell.GetModel(), UNO_QUERY );
}
-sal_Int16 SfxObjectShell_Impl::getScriptingSignatureState() const
+sal_Int16 SfxObjectShell_Impl::getScriptingSignatureState()
{
sal_Int16 nSignatureState( rDocShell.GetScriptingSignatureState() );
@@ -2368,6 +2411,72 @@ sal_Int16 SfxObjectShell_Impl::getScriptingSignatureState() const
return nSignatureState;
}
+sal_Bool SfxObjectShell_Impl::hasTrustedScriptingSignature( sal_Bool bAllowUIToAddAuthor )
+{
+ sal_Bool bResult = sal_False;
+
+ try
+ {
+ ::rtl::OUString aVersion;
+ try
+ {
+ uno::Reference < beans::XPropertySet > xPropSet( rDocShell.GetStorage(), uno::UNO_QUERY_THROW );
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= aVersion;
+ }
+ catch( uno::Exception& )
+ {
+ }
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[0] <<= aVersion;
+
+ uno::Reference< security::XDocumentDigitalSignatures > xSigner( comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ), aArgs ), uno::UNO_QUERY_THROW );
+
+ if ( nScriptingSignatureState == SIGNATURESTATE_UNKNOWN
+ || nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_OK
+ || nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED )
+ {
+ uno::Sequence< security::DocumentSignatureInformation > aInfo = rDocShell.ImplAnalyzeSignature( sal_True, xSigner );
+
+ if ( aInfo.getLength() )
+ {
+ if ( nScriptingSignatureState == SIGNATURESTATE_UNKNOWN )
+ nScriptingSignatureState = rDocShell.ImplCheckSignaturesInformation( aInfo );
+
+ if ( nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_OK
+ || nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED )
+ {
+ for ( sal_Int32 nInd = 0; !bResult && nInd < aInfo.getLength(); nInd++ )
+ {
+ bResult = xSigner->isAuthorTrusted( aInfo[nInd].Signer );
+ }
+
+ if ( !bResult && bAllowUIToAddAuthor )
+ {
+ uno::Reference< task::XInteractionHandler > xInteraction;
+ if ( rDocShell.GetMedium() )
+ xInteraction = rDocShell.GetMedium()->GetInteractionHandler();
+
+ if ( xInteraction.is() )
+ {
+ task::DocumentMacroConfirmationRequest2 aRequest;
+ aRequest.DocumentURL = getDocumentLocation();
+ aRequest.DocumentZipStorage = rDocShell.GetMedium()->GetZipStorageToSign_Impl();
+ aRequest.DocumentSignatureInformation = aInfo;
+ aRequest.DocumentVersion = aVersion;
+ aRequest.Classification = task::InteractionClassification_QUERY;
+ bResult = SfxMedium::CallApproveHandler( xInteraction, uno::makeAny( aRequest ), sal_True );
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {}
+
+ return bResult;
+}
+
void SfxObjectShell_Impl::showBrokenSignatureWarning( const uno::Reference< task::XInteractionHandler >& _rxInteraction ) const
{
if ( !bSignatureErrorIsShown )
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index a47fc1bf4747..8a8512a37af0 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -525,16 +525,6 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
{
SfxErrorContext aEc( ERRCTX_SFX_SAVEASDOC, GetTitle() ); // ???
- // xmlsec05, check with SFX team
- sal_uInt16 nState = GetDocumentSignatureState();
- if ( SIGNATURESTATE_SIGNATURES_OK == nState
- || SIGNATURESTATE_SIGNATURES_INVALID == nState
- || SIGNATURESTATE_SIGNATURES_NOTVALIDATED == nState )
- {
- if ( QueryBox( NULL, SfxResId( RID_XMLSEC_QUERY_LOSINGSIGNATURE ) ).Execute() != RET_YES )
- return;
- }
-
if ( nId == SID_SAVEASDOC )
{
// in case of plugin mode the SaveAs operation means SaveTo
@@ -644,7 +634,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
::rtl::OUString::createFromAscii( pSlot->GetUnoName() ),
aDispatchArgs,
bPreselectPassword,
- GetSharedFileURL() );
+ GetSharedFileURL(),
+ GetDocumentSignatureState() );
}
else
{
@@ -654,11 +645,6 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
ERRCODE_IO_ABORT );
}
- // the scripting signature might be preserved
- // pImp->nScriptingSignatureState = SIGNATURESTATE_NOSIGNATURES;
- pImp->nDocumentSignatureState = SIGNATURESTATE_NOSIGNATURES;
- pImp->bSignatureErrorIsShown = sal_False;
-
// merge aDispatchArgs to the request
SfxAllItemSet aResultParams( GetPool() );
TransformParameters( nId,
@@ -1085,7 +1071,11 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
}
case SID_MACRO_SIGNATURE:
{
- rSet.Put( SfxUInt16Item( SID_MACRO_SIGNATURE, GetScriptingSignatureState() ) );
+ // the slot makes sense only if there is a macro in the document
+ if ( pImp->documentStorageHasMacros() || pImp->aMacroMode.hasMacroLibrary() )
+ rSet.Put( SfxUInt16Item( SID_MACRO_SIGNATURE, GetScriptingSignatureState() ) );
+ else
+ rSet.DisableItem( nWhich );
break;
}
}
@@ -1269,6 +1259,7 @@ sal_uInt16 SfxObjectShell::ImplCheckSignaturesInformation( const uno::Sequence<
sal_Bool bCertValid = sal_True;
sal_uInt16 nResult = SIGNATURESTATE_NOSIGNATURES;
int nInfos = aInfos.getLength();
+ bool bCompleteSignature = true;
if( nInfos )
{
//These errors of certificates are allowed
@@ -1293,11 +1284,14 @@ sal_uInt16 SfxObjectShell::ImplCheckSignaturesInformation( const uno::Sequence<
nResult = SIGNATURESTATE_SIGNATURES_BROKEN;
break; // we know enough
}
+ bCompleteSignature &= !aInfos[n].PartialDocumentSignature;
}
}
if ( nResult == SIGNATURESTATE_SIGNATURES_OK && !bCertValid )
nResult = SIGNATURESTATE_SIGNATURES_NOTVALIDATED;
+ else if ( nResult == SIGNATURESTATE_SIGNATURES_OK && bCertValid && !bCompleteSignature)
+ nResult = SIGNATURESTATE_SIGNATURES_PARTIAL_OK;
// this code must not check whether the document is modified
// it should only check the provided info
@@ -1305,41 +1299,61 @@ sal_uInt16 SfxObjectShell::ImplCheckSignaturesInformation( const uno::Sequence<
return nResult;
}
-sal_uInt16 SfxObjectShell::ImplGetSignatureState( sal_Bool bScriptingContent )
+uno::Sequence< security::DocumentSignatureInformation > SfxObjectShell::ImplAnalyzeSignature( sal_Bool bScriptingContent, const uno::Reference< security::XDocumentDigitalSignatures >& xSigner )
{
- sal_Int16* pState = bScriptingContent ? &pImp->nScriptingSignatureState : &pImp->nDocumentSignatureState;
+ uno::Sequence< security::DocumentSignatureInformation > aResult;
+ uno::Reference< security::XDocumentDigitalSignatures > xLocSigner = xSigner;
- if ( *pState == SIGNATURESTATE_UNKNOWN )
+ if ( GetMedium() && GetMedium()->GetName().Len() && IsOwnStorageFormat_Impl( *GetMedium()) && GetMedium()->GetStorage().is() )
{
- *pState = SIGNATURESTATE_NOSIGNATURES;
-
- if ( GetMedium() && GetMedium()->GetName().Len() && IsOwnStorageFormat_Impl( *GetMedium()) && GetMedium()->GetStorage().is() )
+ try
{
- try
+ if ( !xLocSigner.is() )
{
- uno::Reference< security::XDocumentDigitalSignatures > xD(
- comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), uno::UNO_QUERY );
-
- if ( xD.is() )
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[0] <<= ::rtl::OUString();
+ try
{
- ::com::sun::star::uno::Sequence< security::DocumentSignatureInformation > aInfos;
- if ( bScriptingContent )
- aInfos = xD->verifyScriptingContentSignatures( GetMedium()->GetLastCommitReadStorage_Impl(),
- uno::Reference< io::XInputStream >() );
- else
- aInfos = xD->verifyDocumentContentSignatures( GetMedium()->GetLastCommitReadStorage_Impl(),
- uno::Reference< io::XInputStream >() );
-
- *pState = ImplCheckSignaturesInformation( aInfos );
+ uno::Reference < beans::XPropertySet > xPropSet( GetStorage(), uno::UNO_QUERY_THROW );
+ aArgs[0] = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) );
}
+ catch( uno::Exception& )
+ {
+ }
+
+ xLocSigner.set( comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ), aArgs ), uno::UNO_QUERY_THROW );
+
}
- catch( com::sun::star::uno::Exception& )
- {
- }
+
+ if ( bScriptingContent )
+ aResult = xLocSigner->verifyScriptingContentSignatures( GetMedium()->GetZipStorageToSign_Impl(),
+ uno::Reference< io::XInputStream >() );
+ else
+ aResult = xLocSigner->verifyDocumentContentSignatures( GetMedium()->GetZipStorageToSign_Impl(),
+ uno::Reference< io::XInputStream >() );
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
}
}
- if ( *pState == SIGNATURESTATE_SIGNATURES_OK || *pState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED )
+ return aResult;
+}
+
+sal_uInt16 SfxObjectShell::ImplGetSignatureState( sal_Bool bScriptingContent )
+{
+ sal_Int16* pState = bScriptingContent ? &pImp->nScriptingSignatureState : &pImp->nDocumentSignatureState;
+
+ if ( *pState == SIGNATURESTATE_UNKNOWN )
+ {
+ *pState = SIGNATURESTATE_NOSIGNATURES;
+
+ uno::Sequence< security::DocumentSignatureInformation > aInfos = ImplAnalyzeSignature( bScriptingContent );
+ *pState = ImplCheckSignaturesInformation( aInfos );
+ }
+
+ if ( *pState == SIGNATURESTATE_SIGNATURES_OK || *pState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
+ || *pState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK)
{
if ( IsModified() )
*pState = SIGNATURESTATE_SIGNATURES_INVALID;
@@ -1386,7 +1400,7 @@ void SfxObjectShell::ImplSign( sal_Bool bScriptingContent )
{
// the document might need saving ( new, modified or in ODF1.1 format without signature )
- if ( nVersion == SvtSaveOptions::ODFVER_012 )
+ if ( nVersion >= SvtSaveOptions::ODFVER_012 )
{
if ( (bHasSign && QueryBox( NULL, SfxResId( MSG_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN ) ).Execute() == RET_YES)
@@ -1415,7 +1429,6 @@ void SfxObjectShell::ImplSign( sal_Bool bScriptingContent )
//When the document is modified then we must not show the digital signatures dialog
//If we have come here then the user denied to save.
if (!bHasSign)
-
bNoSig = true;
}
}
@@ -1437,18 +1450,42 @@ void SfxObjectShell::ImplSign( sal_Bool bScriptingContent )
bAllowModifiedBack = sal_True;
}
- if ( ! bNoSig && GetMedium()->SignContents_Impl( bScriptingContent ) )
+ // we have to store to the original document, the original medium should be closed for this time
+ if ( !bNoSig
+ && ConnectTmpStorage_Impl( pMedium->GetStorage(), pMedium ) )
{
- if ( bScriptingContent )
- pImp->nScriptingSignatureState = SIGNATURESTATE_UNKNOWN;// Re-Check
- else
- pImp->nDocumentSignatureState = SIGNATURESTATE_UNKNOWN;// Re-Check
+ GetMedium()->CloseAndRelease();
+
+ // We sign only ODF1.2, that means that if this point has been reached,
+ // the ODF1.2 signing process should be used.
+ // This code still might be called to show the signature of ODF1.1 document.
+ sal_Bool bSigned = GetMedium()->SignContents_Impl(
+ bScriptingContent,
+ aODFVersion,
+ pImp->nDocumentSignatureState == SIGNATURESTATE_SIGNATURES_OK
+ || pImp->nDocumentSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
+ || pImp->nDocumentSignatureState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK);
+
+ DoSaveCompleted( GetMedium() );
+
+ if ( bSigned )
+ {
+ if ( bScriptingContent )
+ {
+ pImp->nScriptingSignatureState = SIGNATURESTATE_UNKNOWN;// Re-Check
+
+ // adding of scripting signature removes existing document signature
+ pImp->nDocumentSignatureState = SIGNATURESTATE_UNKNOWN;// Re-Check
+ }
+ else
+ pImp->nDocumentSignatureState = SIGNATURESTATE_UNKNOWN;// Re-Check
- pImp->bSignatureErrorIsShown = sal_False;
+ pImp->bSignatureErrorIsShown = sal_False;
- Invalidate( SID_SIGNATURE );
- Invalidate( SID_MACRO_SIGNATURE );
- Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) );
+ Invalidate( SID_SIGNATURE );
+ Invalidate( SID_MACRO_SIGNATURE );
+ Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) );
+ }
}
if ( bAllowModifiedBack )
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 5a4aed274c30..21515b2c6f3d 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -36,6 +36,7 @@
#endif
#include <svtools/eitem.hxx>
#include <svtools/stritem.hxx>
+#include <svtools/intitem.hxx>
#include <tools/zcodec.hxx>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/frame/XModel.hpp>
@@ -99,7 +100,6 @@
#include <sot/storinfo.hxx>
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
-#include <shell/systemshell.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/seqstream.hxx>
#include <comphelper/documentconstants.hxx>
@@ -370,7 +370,7 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto
SvtSaveOptions::ODFDefaultVersion nDefVersion = aSaveOpt.GetODFDefaultVersion();
// older versions can not have this property set, it exists only starting from ODF1.2
- if ( nDefVersion == SvtSaveOptions::ODFVER_012 )
+ if ( nDefVersion >= SvtSaveOptions::ODFVER_012 )
aVersion = ODFVER_012_TEXT;
if ( aVersion.getLength() )
@@ -521,7 +521,7 @@ sal_Bool SfxObjectShell::DoInitNew( SfxMedium* pMed )
pImp->bInitialized = sal_True;
SetActivateEvent_Impl( SFX_EVENT_CREATEDOC );
- SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, this ) );
+ SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(STR_EVENT_DOCCREATED), this ) );
return sal_True;
}
@@ -665,11 +665,14 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaTypeFallbackUsed" ) ) )
>>= bWarnMediaTypeFallback;
- if ( bWarnMediaTypeFallback && pRepairPackageItem && pRepairPackageItem->GetValue() )
+ if ( pRepairPackageItem && pRepairPackageItem->GetValue() )
{
+ // the macros in repaired documents should be disabled
+ pMedium->GetItemSet()->Put( SfxUInt16Item( SID_MACROEXECMODE, document::MacroExecMode::NEVER_EXECUTE ) );
+
// the mediatype was retrieved by using fallback solution but this is a repairing mode
// so it is acceptable to open the document if there is no contents that required manifest.xml
- bWarnMediaTypeFallback = sal_False; //!NoDependencyFromManifest_Impl( xStorage );
+ bWarnMediaTypeFallback = sal_False;
}
if ( bWarnMediaTypeFallback || !xStorage->getElementNames().getLength() )
@@ -827,7 +830,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
if ( aUrl.GetProtocol() == INET_PROT_FILE )
{
const SfxFilter* pOrgFilter = pMedium->GetOrigFilter();
- SystemShell::AddToRecentDocumentList(
+ Application::AddToRecentDocumentList(
aUrl.GetURLNoPass( INetURLObject::NO_DECODE ),
(pOrgFilter) ? pOrgFilter->GetMimeType() : String() );
}
@@ -1175,7 +1178,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
sal_Bool bStoreToSameLocation = sal_False;
// the detection whether the script is changed should be done before saving
- sal_Bool bTryToPreservScriptSignature = sal_False;
+ sal_Bool bTryToPreserveScriptSignature = sal_False;
// no way to detect whether a filter is oasis format, have to wait for saving process
sal_Bool bNoPreserveForOasis = sal_False;
if ( bOwnSource && bOwnTarget
@@ -1186,8 +1189,10 @@ sal_Bool SfxObjectShell::SaveTo_Impl
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 )
+ // currently the check is commented out since it is broken, we have to check the signature every time we save
+ // TODO/LATER: let isAnyContainerModified() work!
+ bTryToPreserveScriptSignature = sal_True; // !pImp->pBasicManager->isAnyContainerModified();
+ if ( bTryToPreserveScriptSignature )
{
// check that the storage format stays the same
SvtSaveOptions aSaveOpt;
@@ -1203,11 +1208,11 @@ sal_Bool SfxObjectShell::SaveTo_Impl
{}
// preserve only if the same filter has been used
- bTryToPreservScriptSignature = pMedium->GetFilter() && pFilter && pMedium->GetFilter()->GetFilterName() == pFilter->GetFilterName();
+ bTryToPreserveScriptSignature = pMedium->GetFilter() && pFilter && pMedium->GetFilter()->GetFilterName() == pFilter->GetFilterName();
bNoPreserveForOasis = (
(aODFVersion.equals( ODFVER_012_TEXT ) && nVersion == SvtSaveOptions::ODFVER_011) ||
- (!aODFVersion.getLength() && nVersion == SvtSaveOptions::ODFVER_012)
+ (!aODFVersion.getLength() && nVersion >= SvtSaveOptions::ODFVER_012)
);
}
}
@@ -1473,9 +1478,10 @@ sal_Bool SfxObjectShell::SaveTo_Impl
}
- if ( bOk && GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
+ if ( bOk && GetCreateMode() != SFX_CREATE_MODE_EMBEDDED && !bPasswdProvided )
{
// store the thumbnail representation image
+ // the thumbnail is not stored in case of encrypted document
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Thumbnail creation." ) ) );
if ( !GenerateAndStoreThumbnail( bPasswdProvided,
sal_False,
@@ -1594,120 +1600,115 @@ sal_Bool SfxObjectShell::SaveTo_Impl
bOk = SaveChildren( TRUE );
}
- // if ODF version of oasis format changes on saving the signature should not be preserved
- if ( bOk && bTryToPreservScriptSignature && bNoPreserveForOasis )
- bTryToPreservScriptSignature = ( SotStorage::GetVersion( rMedium.GetStorage() ) == SOFFICE_FILEFORMAT_60 );
-
- uno::Reference< security::XDocumentDigitalSignatures > xDDSigns;
- sal_Bool bScriptSignatureIsCopied = sal_False;
- if ( bOk && bTryToPreservScriptSignature )
+ if ( bOk )
{
- // if the scripting code was not changed and it is signed the signature should be preserved
- // unfortunately at this point we have only information whether the basic code has changed or not
- // so the only way is to check the signature if the basic was not changed
- try
- {
- xDDSigns = uno::Reference< security::XDocumentDigitalSignatures >(
- comphelper::getProcessServiceFactory()->createInstance(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ),
- uno::UNO_QUERY_THROW );
+ // if ODF version of oasis format changes on saving the signature should not be preserved
+ if ( bOk && bTryToPreserveScriptSignature && bNoPreserveForOasis )
+ bTryToPreserveScriptSignature = ( SotStorage::GetVersion( rMedium.GetStorage() ) == SOFFICE_FILEFORMAT_60 );
- ::rtl::OUString aScriptSignName = xDDSigns->getScriptingContentSignatureDefaultStreamName();
+ uno::Reference< security::XDocumentDigitalSignatures > xDDSigns;
+ if ( bOk && bTryToPreserveScriptSignature )
+ {
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Copying scripting signature." ) ) );
- if ( aScriptSignName.getLength() )
+ // if the scripting code was not changed and it is signed the signature should be preserved
+ // unfortunately at this point we have only information whether the basic code has changed or not
+ // so the only way is to check the signature if the basic was not changed
+ try
{
- uno::Reference< embed::XStorage > xMetaInf = GetStorage()->openStorageElement(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) ),
- embed::ElementModes::READ );
- uno::Reference< embed::XStorage > xTargetMetaInf = rMedium.GetStorage()->openStorageElement(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) ),
- embed::ElementModes::WRITE );
-
- if ( xMetaInf.is() && xTargetMetaInf.is() )
+ // get the ODF version of the new medium
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[0] <<= ::rtl::OUString();
+ try
+ {
+ uno::Reference < beans::XPropertySet > xPropSet( rMedium.GetStorage(), uno::UNO_QUERY_THROW );
+ aArgs[0] = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) );
+ }
+ catch( uno::Exception& )
{
- xMetaInf->copyElementTo( aScriptSignName, xTargetMetaInf, aScriptSignName );
-
- // after loading the UseCommonStoragePassword property might be set to true
- // set it to false here, since this is a rare case when it must be so
- // TODO/LATER: in future it should be done on loading probably
- uno::Reference< beans::XPropertySet > xTargetSignPropSet(
- xTargetMetaInf->openStreamElement( aScriptSignName, embed::ElementModes::WRITE ),
- uno::UNO_QUERY_THROW );
- xTargetSignPropSet->setPropertyValue(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" ) ),
- uno::makeAny( (sal_Bool)sal_False ) );
-
- uno::Reference< embed::XTransactedObject > xTransact( xTargetMetaInf, uno::UNO_QUERY );
- if ( xTransact.is() )
- xTransact->commit();
- bScriptSignatureIsCopied = sal_True;
}
- }
- }
- catch( uno::Exception& )
- {
- }
- }
-
- 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 );
- bOk = rMedium.Commit();
+ xDDSigns = uno::Reference< security::XDocumentDigitalSignatures >(
+ comphelper::getProcessServiceFactory()->createInstanceWithArguments(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ),
+ aArgs ),
+ uno::UNO_QUERY_THROW );
- if ( bOk && bScriptSignatureIsCopied )
- {
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Script signature check." ) ) );
+ ::rtl::OUString aScriptSignName = xDDSigns->getScriptingContentSignatureDefaultStreamName();
- // 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
- // in result the behaviour will work in optimized way in most cases, means in case of signed basic scripts
- OSL_ENSURE( !bScriptSignatureIsCopied || xDDSigns.is(), "The signing could not be done without the service!\n" );
- if ( xDDSigns.is() )
- {
- try
+ if ( aScriptSignName.getLength() )
{
- bOk = sal_False;
- ::com::sun::star::uno::Sequence< security::DocumentSignatureInformation > aInfos =
- xDDSigns->verifyScriptingContentSignatures( rMedium.GetLastCommitReadStorage_Impl(),
- uno::Reference< io::XInputStream >() );
- sal_uInt16 nState = ImplCheckSignaturesInformation( aInfos );
- if ( nState == SIGNATURESTATE_SIGNATURES_OK || nState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED )
- {
- rMedium.SetCachedSignatureState_Impl( nState );
- bOk = sal_True;
- }
- else
+ pMedium->Close();
+
+ // target medium is still not commited, it should not be closed
+ // commit the package storage and close it, but leave the streams open
+ rMedium.StorageCommit_Impl();
+ rMedium.CloseStorage();
+
+ uno::Reference< embed::XStorage > xReadOrig = pMedium->GetZipStorageToSign_Impl();
+ if ( !xReadOrig.is() )
+ throw uno::RuntimeException();
+ uno::Reference< embed::XStorage > xMetaInf = xReadOrig->openStorageElement(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) ),
+ embed::ElementModes::READ );
+
+ uno::Reference< embed::XStorage > xTarget = rMedium.GetZipStorageToSign_Impl( sal_False );
+ if ( !xTarget.is() )
+ throw uno::RuntimeException();
+ uno::Reference< embed::XStorage > xTargetMetaInf = xTarget->openStorageElement(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) ),
+ embed::ElementModes::READWRITE );
+
+ if ( xMetaInf.is() && xTargetMetaInf.is() )
{
- // the signature is broken, remove it
- rMedium.SetCachedSignatureState_Impl( SIGNATURESTATE_NOSIGNATURES );
- uno::Reference< embed::XStorage > xTargetMetaInf = rMedium.GetStorage()->openStorageElement(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) ),
- embed::ElementModes::WRITE );
+ xMetaInf->copyElementTo( aScriptSignName, xTargetMetaInf, aScriptSignName );
+
+ uno::Reference< embed::XTransactedObject > xTransact( xTargetMetaInf, uno::UNO_QUERY );
+ if ( xTransact.is() )
+ xTransact->commit();
- if ( xTargetMetaInf.is() )
+ xTargetMetaInf->dispose();
+
+ // now check the copied signature
+ uno::Sequence< security::DocumentSignatureInformation > aInfos =
+ xDDSigns->verifyScriptingContentSignatures( xTarget,
+ uno::Reference< io::XInputStream >() );
+ sal_uInt16 nState = ImplCheckSignaturesInformation( aInfos );
+ if ( nState == SIGNATURESTATE_SIGNATURES_OK || nState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
+ || nState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK)
{
- xTargetMetaInf->removeElement( xDDSigns->getScriptingContentSignatureDefaultStreamName() );
- uno::Reference< embed::XTransactedObject > xTransact( xTargetMetaInf, uno::UNO_QUERY );
+ rMedium.SetCachedSignatureState_Impl( nState );
+
+ // commit the ZipStorage from target medium
+ xTransact.set( xTarget, uno::UNO_QUERY );
if ( xTransact.is() )
xTransact->commit();
-
- bOk = rMedium.Commit();
+ }
+ else
+ {
+ // it should not happen, the copies signature is invalid!
+ // throw the changes away
+ OSL_ASSERT( "An invalid signature was copied!" );
}
}
}
- catch( uno::Exception )
- {
- OSL_ENSURE( sal_False, "This exception must not happen!" );
- }
}
+ catch( uno::Exception& )
+ {
+ }
+
+ pMedium->Close();
+ rMedium.CloseZipStorage_Impl();
}
+ 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 );
+ bOk = rMedium.Commit();
+
if ( bOk )
{
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Storing is successful." ) ) );
@@ -3255,7 +3256,7 @@ uno::Reference< embed::XStorage > SfxObjectShell::GetStorage()
SetupStorage( pImp->m_xDocStorage, SOFFICE_FILEFORMAT_CURRENT, sal_False );
pImp->m_bCreateTempStor = sal_False;
- SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, this ) );
+ SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, GlobalEventConfig::GetEventName(STR_EVENT_STORAGECHANGED), this ) );
}
catch( uno::Exception& )
{
@@ -3415,7 +3416,7 @@ sal_Bool SfxObjectShell::SaveCompleted( const uno::Reference< embed::XStorage >&
if ( bSendNotification )
{
- SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, this ) );
+ SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, GlobalEventConfig::GetEventName(STR_EVENT_STORAGECHANGED), this ) );
}
return bResult;
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 26ba76517d8c..950ecf9ea239 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -61,6 +61,7 @@
#include <basic/sbstar.hxx>
#include <svtools/stritem.hxx>
#include <basic/sbx.hxx>
+#include <svtools/eventcfg.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/signaturestate.hxx>
@@ -251,7 +252,6 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell )
,pModule( 0 )
,pFrame( 0 )
,pTbxConfig( 0 )
- ,pEventConfig(NULL)
,eFlags( SFXOBJECTSHELL_UNDEFINED )
,pCloser( 0 )
,bReadOnlyUI( sal_False )
@@ -265,6 +265,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell )
,m_bCreateTempStor( sal_False )
,m_xDocInfoListener()
,m_bIsInit( sal_False )
+ ,m_bIncomplEncrWarnShown( sal_False )
{
}
@@ -368,7 +369,7 @@ SfxObjectShell::~SfxObjectShell()
pImp->xModel = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > ();
// don't call GetStorage() here, in case of Load Failure it's possible that a storage was never assigned!
- if ( pMedium && pMedium->HasStorage_Impl() && pMedium->GetStorage() == pImp->m_xDocStorage )
+ if ( pMedium && pMedium->HasStorage_Impl() && pMedium->GetStorage( sal_False ) == pImp->m_xDocStorage )
pMedium->CanDisposeStorage_Impl( sal_False );
if ( pImp->mpObjectContainer )
@@ -581,7 +582,8 @@ sal_uInt16 SfxObjectShell::PrepareClose
}
}
- SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEDOC, this) );
+ SfxApplication *pSfxApp = SFX_APP();
+ pSfxApp->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEDOC, GlobalEventConfig::GetEventName(STR_EVENT_PREPARECLOSEDOC), this) );
if( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
{
@@ -886,11 +888,6 @@ SfxObjectShell* SfxObjectShell::GetObjectShell()
SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames()
{
- return GetEventNames_Impl();
-}
-
-SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl()
-{
static uno::Sequence< ::rtl::OUString >* pEventNameContainer = NULL;
if ( !pEventNameContainer )
@@ -898,88 +895,7 @@ SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl()
::vos::OGuard aGuard( Application::GetSolarMutex() );
if ( !pEventNameContainer )
{
- static uno::Sequence< ::rtl::OUString > aEventNameContainer( 27 );
- // SFX_EVENT_STARTAPP
- aEventNameContainer[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnStartApp" ) );
-
- // SFX_EVENT_CLOSEAPP
- aEventNameContainer[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnCloseApp" ) );
-
- // SFX_EVENT_CREATEDOC
- aEventNameContainer[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnNew" ) );
-
- // SFX_EVENT_OPENDOC
- aEventNameContainer[3] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnLoad" ) );
-
- // SFX_EVENT_SAVEASDOC
- aEventNameContainer[4] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSaveAs" ) );
-
- // SFX_EVENT_SAVEASDOCDONE
- aEventNameContainer[5] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSaveAsDone" ) );
-
- // SFX_EVENT_SAVEDOC
- aEventNameContainer[6] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSave" ) );
-
- // SFX_EVENT_SAVEDOCDONE
- aEventNameContainer[7] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSaveDone" ) );
-
- // SFX_EVENT_PREPARECLOSEDOC
- aEventNameContainer[8] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnPrepareUnload" ) );
-
- // SFX_EVENT_CLOSEDOC
- aEventNameContainer[9] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnUnload" ) );
-
- // SFX_EVENT_ACTIVATEDOC
- aEventNameContainer[10] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnFocus" ) );
-
- // SFX_EVENT_DEACTIVATEDOC
- aEventNameContainer[11] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnUnfocus" ) );
-
- // SFX_EVENT_PRINTDOC
- aEventNameContainer[12] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnPrint" ) );
-
- // SFX_EVENT_MODIFYCHANGED
- aEventNameContainer[13] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnModifyChanged" ) );
-
- // SFX_EVENT_SAVETODOC
- aEventNameContainer[14] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnCopyTo" ) );
-
- // SFX_EVENT_SAVETODOCDONE
- aEventNameContainer[15] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnCopyToDone" ) );
-
- // SFX_EVENT_VIEWCREATED
- aEventNameContainer[16] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnViewCreated" ) );
-
- // SFX_EVENT_PREPARECLOSEVIEW
- aEventNameContainer[17] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnPrepareViewClosing" ) );
-
- // SFX_EVENT_CLOSEVIEW
- aEventNameContainer[18] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnViewClosed" ) );
-
- // SFX_EVENT_VISAREACHANGED
- aEventNameContainer[19] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" ) );
-
- // SFX_EVENT_DOCCREATED
- aEventNameContainer[20] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnCreate" ) );
-
- // SFX_EVENT_LOADFINISHED
- aEventNameContainer[21] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnLoadFinished" ) );
-
- // SFX_EVENT_SAVEASDOCFAILED
- aEventNameContainer[22] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSaveAsFailed" ) );
-
- // SFX_EVENT_SAVEDOCFAILED
- aEventNameContainer[23] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnSaveFailed" ) );
-
- // SFX_EVENT_SAVETODOCFAILED
- aEventNameContainer[24] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnCopyToFailed" ) );
-
- // SFX_HINT_TITLECHANGED
- aEventNameContainer[25] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnTitleChanged" ) );
-
- // SFX_HINT_MODECHANGED
- aEventNameContainer[26] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnModeChanged" ) );
-
+ static uno::Sequence< ::rtl::OUString > aEventNameContainer = GlobalEventConfig().getElementNames();
pEventNameContainer = &aEventNameContainer;
}
}
@@ -987,6 +903,13 @@ SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl()
return *pEventNameContainer;
}
+SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl()
+{
+ if (!pImp->xEventNames.getLength())
+ pImp->xEventNames = GetEventNames();
+ return pImp->xEventNames;
+}
+
//--------------------------------------------------------------------
void SfxObjectShell::SetModel( SfxBaseModel* pModel )
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index d4b0b3aaf7ab..03e6e9170153 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1614,7 +1614,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
SfxAllItemSet *pParams = new SfxAllItemSet( SFX_APP()->GetPool() );
TransformParameters( SID_SAVEDOC, aSeqArgs, *pParams );
- SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOC, m_pData->m_pObjectShell ) );
+ SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOC, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOC), m_pData->m_pObjectShell ) );
sal_Bool bRet = sal_False;
@@ -1645,14 +1645,12 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
: ERRCODE_IO_CANTWRITE;
m_pData->m_pObjectShell->ResetError();
- SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEFINISHED, m_pData->m_pObjectShell ) );
-
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 ) );
+ SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOCDONE), m_pData->m_pObjectShell ) );
}
else
{
@@ -1660,7 +1658,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
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 ) );
+ SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOCFAILED), m_pData->m_pObjectShell ) );
throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), nErrCode );
}
@@ -2546,7 +2544,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC ,
impl_getPrintHelper();
}
- postEvent_Impl( pNamedHint->GetEventId() );
+ postEvent_Impl( pNamedHint->GetEventName() );
}
if ( pSimpleHint )
@@ -2555,11 +2553,11 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC ,
{
::rtl::OUString aTitle = m_pData->m_pObjectShell->GetTitle();
addTitle_Impl( m_pData->m_seqArguments, aTitle );
- postEvent_Impl( pSimpleHint->GetId() );
+ postEvent_Impl( GlobalEventConfig::GetEventName( STR_EVENT_TITLECHANGED ) );
}
if ( pSimpleHint->GetId() == SFX_HINT_MODECHANGED )
{
- postEvent_Impl( pSimpleHint->GetId() );
+ postEvent_Impl( GlobalEventConfig::GetEventName( STR_EVENT_MODECHANGED ) );
}
/*
else if ( pSimpleHint->GetId() == SFX_HINT_DYING
@@ -2760,7 +2758,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
if ( !bSaved && m_pData->m_pObjectShell )
{
- SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOC : SFX_EVENT_SAVEASDOC,
+ SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOC : SFX_EVENT_SAVEASDOC, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOC : STR_EVENT_SAVEASDOC ),
m_pData->m_pObjectShell ) );
SfxAllItemSet *aParams = new SfxAllItemSet( SFX_APP()->GetPool() );
@@ -2850,19 +2848,9 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
// TODO/LATER: a general way to set the error context should be available
SfxErrorContext aEc( ERRCTX_SFX_SAVEASDOC, m_pData->m_pObjectShell->GetTitle() );
- ::com::sun::star::uno::Any aInteraction;
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > lContinuations(1);
- ::framework::ContinuationApprove* pApprove = new ::framework::ContinuationApprove();
- lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >(static_cast< ::com::sun::star::task::XInteractionContinuation* >(pApprove), uno::UNO_QUERY);
-
::com::sun::star::task::ErrorCodeRequest aErrorCode;
aErrorCode.ErrCode = nErrCode;
- aInteraction <<= aErrorCode;
-
- ::framework::InteractionRequest* pRequest = new ::framework::InteractionRequest(aInteraction,lContinuations);
- ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > xRequest(static_cast< ::com::sun::star::task::XInteractionRequest* >(pRequest), uno::UNO_QUERY);
-
- xHandler->handle(xRequest);
+ SfxMedium::CallApproveHandler( xHandler, uno::makeAny( aErrorCode ), sal_False );
}
}
@@ -2870,11 +2858,11 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
if ( !bSaveTo )
{
m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl();
- SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, m_pData->m_pObjectShell ) );
+ SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVEASDOCDONE), m_pData->m_pObjectShell ) );
}
else
{
- SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, m_pData->m_pObjectShell ) );
+ SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVETODOCDONE), m_pData->m_pObjectShell ) );
}
}
else
@@ -2883,7 +2871,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
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,
+ SFX_APP()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOCFAILED : STR_EVENT_SAVEASDOCFAILED),
m_pData->m_pObjectShell ) );
throw task::ErrorCodeIOException( ::rtl::OUString(), uno::Reference< uno::XInterface >(), nErrCode );
@@ -2893,18 +2881,26 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
//********************************************************************************************************
-void SfxBaseModel::postEvent_Impl( ULONG nEventID )
+void SfxBaseModel::postEvent_Impl( ::rtl::OUString aName )
{
// object already disposed?
if ( impl_isDisposed() )
return;
+ DBG_ASSERT( aName.getLength(), "Empty event name!" );
+ if (!aName.getLength())
+ return;
+
::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer(
::getCppuType((const uno::Reference< XDOCEVENTLISTENER >*)0) );
if( pIC )
{
- ::rtl::OUString aName = SfxEventConfiguration::GetEventName_Impl( nEventID );
+#ifdef DBG_UTIL
+ ByteString aTmp( "SfxEvent: ");
+ aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 );
+ DBG_TRACE( aTmp.GetBuffer() );
+#endif
document::EventObject aEvent( (frame::XModel *)this, aName );
::cppu::OInterfaceContainerHelper aIC( m_aMutex );
uno::Sequence < uno::Reference < uno::XInterface > > aElements = pIC->getElements();
diff --git a/sfx2/source/doc/sfxbasemodel.src b/sfx2/source/doc/sfxbasemodel.src
deleted file mode 100644
index cbbfa57b2ad0..000000000000
--- a/sfx2/source/doc/sfxbasemodel.src
+++ /dev/null
@@ -1,94 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: sfxbasemodel.src,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <sfx2/sfx.hrc>
-#include "sfxlocal.hrc"
-
-/*
-// the following events names are now hardcoded in the code
-StringArray EVENT_NAMES_ARY
-{
- ItemList =
- {
- < "OnStartApp" ; SFX_EVENT_STARTAPP ; > ;
- < "OnCloseApp" ; SFX_EVENT_CLOSEAPP ; > ;
- < "OnNew" ; SFX_EVENT_CREATEDOC ; > ;
- < "OnLoad" ; SFX_EVENT_OPENDOC ; > ;
- < "OnSaveAs" ; SFX_EVENT_SAVEASDOC ; > ;
- < "OnSaveAsDone" ; SFX_EVENT_SAVEASDOCDONE ; > ;
- < "OnSave" ; SFX_EVENT_SAVEDOC ; > ;
- < "OnSaveDone" ; SFX_EVENT_SAVEDOCDONE ; > ;
- < "OnPrepareUnload" ; SFX_EVENT_PREPARECLOSEDOC ; > ;
- < "OnUnload" ; SFX_EVENT_CLOSEDOC ; > ;
- < "OnFocus" ; SFX_EVENT_ACTIVATEDOC ; > ;
- < "OnUnfocus" ; SFX_EVENT_DEACTIVATEDOC ; > ;
- < "OnPrint" ; SFX_EVENT_PRINTDOC ; > ;
- < "OnModifyChanged" ; SFX_EVENT_MODIFYCHANGED ; > ;
- < "OnCopyTo" ; SFX_EVENT_SAVETODOC ; > ;
- < "OnCopyToDone" ; SFX_EVENT_SAVETODOCDONE ; > ;
- < "OnViewCreated" ; SFX_EVENT_VIEWCREATED ; > ;
- < "OnPrepareViewClosing"; SFX_EVENT_PREPARECLOSEVIEW ; > ;
- < "OnViewClosed" ; SFX_EVENT_CLOSEVIEW ; > ;
- < "OnVisAreaChanged" ; SFX_EVENT_VISAREACHANGED ; > ;
- < "OnCreate" ; SFX_EVENT_DOCCREATED ; > ;
- < "OnLoadFinished" ; SFX_EVENT_LOADFINISHED ; > ;
- < "OnSaveAsFailed" ; SFX_EVENT_SAVEASDOCFAILED ; > ;
- < "OnSaveFailed" ; SFX_EVENT_SAVEDOCFAILED ; > ;
- < "OnCopyToFailed" ; SFX_EVENT_SAVETODOCFAILED ; > ;
- };
-};
-*/
-
-/*
- these events are defined by the applications or aren't used
- any longer
-
- < "OnNewMail" ; SFX_EVENT_NEWMESSAGE ; > ;
- < "OnError" ; SFX_EVENT_ONERROR ; > ;
- < "OnSelect" ; > ;
- < "OnInsertStart" ; > ;
- < "OnInsertDone" ; > ;
- < "OnMailMerge" ; > ;
- < "OnAlphaCharInput" ; > ;
- < "OnNonAlphaCharInput" ; > ;
- < "OnResize" ; > ;
- < "OnMove" ; > ;
- < "OnPageCountChange" ; > ;
- < "OnMouseOver" ; SFX_EVENT_MOUSEOVER_OBJECT ; > ;
- < "OnClick" ; SFX_EVENT_MOUSECLICK_OBJECT ; > ;
- < "OnMouseOut" ; SFX_EVENT_MOUSEOUT_OBJECT ; > ;
- < "OnLoadError" ; > ;
- < "OnLoadCancel" ; > ;
- < "OnLoadDone" ; > ;
- < "OnLoadFinished" ; SFX_EVENT_LOADFINISHED ; > ;
- < "OnSaveFinished" ; SFX_EVENT_SAVEFINISHED ; > ;
- < "OnModifyChanged" ; SFX_EVENT_MODIFYCHANGED ; > ;
- < "OnToggleFullscreen" ; SFX_EVENT_TOGGLEFULLSCREENMODE ; > ;
-*/
diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx
index 97455a9e6482..0940d4bb66e3 100644
--- a/sfx2/source/inc/eventsupplier.hxx
+++ b/sfx2/source/inc/eventsupplier.hxx
@@ -187,7 +187,6 @@ class SfxGlobalEvents_Impl : public ModelCollectionMutexBase
, ::com::sun::star::document::XEventListener
, ::com::sun::star::document::XDocumentEventListener
, ::com::sun::star::container::XSet >
- , public SfxListener
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMGR;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xEvents;
@@ -197,8 +196,6 @@ class SfxGlobalEvents_Impl : public ModelCollectionMutexBase
TModelList m_lModels;
GlobalEventConfig* pImp;
- void Notify( SfxBroadcaster& aBC, const SfxHint& aHint );
-
public:
SfxGlobalEvents_Impl(const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xSMGR);
virtual ~SfxGlobalEvents_Impl();
diff --git a/sfx2/source/inc/helper.hxx b/sfx2/source/inc/helper.hxx
index d246c1f70830..16eabab43a7e 100644
--- a/sfx2/source/inc/helper.hxx
+++ b/sfx2/source/inc/helper.hxx
@@ -70,7 +70,6 @@ public:
static sal_Bool MakeFolder( const String& rFolder );
static ErrCode QueryDiskSpace( const String& rPath, sal_Int64& rFreeBytes );
static ULONG GetSize( const String& rContent );
- static sal_Bool IsYounger( const String& rIsYoung, const String& rIsOlder );
// please don't use this!
static sal_Bool Exists( const String& rContent );
diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx
index eb8719435406..77162423cabe 100644
--- a/sfx2/source/inc/objshimp.hxx
+++ b/sfx2/source/inc/objshimp.hxx
@@ -33,6 +33,8 @@
//#include <hash_map>
#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
#include <com/sun/star/logging/XSimpleLogRing.hpp>
#include <tools/datetime.hxx>
@@ -72,6 +74,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
xBasicLibraries;
::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >
xDialogLibraries;
+ com::sun::star::uno::Sequence < rtl::OUString > xEventNames;
::sfx2::DocumentMacroMode
aMacroMode;
SfxProgress* pProgress;
@@ -141,7 +144,6 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
SfxModule* pModule;
SfxFrame* pFrame;
SfxToolBoxConfig* pTbxConfig;
- SfxEventConfigItem_Impl* pEventConfig;
SfxObjectShellFlags eFlags;
svtools::AsynchronLink* pCloser;
String aBaseURL;
@@ -171,6 +173,9 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
::com::sun::star::uno::Reference< ::com::sun::star::logging::XSimpleLogRing > m_xLogRing;
+ sal_Bool m_bIncomplEncrWarnShown;
+
+
SfxObjectShell_Impl( SfxObjectShell& _rDocShell );
virtual ~SfxObjectShell_Impl();
@@ -180,10 +185,12 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
virtual sal_Int16 getCurrentMacroExecMode() const;
virtual sal_Bool setCurrentMacroExecMode( sal_uInt16 nMacroMode );
virtual ::rtl::OUString getDocumentLocation() const;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > getLastCommitDocumentStorage();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > getZipStorageToSign();
virtual sal_Bool documentStorageHasMacros() const;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const;
- virtual sal_Int16 getScriptingSignatureState() const;
+ virtual sal_Int16 getScriptingSignatureState();
+
+ virtual sal_Bool hasTrustedScriptingSignature( sal_Bool bAllowUIToAddAuthor );
virtual void showBrokenSignatureWarning( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxInteraction ) const;
};
diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx
index c3c1e83f2aba..a01b1df73c82 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -98,12 +98,6 @@ void SAL_CALL SfxEvents_Impl::replaceByName( const OUSTRING & aName, const ANY &
// create Configuration at first, creation might call this method also and that would overwrite everything
// we might have stored before!
- USHORT nID = (USHORT) SfxEventConfiguration::GetEventId_Impl( aName );
- OSL_ENSURE( nID, "SfxEvents_Impl::replaceByName: no ID for the given event!" );
- if ( !nID )
- // throw?
- return;
-
if ( mpObjShell && !mpObjShell->IsLoading() )
mpObjShell->SetModified( TRUE );
@@ -370,7 +364,7 @@ SfxEvents_Impl::SfxEvents_Impl( SfxObjectShell* pShell,
if ( pShell )
maEventNames = pShell->GetEventNames();
else
- maEventNames = SfxObjectShell::GetEventNames_Impl();
+ maEventNames = GlobalEventConfig().getElementNames();
maEventData = SEQUENCE < ANY > ( maEventNames.getLength() );
@@ -646,24 +640,6 @@ SfxGlobalEvents_Impl::~SfxGlobalEvents_Impl()
}
//-----------------------------------------------------------------------------
-void SfxGlobalEvents_Impl::Notify( SfxBroadcaster& /*aBC*/, const SfxHint& aHint )
-{
- SfxEventHint* pNamedHint = PTR_CAST(SfxEventHint, &aHint);
- if (!pNamedHint)
- return;
-
- css::uno::Reference< css::document::XEventsSupplier > xSup;
-
- ::rtl::OUString sName = SfxEventConfiguration::GetEventName_Impl(pNamedHint->GetEventId());
- SfxObjectShell* pShell = pNamedHint->GetObjShell();
- if (pShell)
- xSup = css::uno::Reference< css::document::XEventsSupplier >(pShell->GetModel(), UNO_QUERY);
-
- css::document::EventObject aEvent(xSup, sName);
- notifyEvent(aEvent);
-}
-
-//-----------------------------------------------------------------------------
css::uno::Reference< css::container::XNameReplace > SAL_CALL SfxGlobalEvents_Impl::getEvents()
throw(css::uno::RuntimeException)
{
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index 674c209b65cc..42e9a1d04cb6 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -296,7 +296,7 @@ sal_uInt16 SfxFrame::PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing )
bOther = ( pFrame->GetFrame() != this );
}
- SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEVIEW, pCur) );
+ SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEVIEW ), pCur) );
if ( bOther )
// if there are other views only the current view of this frame must be asked
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index 8d7562b0c495..b91e1e6b4998 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -79,6 +79,7 @@
namespace css = ::com::sun::star;
#endif
+#include <sfx2/doctempl.hxx>
#include <sfx2/app.hxx>
#include <sfx2/request.hxx>
#include <sfx2/sfxsids.hrc>
@@ -396,76 +397,88 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< css::bean
return bLoadState;
}
- String sStandardTemplate = SfxObjectFactory::GetStandardTemplate( aServiceName );
- BOOL bUseDefaultTemplate = (sStandardTemplate.Len()>0);
- if( bUseDefaultTemplate )
- {
- // #i21583#
- // Forget the filter, which was detected for the corresponding "private:factory/xxx" URL.
- // We must use the right filter, matching to this document ... not to the private URL!
- const SfxFilter* pTemplateFilter = impl_detectFilterForURL(sStandardTemplate, rArgs, rMatcher);
- if (pTemplateFilter)
- {
- pFilter = pTemplateFilter;
- aFilterName = pTemplateFilter->GetName();
- // standard template set -> load it "AsTemplate"
- aSet.Put( SfxStringItem ( SID_FILE_NAME, sStandardTemplate ) );
- aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
- }
+ String sTemplateURL;
+ SFX_ITEMSET_ARG( &aSet, pTemplateRegionItem, SfxStringItem, SID_TEMPLATE_REGIONNAME, FALSE );
+ SFX_ITEMSET_ARG( &aSet, pTemplateNameItem, SfxStringItem, SID_TEMPLATE_NAME, FALSE );
+ if ( pTemplateRegionItem && pTemplateNameItem )
+ {
+ SfxDocumentTemplates aTmpFac;
+ aTmpFac.GetFull( pTemplateRegionItem->GetValue(), pTemplateNameItem->GetValue(), sTemplateURL );
+ }
+ else
+ {
+ sTemplateURL = SfxObjectFactory::GetStandardTemplate( aServiceName );
+ }
- // #119268#
- // something is wrong with the set default template (e.g. unknown format, missing file etcpp)
- // The we have to jump into the following special code, where "private:factory/ URL's are handled.
- // We cant "load" such private/factory URL's!
- else
- bUseDefaultTemplate = FALSE;
+ BOOL bUseTemplate = (sTemplateURL.Len()>0);
+ if( bUseTemplate )
+ {
+ // #i21583#
+ // Forget the filter, which was detected for the corresponding "private:factory/xxx" URL.
+ // We must use the right filter, matching to this document ... not to the private URL!
+ const SfxFilter* pTemplateFilter = impl_detectFilterForURL(sTemplateURL, rArgs, rMatcher);
+ if (pTemplateFilter)
+ {
+ pFilter = pTemplateFilter;
+ aFilterName = pTemplateFilter->GetName();
+ // standard template set -> load it "AsTemplate"
+ aSet.Put( SfxStringItem ( SID_FILE_NAME, sTemplateURL ) );
+ aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
}
- if ( !bUseDefaultTemplate )
- {
- // execute "NewDocument" request
- /* Attention!
- #107913#
- Pointers can't be used to check if two objects are equals!
- E.g. the memory manager can reuse freed memory ...
- and then the holded copy of a pointer will point to another
- (and different!) object - may using the same type then before.
- In such case we compare one object with itself ...
- */
- SfxRequest aReq( SID_NEWDOCDIRECT, SFX_CALLMODE_SYNCHRON, aSet );
- aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, pFrame ) );
- aReq.AppendItem( SfxStringItem( SID_NEWDOCDIRECT, aFact ) );
-
- if ( pDocumentTitleItem )
- aReq.AppendItem( *pDocumentTitleItem );
-
- const SfxPoolItem* pRet = pApp->NewDocDirectExec_ImplOld(aReq);
- if (pRet)
- {
- // default must be set to true, because some return values
- // cant be checked ... but indicates "success"!
- bLoadState = sal_True;
+ // #119268#
+ // something is wrong with the set default template (e.g. unknown format, missing file etcpp)
+ // The we have to jump into the following special code, where "private:factory/ URL's are handled.
+ // We cant "load" such private/factory URL's!
+ else
+ bUseTemplate = FALSE;
+ }
- // On the other side some special slots return a boolean state,
- // which can be set to FALSE.
- SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, pRet );
- if (pItem)
- bLoadState = pItem->GetValue();
- }
- else
- bLoadState = sal_False;
+ if ( !bUseTemplate )
+ {
+ // execute "NewDocument" request
+ /* Attention!
+ #107913#
+ Pointers can't be used to check if two objects are equals!
+ E.g. the memory manager can reuse freed memory ...
+ and then the holded copy of a pointer will point to another
+ (and different!) object - may using the same type then before.
+ In such case we compare one object with itself ...
+ */
+ SfxRequest aReq( SID_NEWDOCDIRECT, SFX_CALLMODE_SYNCHRON, aSet );
+ aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, pFrame ) );
+ aReq.AppendItem( SfxStringItem( SID_NEWDOCDIRECT, aFact ) );
+
+ if ( pDocumentTitleItem )
+ aReq.AppendItem( *pDocumentTitleItem );
+
+ const SfxPoolItem* pRet = pApp->NewDocDirectExec_ImplOld(aReq);
+ if (pRet)
+ {
+ // default must be set to true, because some return values
+ // cant be checked ... but indicates "success"!
+ bLoadState = sal_True;
- if ( !bLoadState && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() )
- {
- css::uno::Reference< css::frame::XFrame > axFrame;
- wFrame->SetFrameInterface_Impl( axFrame );
- wFrame->DoClose();
- }
+ // On the other side some special slots return a boolean state,
+ // which can be set to FALSE.
+ SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, pRet );
+ if (pItem)
+ bLoadState = pItem->GetValue();
+ }
+ else
+ bLoadState = sal_False;
- xFrame.clear();
- xListener.clear();
- return bLoadState;
+ if ( !bLoadState && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() )
+ {
+ css::uno::Reference< css::frame::XFrame > axFrame;
+ wFrame->SetFrameInterface_Impl( axFrame );
+ wFrame->DoClose();
}
+
+ xFrame.clear();
+ xListener.clear();
+ return bLoadState;
+ }
}
else
{
diff --git a/sfx2/source/view/prnmon.cxx b/sfx2/source/view/prnmon.cxx
index 9fdd29db2805..21d484e550ab 100644
--- a/sfx2/source/view/prnmon.cxx
+++ b/sfx2/source/view/prnmon.cxx
@@ -388,7 +388,7 @@ IMPL_LINK_INLINE_END( SfxPrintProgress, PrintErrorNotify, void *, EMPTYARG )
IMPL_LINK( SfxPrintProgress, StartPrintNotify, void *, EMPTYARG )
{
SfxObjectShell *pObjShell = pImp->pViewShell->GetObjectShell();
- SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_PRINTDOC, pObjShell));
+ SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_PRINTDOC, GlobalEventConfig::GetEventName( STR_EVENT_PRINTDOC ), pObjShell));
pObjShell->Broadcast( SfxPrintingHint( com::sun::star::view::PrintableState_JOB_STARTED, NULL, NULL ) );
return 0;
}
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index ca9b4149339e..54ccd29a7dd7 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1148,9 +1148,9 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime
if ( m_pData->m_bIsFrameReleasedWithController )
{
- SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEVIEW, pDoc ) );
+ SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc ) );
if ( !pView )
- SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, pDoc) );
+ SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), pDoc) );
}
REFERENCE< XMODEL > xModel = pDoc->GetModel();
diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx
index 205fdf788ba1..01c48f8f2be0 100644
--- a/sfx2/source/view/topfrm.cxx
+++ b/sfx2/source/view/topfrm.cxx
@@ -210,6 +210,9 @@ long SfxTopWindow_Impl::Notify( NotifyEvent& rNEvt )
if ( nHelpId )
SfxHelp::OpenHelpAgent( pFrame, nHelpId );
+ // if focus was on an external window, the clipboard content might have been changed
+ pView->GetBindings().Invalidate( SID_PASTE );
+ pView->GetBindings().Invalidate( SID_PASTE_SPECIAL );
return sal_True;
}
else if( rNEvt.GetType() == EVENT_KEYINPUT )
@@ -1016,7 +1019,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc )
GetCurrentViewFrame()->Resize(TRUE);
}
- SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, pDoc ) );
+ SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), pDoc ) );
return sal_True;
}
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 0769a782de86..592926bca1ce 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -77,6 +77,7 @@
#include <rtl/ustrbuf.hxx>
#include <unotools/localfilehelper.hxx>
+#include <unotools/ucbhelper.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/configurationhelper.hxx>
@@ -453,7 +454,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
// to the logical one, then on file system it can be checked that the copy is still newer than the original and no document reload is required
if ( ( !bNeedsReload && ( (aMedObj.GetProtocol() == INET_PROT_FILE &&
aMedObj.getFSysPath(INetURLObject::FSYS_DETECT) != aPhysObj.getFSysPath(INetURLObject::FSYS_DETECT) &&
- SfxContentHelper::IsYounger( aPhysObj.GetMainURL( INetURLObject::NO_DECODE ), aMedObj.GetMainURL( INetURLObject::NO_DECODE ) ))
+ !::utl::UCBContentHelper::IsYounger( aMedObj.GetMainURL( INetURLObject::NO_DECODE ), aPhysObj.GetMainURL( INetURLObject::NO_DECODE ) ))
|| pMed->IsRemote() ) )
|| pVersionItem )
{
@@ -716,7 +717,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
// eigentliches Reload
//pNewSet->Put( SfxFrameItem ( SID_DOCFRAME, GetFrame() ) );
- //pNewSet->Put( SfxBoolItem( SID_SILENT, sal_True ) );
+
+ if ( pSilentItem && pSilentItem->GetValue() )
+ pNewSet->Put( SfxBoolItem( SID_SILENT, sal_True ) );
SFX_ITEMSET_ARG(pNewSet, pInteractionItem, SfxUnoAnyItem, SID_INTERACTIONHANDLER, FALSE);
SFX_ITEMSET_ARG(pNewSet, pMacroExecItem , SfxUInt16Item, SID_MACROEXECMODE , FALSE);
@@ -820,6 +823,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
}
xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_RELOAD );
+ xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_SILENT );
UpdateDocument_Impl();
}
@@ -863,7 +867,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if ( xNewObj.Is() )
{
// Propagate document closure.
- SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, xOldObj ) );
+ SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), xOldObj ) );
}
// als erledigt recorden
@@ -1141,7 +1145,7 @@ void SfxViewFrame::SetObjectShell_Impl
SwitchToViewShell_Impl( !IsRestoreView_Impl() ? (sal_uInt16) 0 : GetCurViewId() );
rObjSh.PostActivateEvent_Impl( this );
if ( Current() == this )
- SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_ACTIVATEDOC, &rObjSh ) );
+ SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), &rObjSh ) );
Notify( rObjSh, SfxSimpleHint(SFX_HINT_TITLECHANGED) );
Notify( rObjSh, SfxSimpleHint(SFX_HINT_DOCCHANGED) );
@@ -1514,6 +1518,8 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
case SFX_HINT_MODECHANGED:
{
// r/o Umschaltung?
+ SfxBindings& rBind = GetBindings();
+ rBind.Invalidate( SID_RELOAD );
SfxDispatcher *pDispat = GetDispatcher();
sal_Bool bWasReadOnly = pDispat->GetReadOnly_Impl();
sal_Bool bIsReadOnly = xObjSh->IsReadOnly();
@@ -1521,8 +1527,9 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
{
// Dann auch TITLE_CHANGED
UpdateTitle();
- GetBindings().Invalidate( SID_FILE_NAME );
- GetBindings().Invalidate( SID_DOCINFO_TITLE );
+ rBind.Invalidate( SID_FILE_NAME );
+ rBind.Invalidate( SID_DOCINFO_TITLE );
+ rBind.Invalidate( SID_EDITDOC );
pDispat->GetBindings()->InvalidateAll(sal_True);
pDispat->SetReadOnly_Impl( bIsReadOnly );
@@ -1543,8 +1550,11 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
case SFX_HINT_TITLECHANGED:
{
UpdateTitle();
- GetBindings().Invalidate( SID_FILE_NAME );
- GetBindings().Invalidate( SID_DOCINFO_TITLE );
+ SfxBindings& rBind = GetBindings();
+ rBind.Invalidate( SID_FILE_NAME );
+ rBind.Invalidate( SID_DOCINFO_TITLE );
+ rBind.Invalidate( SID_EDITDOC );
+ rBind.Invalidate( SID_RELOAD );
break;
}
@@ -1572,12 +1582,16 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
rBind.Invalidate( SID_DOC_MODIFIED );
rBind.Invalidate( SID_SAVEDOC );
rBind.Invalidate( SID_RELOAD );
+ rBind.Invalidate( SID_EDITDOC );
break;
}
case SFX_EVENT_OPENDOC:
case SFX_EVENT_CREATEDOC:
{
+ SfxBindings& rBind = GetBindings();
+ rBind.Invalidate( SID_RELOAD );
+ rBind.Invalidate( SID_EDITDOC );
if ( !xObjSh->IsReadOnly() )
{
// Im Gegensatz zu oben (TITLE_CHANGED) mu\s das UI nicht
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index 5188f84a43b6..97f86ee1f395 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -45,6 +45,10 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <svtools/acceleratorexecute.hxx>
+#include <rtl/ref.hxx>
+
+#include <queue>
+
// forward ---------------------------------------------------------------
class SfxOfficeDispatch;
@@ -54,6 +58,22 @@ typedef SfxShell* SfxShellPtr_Impl;
SV_DECL_PTRARR( SfxShellArr_Impl, SfxShellPtr_Impl, 4, 4 )
// struct SfxViewShell_Impl ----------------------------------------------
+class SfxAsyncPrintExec_Impl : public SfxListener
+{
+ SfxViewShell* pView;
+ ::std::queue < SfxRequest*> aReqs;
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+public:
+ SfxAsyncPrintExec_Impl( SfxViewShell* pShell)
+ : pView( pShell )
+ {}
+
+ void AddRequest( SfxRequest& rReq );
+};
+
+class SfxClipboardChangeListener;
struct SfxViewShell_Impl
{
@@ -78,12 +98,11 @@ struct SfxViewShell_Impl
USHORT nFamily;
SfxBaseController* pController;
::svt::AcceleratorExecute* pAccExec;
+ SfxAsyncPrintExec_Impl* pPrinterCommandQueue;
com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts;
+ ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener;
- SfxViewShell_Impl()
- : aInterceptorContainer( aMutex )
- , pAccExec(0)
- {}
+ SfxViewShell_Impl();
};
#endif
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 3c2054a4a881..c944264dd20c 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -53,6 +53,7 @@
#include <tools/datetime.hxx>
#include <sfx2/viewsh.hxx>
+#include <sfx2/dispatch.hxx>
#include "viewimp.hxx"
#include <sfx2/viewfrm.hxx>
#include <sfx2/prnmon.hxx>
@@ -71,6 +72,43 @@ TYPEINIT1(SfxPrintingHint, SfxHint);
// -----------------------------------------------------------------------
+void SfxAsyncPrintExec_Impl::AddRequest( SfxRequest& rReq )
+{
+ if ( rReq.GetArgs() )
+ {
+ // only queue API requests
+ if ( aReqs.empty() )
+ StartListening( *pView->GetObjectShell() );
+
+ aReqs.push( new SfxRequest( rReq ) );
+ }
+}
+
+void SfxAsyncPrintExec_Impl::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ if ( &rBC == pView->GetObjectShell() )
+ {
+ SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint );
+ if ( pPrintHint && pPrintHint->GetWhich() == com::sun::star::view::PrintableState_JOB_COMPLETED )
+ {
+ while ( aReqs.front() )
+ {
+ SfxRequest* pReq = aReqs.front();
+ aReqs.pop();
+ pView->GetViewFrame()->GetDispatcher()->Execute( pReq->GetSlot(), SFX_CALLMODE_ASYNCHRON, *pReq->GetArgs() );
+ USHORT nSlot = pReq->GetSlot();
+ delete pReq;
+ if ( nSlot == SID_PRINTDOC || nSlot == SID_PRINTDOCDIRECT )
+ // print jobs must be executed before the next command can be dispatched
+ break;
+ }
+
+ if ( aReqs.empty() )
+ EndListening( *pView->GetObjectShell() );
+ }
+ }
+}
+
void DisableRanges( PrintDialog& rDlg, SfxPrinter* pPrinter )
/* [Beschreibung]
@@ -389,13 +427,19 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
{
USHORT nCopies=1;
USHORT nDialogRet = RET_CANCEL;
- BOOL bCollate=FALSE;
+ BOOL bCollate=TRUE;
SfxPrinter* pPrinter = 0;
PrintDialog* pPrintDlg = 0;
SfxDialogExecutor_Impl* pExecutor = 0;
bool bSilent = false;
BOOL bIsAPI = rReq.GetArgs() && rReq.GetArgs()->Count();
+ if ( bIsAPI && GetPrinter( FALSE ) && GetPrinter( FALSE )->IsPrinting() )
+ {
+ pImp->pPrinterCommandQueue->AddRequest( rReq );
+ return;
+ }
+
const USHORT nId = rReq.GetSlot();
switch( nId )
{
@@ -866,8 +910,11 @@ ErrCode SfxViewShell::DoPrint( SfxPrinter *pPrinter,
else if ( pDocPrinter != pPrinter )
{
pProgress->RestoreOnEndPrint( pDocPrinter->Clone() );
- SetPrinter( pPrinter, SFX_PRINTER_PRINTER );
+ USHORT nError = SetPrinter( pPrinter, SFX_PRINTER_PRINTER );
+ if ( nError != SFX_PRINTERROR_NONE )
+ return PRINTER_ACCESSDENIED;
}
+
pProgress->SetWaitMode(FALSE);
// Drucker starten
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 70bbc4a28d02..f6053a467ed4 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -47,6 +47,9 @@
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <cppuhelper/implbase1.hxx>
#include <osl/file.hxx>
#include <vos/mutex.hxx>
@@ -112,6 +115,70 @@ DBG_NAME(SfxViewShell)
//=========================================================================
+class SfxClipboardChangeListener : public ::cppu::WeakImplHelper1<
+ datatransfer::clipboard::XClipboardListener >
+{
+ SfxViewShell* pViewShell;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const lang::EventObject& rEventObject )
+ throw ( uno::RuntimeException );
+
+ // XClipboardListener
+ virtual void SAL_CALL changedContents( const datatransfer::clipboard::ClipboardEvent& rEventObject )
+ throw ( uno::RuntimeException );
+
+public:
+ SfxClipboardChangeListener( SfxViewShell* pView );
+ virtual ~SfxClipboardChangeListener();
+
+ void DisconnectViewShell() { pViewShell = NULL; }
+};
+
+SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView )
+: pViewShell( 0 )
+{
+ uno::Reference < lang::XComponent > xCtrl( pView->GetController(), uno::UNO_QUERY );
+ if ( xCtrl.is() )
+ {
+ xCtrl->addEventListener( uno::Reference < lang::XEventListener > ( static_cast < lang::XEventListener* >( this ) ) );
+ pViewShell = pView;
+ }
+}
+
+SfxClipboardChangeListener::~SfxClipboardChangeListener()
+{
+}
+
+void SAL_CALL SfxClipboardChangeListener::disposing( const lang::EventObject& /*rEventObject*/ )
+throw ( uno::RuntimeException )
+{
+ // either clipboard or ViewShell is going to be destroyed -> no interest in listening anymore
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( pViewShell )
+ {
+ uno::Reference < lang::XComponent > xCtrl( pViewShell->GetController(), uno::UNO_QUERY );
+ if ( xCtrl.is() )
+ xCtrl->removeEventListener( uno::Reference < lang::XEventListener > ( static_cast < lang::XEventListener* >( this ) ) );
+ pViewShell->AddRemoveClipboardListener( uno::Reference < datatransfer::clipboard::XClipboardListener > (this), FALSE );
+ pViewShell = 0;
+ }
+}
+
+void SAL_CALL SfxClipboardChangeListener::changedContents( const datatransfer::clipboard::ClipboardEvent& )
+ throw ( RuntimeException )
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if( pViewShell )
+ {
+ SfxBindings& rBind = pViewShell->GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_PASTE );
+ rBind.Invalidate( SID_PASTE_SPECIAL );
+ rBind.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
+ }
+}
+
+
static ::rtl::OUString RetrieveLabelFromCommand(
const ::rtl::OUString& rCommandURL,
const css::uno::Reference< css::frame::XFrame >& rFrame )
@@ -176,7 +243,12 @@ static ::rtl::OUString RetrieveLabelFromCommand(
}
//=========================================================================
+SfxViewShell_Impl::SfxViewShell_Impl()
+: aInterceptorContainer( aMutex )
+, pAccExec(0)
+{}
+//=========================================================================
SFX_IMPL_INTERFACE(SfxViewShell,SfxShell,SfxResId(0))
{
SFX_CHILDWINDOW_REGISTRATION( SID_MAIL_CHILDWIN );
@@ -687,6 +759,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
case SID_PRINTDOC:
case SID_PRINTDOCDIRECT:
case SID_SETUPPRINTER:
+ case SID_PRINTER_NAME:
{
BOOL bEnabled = pImp->bCanPrint && !pImp->nPrinterLocks;
bEnabled = bEnabled && !Application::GetSettings().GetMiscSettings().GetDisablePrinting();
@@ -720,9 +793,10 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
}
if ( !bEnabled )
{
- rSet.DisableItem( SID_PRINTDOC );
+ // will now be handled by requeing the request
+ /* rSet.DisableItem( SID_PRINTDOC );
rSet.DisableItem( SID_PRINTDOCDIRECT );
- rSet.DisableItem( SID_SETUPPRINTER );
+ rSet.DisableItem( SID_SETUPPRINTER ); */
}
break;
}
@@ -1187,6 +1261,7 @@ SfxViewShell::SfxViewShell
{
DBG_CTOR(SfxViewShell, 0);
+ pImp->pPrinterCommandQueue = new SfxAsyncPrintExec_Impl( this );
pImp->pController = 0;
pImp->bIsShowView =
!(SFX_VIEW_NO_SHOW == (nFlags & SFX_VIEW_NO_SHOW));
@@ -1229,19 +1304,27 @@ SfxViewShell::~SfxViewShell()
SfxViewShellArr_Impl &rViewArr = SFX_APP()->GetViewShells_Impl();
rViewArr.Remove( rViewArr.GetPos(pThis) );
+ if ( pImp->xClipboardListener.is() )
+ {
+ pImp->xClipboardListener->DisconnectViewShell();
+ pImp->xClipboardListener = NULL;
+ }
+
if ( pImp->pController )
{
pImp->pController->ReleaseShell_Impl();
pImp->pController->release();
+ pImp->pController = NULL;
}
if (pImp->pAccExec)
{
- delete pImp->pAccExec;
- pImp->pAccExec = 0;
+ DELETEZ( pImp->pAccExec );
}
- delete pImp;
- delete pIPClientList;
+
+ DELETEZ( pImp->pPrinterCommandQueue );
+ DELETEZ( pImp );
+ DELETEZ( pIPClientList );
}
//--------------------------------------------------------------------
@@ -1926,6 +2009,13 @@ void SfxViewShell::SetController( SfxBaseController* pController )
pImp->pController = pController;
pImp->pController->acquire();
pImp->bControllerSet = TRUE;
+
+ // there should be no old listener, but if there is one, it should be disconnected
+ if ( pImp->xClipboardListener.is() )
+ pImp->xClipboardListener->DisconnectViewShell();
+
+ pImp->xClipboardListener = new SfxClipboardChangeListener( this );
+ AddRemoveClipboardListener( pImp->xClipboardListener.get(), TRUE );
}
Reference < XController > SfxViewShell::GetController()
@@ -2128,3 +2218,28 @@ BOOL SfxViewShell::Escape()
{
return GetViewFrame()->GetBindings().Execute( SID_TERMINATE_INPLACEACTIVATION );
}
+
+void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransfer::clipboard::XClipboardListener >& rClp, BOOL bAdd )
+{
+ try
+ {
+ if ( GetViewFrame() )
+ {
+ uno::Reference< datatransfer::clipboard::XClipboard > xClipboard( GetViewFrame()->GetWindow().GetClipboard() );
+ if( xClipboard.is() )
+ {
+ uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY );
+ if( xClpbrdNtfr.is() )
+ {
+ if( bAdd )
+ xClpbrdNtfr->addClipboardListener( rClp );
+ else
+ xClpbrdNtfr->removeClipboardListener( rClp );
+ }
+ }
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ }
+}
diff --git a/sfx2/util/makefile.mk b/sfx2/util/makefile.mk
index 5ee6e64daca0..10b70b1a1374 100644
--- a/sfx2/util/makefile.mk
+++ b/sfx2/util/makefile.mk
@@ -91,14 +91,12 @@ SHL1STDLIBS+=\
$(TOOLSLIB) \
$(I18NISOLANGLIB) \
$(SAXLIB) \
- $(SYSSHELLLIB) \
$(COMPHELPERLIB) \
$(UCBHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(VOSLIB) \
$(SALLIB) \
- $(SJLIB) \
$(LIBXML2LIB) \