LCOV - code coverage report
Current view: top level - libreoffice/sfx2/source/doc - objserv.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 52 608 8.6 %
Date: 2012-12-27 Functions: 11 38 28.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sot/storage.hxx>
      21             : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      22             : #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
      23             : #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
      24             : #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
      25             : #include <com/sun/star/ui/dialogs/XControlAccess.hpp>
      26             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      27             : #include <com/sun/star/beans/XPropertyAccess.hpp>
      28             : #include <com/sun/star/beans/XPropertySet.hpp>
      29             : #include <com/sun/star/beans/PropertyValue.hpp>
      30             : #include <com/sun/star/container/XNameAccess.hpp>
      31             : #include <com/sun/star/document/XCmisDocument.hpp>
      32             : #include <com/sun/star/document/XExporter.hpp>
      33             : #include <com/sun/star/task/InteractionHandler.hpp>
      34             : #include <com/sun/star/task/XStatusIndicator.hpp>
      35             : #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
      36             : #include <com/sun/star/frame/DocumentTemplates.hpp>
      37             : #include <com/sun/star/frame/XController2.hpp>
      38             : #include <com/sun/star/frame/XDocumentTemplates.hpp>
      39             : #include <com/sun/star/frame/XStorable.hpp>
      40             : #include <comphelper/processfactory.hxx>
      41             : #include <comphelper/servicehelper.hxx>
      42             : #include <com/sun/star/security/CertificateValidity.hpp>
      43             : 
      44             : #include <com/sun/star/security/DocumentSignatureInformation.hpp>
      45             : #include <com/sun/star/security/DocumentDigitalSignatures.hpp>
      46             : #include <tools/urlobj.hxx>
      47             : #include <svl/whiter.hxx>
      48             : #include <vcl/msgbox.hxx>
      49             : #include <svl/intitem.hxx>
      50             : #include <svl/eitem.hxx>
      51             : #include <svl/visitem.hxx>
      52             : #include <vcl/wrkwin.hxx>
      53             : #include <svtools/sfxecode.hxx>
      54             : #include <svtools/ehdl.hxx>
      55             : 
      56             : #include <comphelper/string.hxx>
      57             : #include <basic/sbx.hxx>
      58             : #include <unotools/pathoptions.hxx>
      59             : #include <unotools/useroptions.hxx>
      60             : #include <unotools/saveopt.hxx>
      61             : #include <svtools/asynclink.hxx>
      62             : #include <svtools/miscopt.hxx>
      63             : #include <comphelper/documentconstants.hxx>
      64             : 
      65             : #include <sfx2/app.hxx>
      66             : #include <sfx2/signaturestate.hxx>
      67             : #include "sfx2/sfxresid.hxx"
      68             : #include <sfx2/event.hxx>
      69             : #include <sfx2/request.hxx>
      70             : #include <sfx2/printer.hxx>
      71             : #include <sfx2/viewsh.hxx>
      72             : #include <sfx2/docfilt.hxx>
      73             : #include <sfx2/docfile.hxx>
      74             : #include <sfx2/dispatch.hxx>
      75             : #include <sfx2/dinfdlg.hxx>
      76             : #include <sfx2/objitem.hxx>
      77             : #include <sfx2/objsh.hxx>
      78             : #include "objshimp.hxx"
      79             : #include "sfxtypes.hxx"
      80             : #include <sfx2/module.hxx>
      81             : #include <sfx2/viewfrm.hxx>
      82             : #include "versdlg.hxx"
      83             : #include "doc.hrc"
      84             : #include <sfx2/docfac.hxx>
      85             : #include <sfx2/fcontnr.hxx>
      86             : #include "sfx2/sfxhelp.hxx"
      87             : #include <sfx2/msgpool.hxx>
      88             : #include <sfx2/objface.hxx>
      89             : #include <sfx2/checkin.hxx>
      90             : 
      91             : #include "../appl/app.hrc"
      92             : #include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
      93             : #include <com/sun/star/embed/XTransactedObject.hpp>
      94             : #include <com/sun/star/util/XCloneable.hpp>
      95             : #include <com/sun/star/document/XDocumentProperties.hpp>
      96             : 
      97             : #include "helpid.hrc"
      98             : 
      99             : #include "guisaveas.hxx"
     100             : #include "templatedlg.hxx"
     101             : 
     102             : using namespace ::com::sun::star;
     103             : using namespace ::com::sun::star::lang;
     104             : using namespace ::com::sun::star::uno;
     105             : using namespace ::com::sun::star::ui::dialogs;
     106             : using namespace ::com::sun::star::awt;
     107             : using namespace ::com::sun::star::container;
     108             : using namespace ::com::sun::star::beans;
     109             : using namespace ::com::sun::star::document;
     110             : using namespace ::com::sun::star::task;
     111             : 
     112             : //====================================================================
     113             : 
     114             : class SfxSaveAsContext_Impl
     115             : {
     116             :     String&     _rNewNameVar;
     117             :     String      _aNewName;
     118             : 
     119             : public:
     120             :                 SfxSaveAsContext_Impl( String &rNewNameVar,
     121             :                                        const String &rNewName )
     122             :                 :   _rNewNameVar( rNewNameVar ),
     123             :                     _aNewName( rNewName )
     124             :                 { rNewNameVar = rNewName; }
     125             :                 ~SfxSaveAsContext_Impl()
     126             :                 { _rNewNameVar.Erase(); }
     127             : };
     128             : 
     129             : //====================================================================
     130             : 
     131             : #define SfxObjectShell
     132             : #include "sfxslots.hxx"
     133             : 
     134             : //=========================================================================
     135             : 
     136             : 
     137             : 
     138          92 : SFX_IMPL_INTERFACE(SfxObjectShell,SfxShell,SfxResId(0))
     139             : {
     140          19 : }
     141             : 
     142             : //=========================================================================
     143             : 
     144           0 : class SfxClosePreventer_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XCloseListener >
     145             : {
     146             :     sal_Bool m_bGotOwnership;
     147             :     sal_Bool m_bPreventClose;
     148             : 
     149             : public:
     150             :     SfxClosePreventer_Impl();
     151             : 
     152           0 :     sal_Bool HasOwnership() { return m_bGotOwnership; }
     153             : 
     154           0 :     void SetPreventClose( sal_Bool bPrevent ) { m_bPreventClose = bPrevent; }
     155             : 
     156             :     virtual void SAL_CALL queryClosing( const lang::EventObject& aEvent, sal_Bool bDeliverOwnership )
     157             :         throw ( uno::RuntimeException, util::CloseVetoException );
     158             : 
     159             :     virtual void SAL_CALL notifyClosing( const lang::EventObject& aEvent ) throw ( uno::RuntimeException ) ;
     160             : 
     161             :     virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw ( uno::RuntimeException ) ;
     162             : 
     163             : } ;
     164             : 
     165           0 : SfxClosePreventer_Impl::SfxClosePreventer_Impl()
     166             : : m_bGotOwnership( sal_False )
     167           0 : , m_bPreventClose( sal_True )
     168             : {
     169           0 : }
     170             : 
     171           0 : void SAL_CALL SfxClosePreventer_Impl::queryClosing( const lang::EventObject&, sal_Bool bDeliverOwnership )
     172             :         throw ( uno::RuntimeException, util::CloseVetoException )
     173             : {
     174           0 :     if ( m_bPreventClose )
     175             :     {
     176           0 :         if ( !m_bGotOwnership )
     177           0 :             m_bGotOwnership = bDeliverOwnership;
     178             : 
     179           0 :         throw util::CloseVetoException();
     180             :     }
     181           0 : }
     182             : 
     183           0 : void SAL_CALL SfxClosePreventer_Impl::notifyClosing( const lang::EventObject& ) throw ( uno::RuntimeException )
     184           0 : {}
     185             : 
     186           0 : void SAL_CALL SfxClosePreventer_Impl::disposing( const lang::EventObject& ) throw ( uno::RuntimeException )
     187           0 : {}
     188             : 
     189             : //=========================================================================
     190             : class SfxInstanceCloseGuard_Impl
     191             : {
     192             :     SfxClosePreventer_Impl* m_pPreventer;
     193             :     uno::Reference< util::XCloseListener > m_xPreventer;
     194             :     uno::Reference< util::XCloseable > m_xCloseable;
     195             : 
     196             : public:
     197           0 :     SfxInstanceCloseGuard_Impl()
     198           0 :     : m_pPreventer( NULL )
     199           0 :     {}
     200             : 
     201             :     ~SfxInstanceCloseGuard_Impl();
     202             : 
     203             :     sal_Bool Init_Impl( const uno::Reference< util::XCloseable >& xCloseable );
     204             : };
     205             : 
     206           0 : sal_Bool SfxInstanceCloseGuard_Impl::Init_Impl( const uno::Reference< util::XCloseable >& xCloseable )
     207             : {
     208           0 :     sal_Bool bResult = sal_False;
     209             : 
     210             :     // do not allow reinit after the successful init
     211           0 :     if ( xCloseable.is() && !m_xCloseable.is() )
     212             :     {
     213             :         try
     214             :         {
     215           0 :             m_pPreventer = new SfxClosePreventer_Impl();
     216           0 :             m_xPreventer = uno::Reference< util::XCloseListener >( m_pPreventer );
     217           0 :             xCloseable->addCloseListener( m_xPreventer );
     218           0 :             m_xCloseable = xCloseable;
     219           0 :             bResult = sal_True;
     220             :         }
     221           0 :         catch( uno::Exception& )
     222             :         {
     223             :             OSL_FAIL( "Could not register close listener!\n" );
     224             :         }
     225             :     }
     226             : 
     227           0 :     return bResult;
     228             : }
     229             : 
     230           0 : SfxInstanceCloseGuard_Impl::~SfxInstanceCloseGuard_Impl()
     231             : {
     232           0 :     if ( m_xCloseable.is() && m_xPreventer.is() )
     233             :     {
     234             :         try
     235             :         {
     236           0 :             m_xCloseable->removeCloseListener( m_xPreventer );
     237             :         }
     238           0 :         catch( uno::Exception& )
     239             :         {
     240             :         }
     241             : 
     242             :         try
     243             :         {
     244           0 :             if ( m_pPreventer )
     245             :             {
     246           0 :                 m_pPreventer->SetPreventClose( sal_False );
     247             : 
     248           0 :                 if ( m_pPreventer->HasOwnership() )
     249           0 :                     m_xCloseable->close( sal_True ); // TODO: do it asynchronously
     250             :             }
     251             :         }
     252           0 :         catch( uno::Exception& )
     253             :         {
     254             :         }
     255             :     }
     256           0 : }
     257             : 
     258             : //=========================================================================
     259             : 
     260           0 : void SfxObjectShell::PrintExec_Impl(SfxRequest &rReq)
     261             : {
     262           0 :     SfxViewFrame *pFrame = SfxViewFrame::GetFirst(this);
     263           0 :     if ( pFrame )
     264             :     {
     265           0 :         rReq.SetSlot( SID_PRINTDOC );
     266           0 :         pFrame->GetViewShell()->ExecuteSlot(rReq);
     267             :     }
     268           0 : }
     269             : 
     270             : //--------------------------------------------------------------------
     271             : 
     272           0 : void SfxObjectShell::PrintState_Impl(SfxItemSet &rSet)
     273             : {
     274           0 :     bool bPrinting = false;
     275           0 :     SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this );
     276           0 :     if ( pFrame )
     277             :     {
     278           0 :         SfxPrinter *pPrinter = pFrame->GetViewShell()->GetPrinter();
     279           0 :         bPrinting = pPrinter && pPrinter->IsPrinting();
     280             :     }
     281           0 :     rSet.Put( SfxBoolItem( SID_PRINTOUT, bPrinting ) );
     282           0 : }
     283             : 
     284             : //--------------------------------------------------------------------
     285             : 
     286          55 : sal_Bool SfxObjectShell::APISaveAs_Impl
     287             : (
     288             :     const String& aFileName,
     289             :     SfxItemSet*   aParams
     290             : )
     291             : {
     292          55 :     sal_Bool bOk = sal_False;
     293             : 
     294             :     {DBG_CHKTHIS(SfxObjectShell, 0);}
     295             : 
     296          55 :     if ( GetMedium() )
     297             :     {
     298          55 :         String aFilterName;
     299          55 :         SFX_ITEMSET_ARG( aParams, pFilterNameItem, SfxStringItem, SID_FILTER_NAME, sal_False );
     300          55 :         if( pFilterNameItem )
     301             :         {
     302          55 :             aFilterName = pFilterNameItem->GetValue();
     303             :         }
     304             :         else
     305             :         {
     306           0 :             SFX_ITEMSET_ARG( aParams, pContentTypeItem, SfxStringItem, SID_CONTENTTYPE, sal_False );
     307           0 :             if ( pContentTypeItem )
     308             :             {
     309           0 :                 const SfxFilter* pFilter = SfxFilterMatcher( rtl::OUString::createFromAscii(GetFactory().GetShortName()) ).GetFilter4Mime( pContentTypeItem->GetValue(), SFX_FILTER_EXPORT );
     310           0 :                 if ( pFilter )
     311           0 :                     aFilterName = pFilter->GetName();
     312             :             }
     313             :         }
     314             : 
     315             :         // in case no filter defined use default one
     316          55 :         if( !aFilterName.Len() )
     317             :         {
     318           0 :             const SfxFilter* pFilt = SfxFilter::GetDefaultFilterFromFactory(GetFactory().GetFactoryName());
     319             : 
     320             :             DBG_ASSERT( pFilt, "No default filter!\n" );
     321           0 :             if( pFilt )
     322           0 :                 aFilterName = pFilt->GetFilterName();
     323             : 
     324           0 :             aParams->Put(SfxStringItem( SID_FILTER_NAME, aFilterName));
     325             :         }
     326             : 
     327             : 
     328             :         {
     329          55 :             SfxObjectShellRef xLock( this ); // ???
     330             : 
     331             :             // use the title that is provided in the media descriptor
     332          55 :             SFX_ITEMSET_ARG( aParams, pDocTitleItem, SfxStringItem, SID_DOCINFO_TITLE, sal_False );
     333          55 :             if ( pDocTitleItem )
     334           0 :                 getDocProperties()->setTitle( pDocTitleItem->GetValue() );
     335             : 
     336             :             bOk = CommonSaveAs_Impl( INetURLObject(aFileName), aFilterName,
     337          55 :                 aParams );
     338             : 
     339          55 :         }
     340             :     }
     341             : 
     342          55 :     return bOk;
     343             : }
     344             : 
     345           0 : void SfxObjectShell::CheckOut( )
     346             : {
     347             :     try
     348             :     {
     349           0 :         uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW );
     350           0 :         xCmisDoc->checkOut( );
     351             : 
     352             :         // Remove the info bar
     353           0 :         SfxViewFrame* pViewFrame = GetFrame();
     354           0 :         pViewFrame->RemoveInfoBar( "checkout" );
     355             :     }
     356           0 :     catch ( const uno::RuntimeException& e )
     357             :     {
     358           0 :         ErrorBox* pErrorBox = new ErrorBox( &GetFrame()->GetWindow(), WB_OK, e.Message );
     359           0 :         pErrorBox->Execute( );
     360           0 :         delete pErrorBox;
     361             :     }
     362           0 : }
     363             : 
     364           0 : void SfxObjectShell::CancelCheckOut( )
     365             : {
     366             :     try
     367             :     {
     368           0 :         uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW );
     369           0 :         xCmisDoc->cancelCheckOut( );
     370             : 
     371           0 :         uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY );
     372           0 :         if ( xModifiable.is( ) )
     373           0 :             xModifiable->setModified( sal_False );
     374             :     }
     375           0 :     catch ( const uno::RuntimeException& e )
     376             :     {
     377           0 :         ErrorBox* pErrorBox = new ErrorBox( &GetFrame()->GetWindow(), WB_OK, e.Message );
     378           0 :         pErrorBox->Execute( );
     379           0 :         delete pErrorBox;
     380             :     }
     381           0 : }
     382             : 
     383           0 : void SfxObjectShell::CheckIn( )
     384             : {
     385             :     try
     386             :     {
     387           0 :         uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW );
     388             :         // Pop up dialog to ask for comment and major
     389           0 :         SfxCheckinDialog checkinDlg( &GetFrame( )->GetWindow( ) );
     390           0 :         if ( checkinDlg.Execute( ) == RET_OK )
     391             :         {
     392           0 :             rtl::OUString sComment = checkinDlg.GetComment( );
     393           0 :             sal_Bool bMajor = checkinDlg.IsMajor( );
     394           0 :             xCmisDoc->checkIn( bMajor, sComment );
     395           0 :             uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY );
     396           0 :             if ( xModifiable.is( ) )
     397           0 :                 xModifiable->setModified( sal_False );
     398           0 :         }
     399             :     }
     400           0 :     catch ( const uno::RuntimeException& e )
     401             :     {
     402           0 :         ErrorBox* pErrorBox = new ErrorBox( &GetFrame()->GetWindow(), WB_OK, e.Message );
     403           0 :         pErrorBox->Execute( );
     404           0 :         delete pErrorBox;
     405             :     }
     406           0 : }
     407             : 
     408             : //--------------------------------------------------------------------
     409             : 
     410           0 : void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
     411             : {
     412             :     {DBG_CHKTHIS(SfxObjectShell, 0);}
     413             : 
     414           0 :     sal_uInt16 nId = rReq.GetSlot();
     415             : 
     416           0 :     if( SID_SIGNATURE == nId || SID_MACRO_SIGNATURE == nId )
     417             :     {
     418           0 :         if ( QueryHiddenInformation( WhenSigning, NULL ) == RET_YES )
     419           0 :             ( SID_SIGNATURE == nId ) ? SignDocumentContent() : SignScriptingContent();
     420             :         return;
     421             :     }
     422             : 
     423           0 :     if ( !GetMedium() && nId != SID_CLOSEDOC )
     424             :     {
     425           0 :         rReq.Ignore();
     426             :         return;
     427             :     }
     428             : 
     429             :     // this guard is created here to have it destruction at the end of the method
     430           0 :     SfxInstanceCloseGuard_Impl aModelGuard;
     431             : 
     432           0 :     sal_Bool bIsPDFExport = sal_False;
     433           0 :     switch(nId)
     434             :     {
     435             :         case SID_VERSION:
     436             :         {
     437           0 :             SfxViewFrame* pFrame = GetFrame();
     438           0 :             if ( !pFrame )
     439           0 :                 pFrame = SfxViewFrame::GetFirst( this );
     440           0 :             if ( !pFrame )
     441             :                 return;
     442             : 
     443           0 :             if ( pFrame->GetFrame().GetParentFrame() )
     444             :             {
     445           0 :                 pFrame->GetTopViewFrame()->GetObjectShell()->ExecuteSlot( rReq );
     446             :                 return;
     447             :             }
     448             : 
     449           0 :             if ( !IsOwnStorageFormat_Impl( *GetMedium() ) )
     450             :                 return;
     451             : 
     452           0 :             SfxVersionDialog *pDlg = new SfxVersionDialog( pFrame, IsSaveVersionOnClose() );
     453           0 :             pDlg->Execute();
     454           0 :             SetSaveVersionOnClose( pDlg->IsSaveVersionOnClose() );
     455           0 :             delete pDlg;
     456           0 :             rReq.Done();
     457             :             return;
     458             :         }
     459             : 
     460             :         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     461             :         case SID_DOCINFO:
     462             :         {
     463           0 :             SFX_REQUEST_ARG(rReq, pDocInfItem, SfxDocumentInfoItem, SID_DOCINFO, sal_False);
     464           0 :             if ( pDocInfItem )
     465             :             {
     466             :                 // parameter, e.g. from replayed macro
     467           0 :                 pDocInfItem->UpdateDocumentInfo(getDocProperties(), true);
     468           0 :                 SetUseUserData( pDocInfItem->IsUseUserData() );
     469             :             }
     470             :             else
     471             :             {
     472             :                 // no argument containing DocInfo; check optional arguments
     473           0 :                 sal_Bool bReadOnly = IsReadOnly();
     474           0 :                 SFX_REQUEST_ARG(rReq, pROItem, SfxBoolItem, SID_DOC_READONLY, sal_False);
     475           0 :                 if ( pROItem )
     476             :                     // override readonly attribute of document
     477             :                     // e.g. if a readonly document is saved elsewhere and user asks for editing DocInfo before
     478           0 :                     bReadOnly = pROItem->GetValue();
     479             : 
     480             :                 // collect data for dialog
     481           0 :                 String aURL, aTitle;
     482           0 :                 if ( HasName() )
     483             :                 {
     484           0 :                     aURL = GetMedium()->GetName();
     485           0 :                     aTitle = GetTitle();
     486             :                 }
     487             :                 else
     488             :                 {
     489           0 :                     aURL = DEFINE_CONST_UNICODE( "private:factory/" );
     490           0 :                     aURL += rtl::OUString::createFromAscii( GetFactory().GetShortName() );
     491             : 
     492           0 :                     aTitle = GetTitle();
     493             :                 }
     494             : 
     495             :                 SfxDocumentInfoItem aDocInfoItem( aURL, getDocProperties(),
     496           0 :                     IsUseUserData() );
     497           0 :                 if ( !GetSlotState( SID_DOCTEMPLATE ) )
     498             :                     // templates not supported
     499           0 :                     aDocInfoItem.SetTemplate(sal_False);
     500             : 
     501           0 :                 SfxItemSet aSet(GetPool(), SID_DOCINFO, SID_DOCINFO, SID_DOC_READONLY, SID_DOC_READONLY,
     502             :                                 SID_EXPLORER_PROPS_START, SID_EXPLORER_PROPS_START, SID_BASEURL, SID_BASEURL,
     503           0 :                                 0L );
     504           0 :                 aSet.Put( aDocInfoItem );
     505           0 :                 aSet.Put( SfxBoolItem( SID_DOC_READONLY, bReadOnly ) );
     506           0 :                 aSet.Put( SfxStringItem( SID_EXPLORER_PROPS_START, aTitle ) );
     507           0 :                 aSet.Put( SfxStringItem( SID_BASEURL, GetMedium()->GetBaseURL() ) );
     508             : 
     509             :                 // creating dialog is done via virtual method; application will
     510             :                 // add its own statistics page
     511           0 :                 SfxDocumentInfoDialog *pDlg = CreateDocumentInfoDialog(0, aSet);
     512           0 :                 if ( RET_OK == pDlg->Execute() )
     513             :                 {
     514           0 :                     SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pDocInfoItem, SfxDocumentInfoItem, SID_DOCINFO, sal_False);
     515           0 :                     if ( pDocInfoItem )
     516             :                     {
     517             :                         // user has done some changes to DocumentInfo
     518           0 :                         pDocInfoItem->UpdateDocumentInfo(getDocProperties());
     519           0 :                         SetUseUserData( ((const SfxDocumentInfoItem *)pDocInfoItem)->IsUseUserData() );
     520             : 
     521             :                         // add data from dialog for possible recording purposes
     522             :                         rReq.AppendItem( SfxDocumentInfoItem( GetTitle(),
     523           0 :                             getDocProperties(), IsUseUserData() ) );
     524             :                     }
     525             : 
     526           0 :                     rReq.Done();
     527             :                 }
     528             :                 else
     529             :                     // nothing done; no recording
     530           0 :                     rReq.Ignore();
     531             : 
     532           0 :                 delete pDlg;
     533             :             }
     534             : 
     535             :             return;
     536             :         }
     537             : 
     538             :         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     539             : 
     540             :         case SID_EXPORTDOCASPDF:
     541             :         case SID_DIRECTEXPORTDOCASPDF:
     542           0 :             bIsPDFExport = sal_True;
     543             :         case SID_EXPORTDOC:
     544             :         case SID_SAVEASDOC:
     545             :         case SID_SAVEDOC:
     546             :         {
     547             :             // derived class may decide to abort this
     548           0 :             if( !QuerySlotExecutable( nId ) )
     549             :             {
     550           0 :                 rReq.SetReturnValue( SfxBoolItem( 0, sal_False ) );
     551             :                 return;
     552             :             }
     553             : 
     554             :             //!! detailed analysis of an error code
     555           0 :             SfxObjectShellRef xLock( this );
     556             : 
     557             :             // the model can not be closed till the end of this method
     558             :             // if somebody tries to close it during this time the model will be closed
     559             :             // at the end of the method
     560           0 :             aModelGuard.Init_Impl( uno::Reference< util::XCloseable >( GetModel(), uno::UNO_QUERY ) );
     561             : 
     562           0 :             sal_Bool bDialogUsed = sal_False;
     563           0 :             sal_uInt32 nErrorCode = ERRCODE_NONE;
     564             : 
     565             :             // by default versions should be preserved always except in case of an explicit
     566             :             // SaveAs via GUI, so the flag must be set accordingly
     567           0 :             pImp->bPreserveVersions = (nId == SID_SAVEDOC);
     568             :             try
     569             :             {
     570           0 :                 SfxErrorContext aEc( ERRCTX_SFX_SAVEASDOC, GetTitle() ); // ???
     571             : 
     572           0 :                 if ( nId == SID_SAVEASDOC )
     573             :                 {
     574             :                     // in case of plugin mode the SaveAs operation means SaveTo
     575           0 :                     SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pViewOnlyItem, SfxBoolItem, SID_VIEWONLY, sal_False );
     576           0 :                     if ( pViewOnlyItem && pViewOnlyItem->GetValue() )
     577           0 :                         rReq.AppendItem( SfxBoolItem( SID_SAVETO, sal_True ) );
     578             :                 }
     579             : 
     580             :                 // TODO/LATER: do the following GUI related actions in standalown method
     581             :                 // ========================================================================================================
     582             :                 // Introduce a status indicator for GUI operation
     583           0 :                 SFX_REQUEST_ARG( rReq, pStatusIndicatorItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, sal_False );
     584           0 :                 if ( !pStatusIndicatorItem )
     585             :                 {
     586             :                     // get statusindicator
     587           0 :                     uno::Reference< task::XStatusIndicator > xStatusIndicator;
     588           0 :                     uno::Reference < frame::XController > xCtrl( GetModel()->getCurrentController() );
     589           0 :                     if ( xCtrl.is() )
     590             :                     {
     591           0 :                         uno::Reference< task::XStatusIndicatorFactory > xStatFactory( xCtrl->getFrame(), uno::UNO_QUERY );
     592           0 :                         if( xStatFactory.is() )
     593           0 :                             xStatusIndicator = xStatFactory->createStatusIndicator();
     594             :                     }
     595             : 
     596             :                     OSL_ENSURE( xStatusIndicator.is(), "Can not retrieve default status indicator!\n" );
     597             : 
     598           0 :                     if ( xStatusIndicator.is() )
     599             :                     {
     600           0 :                         SfxUnoAnyItem aStatIndItem( SID_PROGRESS_STATUSBAR_CONTROL, uno::makeAny( xStatusIndicator ) );
     601             : 
     602           0 :                         if ( nId == SID_SAVEDOC )
     603             :                         {
     604             :                             // in case of saving it is not possible to transport the parameters from here
     605             :                             // but it is not clear here whether the saving will be done or saveAs operation
     606           0 :                             GetMedium()->GetItemSet()->Put( aStatIndItem );
     607             :                         }
     608             : 
     609           0 :                         rReq.AppendItem( aStatIndItem );
     610           0 :                     }
     611             :                 }
     612           0 :                 else if ( nId == SID_SAVEDOC )
     613             :                 {
     614             :                     // in case of saving it is not possible to transport the parameters from here
     615             :                     // but it is not clear here whether the saving will be done or saveAs operation
     616           0 :                     GetMedium()->GetItemSet()->Put( *pStatusIndicatorItem );
     617             :                 }
     618             : 
     619             :                 // Introduce an interaction handler for GUI operation
     620           0 :                 SFX_REQUEST_ARG( rReq, pInteractionHandlerItem, SfxUnoAnyItem, SID_INTERACTIONHANDLER, sal_False );
     621           0 :                 if ( !pInteractionHandlerItem )
     622             :                 {
     623           0 :                     uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
     624             :                     uno::Reference< task::XInteractionHandler2 > xInteract(
     625           0 :                         task::InteractionHandler::createWithParent(xContext, 0) );
     626             : 
     627           0 :                     SfxUnoAnyItem aInteractionItem( SID_INTERACTIONHANDLER, uno::makeAny( xInteract ) );
     628           0 :                     if ( nId == SID_SAVEDOC )
     629             :                     {
     630             :                         // in case of saving it is not possible to transport the parameters from here
     631             :                         // but it is not clear here whether the saving will be done or saveAs operation
     632           0 :                         GetMedium()->GetItemSet()->Put( aInteractionItem );
     633             :                     }
     634             : 
     635           0 :                     rReq.AppendItem( aInteractionItem );
     636             :                 }
     637           0 :                 else if ( nId == SID_SAVEDOC )
     638             :                 {
     639             :                     // in case of saving it is not possible to transport the parameters from here
     640             :                     // but it is not clear here whether the saving will be done or saveAs operation
     641           0 :                     GetMedium()->GetItemSet()->Put( *pInteractionHandlerItem );
     642             :                 }
     643             :                 // ========================================================================================================
     644             : 
     645           0 :                 sal_Bool bPreselectPassword = sal_False;
     646           0 :                 SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False );
     647           0 :                 SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldPasswordItem, SfxStringItem, SID_PASSWORD, sal_False );
     648           0 :                 if ( pOldEncryptionDataItem || pOldPasswordItem )
     649           0 :                     bPreselectPassword = sal_True;
     650             : 
     651           0 :                 uno::Sequence< beans::PropertyValue > aDispatchArgs;
     652           0 :                 if ( rReq.GetArgs() )
     653             :                     TransformItems( nId,
     654           0 :                                     *rReq.GetArgs(),
     655             :                                      aDispatchArgs,
     656           0 :                                      NULL );
     657             : 
     658           0 :                 const SfxSlot* pSlot = GetModule()->GetSlotPool()->GetSlot( nId );
     659           0 :                 if ( !pSlot )
     660           0 :                     throw uno::Exception();
     661             : 
     662           0 :                 uno::Reference< lang::XMultiServiceFactory > xEmptyFactory;
     663           0 :                 SfxStoringHelper aHelper( xEmptyFactory );
     664             : 
     665           0 :                 if ( QueryHiddenInformation( bIsPDFExport ? WhenCreatingPDF : WhenSaving, NULL ) == RET_YES )
     666             :                 {
     667             :                     bDialogUsed = aHelper.GUIStoreModel( GetModel(),
     668             :                                                          ::rtl::OUString::createFromAscii( pSlot->GetUnoName() ),
     669             :                                                          aDispatchArgs,
     670             :                                                          bPreselectPassword,
     671             :                                                          GetSharedFileURL(),
     672           0 :                                                          GetDocumentSignatureState() );
     673             :                 }
     674             :                 else
     675             :                 {
     676             :                     // the user has decided not to store the document
     677             :                     throw task::ErrorCodeIOException( ::rtl::OUString(),
     678             :                                                       uno::Reference< uno::XInterface >(),
     679           0 :                                                       ERRCODE_IO_ABORT );
     680             :                 }
     681             : 
     682             :                 // merge aDispatchArgs to the request
     683           0 :                 SfxAllItemSet aResultParams( GetPool() );
     684             :                 TransformParameters( nId,
     685             :                                      aDispatchArgs,
     686             :                                      aResultParams,
     687           0 :                                      NULL );
     688           0 :                 rReq.SetArgs( aResultParams );
     689             : 
     690           0 :                 SFX_REQUEST_ARG( rReq, pFilterNameItem, SfxStringItem, SID_FILTER_NAME, sal_False );
     691           0 :                 ::rtl::OUString aFilterName = pFilterNameItem ? ::rtl::OUString( pFilterNameItem->GetValue() )
     692           0 :                                                               : ::rtl::OUString();
     693           0 :                 const SfxFilter* pFilt = GetFactory().GetFilterContainer()->GetFilter4FilterName( aFilterName );
     694             : 
     695             :                 OSL_ENSURE( nId == SID_SAVEDOC || pFilt, "The filter can not be zero since it was used for storing!\n" );
     696           0 :                 if  (   bDialogUsed && pFilt
     697           0 :                     &&  pFilt->IsOwnFormat()
     698           0 :                     &&  pFilt->UsesStorage()
     699           0 :                     &&  pFilt->GetVersion() >= SOFFICE_FILEFORMAT_60 )
     700             :                 {
     701           0 :                     SfxViewFrame* pDocViewFrame = SfxViewFrame::GetFirst( this );
     702           0 :                     if ( pDocViewFrame )
     703           0 :                         SfxHelp::OpenHelpAgent( &pDocViewFrame->GetFrame(), HID_DID_SAVE_PACKED_XML );
     704             :                 }
     705             : 
     706             :                 // the StoreAsURL/StoreToURL method have called this method with false
     707             :                 // so it has to be restored to true here since it is a call from GUI
     708           0 :                 GetMedium()->SetUpdatePickList( sal_True );
     709             : 
     710             :                 // TODO: in future it must be done in followind way
     711             :                 // if document is opened from GUI it is immediatelly appeares in the picklist
     712             :                 // if the document is a new one then it appeares in the picklist immediatelly
     713             :                 // after SaveAs operation triggered from GUI
     714             :             }
     715           0 :             catch( const task::ErrorCodeIOException& aErrorEx )
     716             :             {
     717           0 :                 nErrorCode = (sal_uInt32)aErrorEx.ErrCode;
     718             :             }
     719           0 :             catch( Exception& )
     720             :             {
     721           0 :                 nErrorCode = ERRCODE_IO_GENERAL;
     722             :             }
     723             : 
     724             :             // by default versions should be preserved always except in case of an explicit
     725             :             // SaveAs via GUI, so the flag must be reset to guarantee this
     726           0 :             pImp->bPreserveVersions = sal_True;
     727           0 :             sal_uIntPtr lErr=GetErrorCode();
     728             : 
     729           0 :             if ( !lErr && nErrorCode )
     730           0 :                 lErr = nErrorCode;
     731             : 
     732           0 :             if ( lErr && nErrorCode == ERRCODE_NONE )
     733             :             {
     734           0 :                 SFX_REQUEST_ARG( rReq, pWarnItem, SfxBoolItem, SID_FAIL_ON_WARNING, sal_False );
     735           0 :                 if ( pWarnItem && pWarnItem->GetValue() )
     736           0 :                     nErrorCode = lErr;
     737             :             }
     738             : 
     739             :             // may be nErrorCode should be shown in future
     740           0 :             if ( lErr != ERRCODE_IO_ABORT )
     741             :             {
     742           0 :                 SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC,GetTitle());
     743           0 :                 ErrorHandler::HandleError( lErr );
     744             :             }
     745             : 
     746           0 :             if ( nId == SID_EXPORTDOCASPDF )
     747             :             {
     748             :                 // This function is used by the SendMail function that needs information if a export
     749             :                 // file was written or not. This could be due to cancellation of the export
     750             :                 // or due to an error. So IO abort must be handled like an error!
     751           0 :                 nErrorCode = ( lErr != ERRCODE_IO_ABORT ) && ( nErrorCode == ERRCODE_NONE ) ? nErrorCode : lErr;
     752             :             }
     753             : 
     754           0 :             if (nId == SID_SAVEASDOC && nErrorCode == ERRCODE_NONE)
     755             :             {
     756           0 :                 SetReadOnlyUI(false);
     757             :             }
     758             : 
     759           0 :             rReq.SetReturnValue( SfxBoolItem(0, nErrorCode == ERRCODE_NONE ) );
     760             : 
     761           0 :             ResetError();
     762             : 
     763           0 :             Invalidate();
     764           0 :             break;
     765             :         }
     766             : 
     767             :         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     768             : 
     769             :         case SID_CLOSEDOC:
     770             :         {
     771           0 :             SfxViewFrame *pFrame = GetFrame();
     772           0 :             if ( pFrame && pFrame->GetFrame().GetParentFrame() )
     773             :             {
     774             :                 // If SID_CLOSEDOC is excecuted through menu and so on, but
     775             :                 // the current document is in a frame, then the
     776             :                 // FrameSetDocument should actually be closed.
     777           0 :                 pFrame->GetTopViewFrame()->GetObjectShell()->ExecuteSlot( rReq );
     778           0 :                 rReq.Done();
     779             :                 return;
     780             :             }
     781             : 
     782           0 :             sal_Bool bInFrameSet = sal_False;
     783           0 :             sal_uInt16 nFrames=0;
     784           0 :             pFrame = SfxViewFrame::GetFirst( this );
     785           0 :             while ( pFrame )
     786             :             {
     787           0 :                 if ( pFrame->GetFrame().GetParentFrame() )
     788             :                 {
     789             :                     // In this document there still exists a view that is
     790             :                     // in a FrameSet , which of course may not be closed
     791             :                     // geclosed werden
     792           0 :                     bInFrameSet = sal_True;
     793             :                 }
     794             :                 else
     795           0 :                     nFrames++;
     796             : 
     797           0 :                 pFrame = SfxViewFrame::GetNext( *pFrame, this );
     798             :             }
     799             : 
     800           0 :             if ( bInFrameSet )
     801             :             {
     802             :                 // Close all views that are not in a FrameSet.
     803           0 :                 pFrame = SfxViewFrame::GetFirst( this );
     804           0 :                 while ( pFrame )
     805             :                 {
     806           0 :                     if ( !pFrame->GetFrame().GetParentFrame() )
     807           0 :                         pFrame->GetFrame().DoClose();
     808           0 :                     pFrame = SfxViewFrame::GetNext( *pFrame, this );
     809             :                 }
     810             :             }
     811             : 
     812             :             // Evaluate Parameter
     813           0 :             SFX_REQUEST_ARG(rReq, pSaveItem, SfxBoolItem, SID_CLOSEDOC_SAVE, sal_False);
     814           0 :             SFX_REQUEST_ARG(rReq, pNameItem, SfxStringItem, SID_CLOSEDOC_FILENAME, sal_False);
     815           0 :             if ( pSaveItem )
     816             :             {
     817           0 :                 if ( pSaveItem->GetValue() )
     818             :                 {
     819           0 :                     if ( !pNameItem )
     820             :                     {
     821             : #ifndef DISABLE_SCRIPTING
     822           0 :                         SbxBase::SetError( SbxERR_WRONG_ARGS );
     823             : #endif
     824           0 :                         rReq.Ignore();
     825             :                         return;
     826             :                     }
     827           0 :                     SfxAllItemSet aArgs( GetPool() );
     828           0 :                     SfxStringItem aTmpItem( SID_FILE_NAME, pNameItem->GetValue() );
     829           0 :                     aArgs.Put( aTmpItem, aTmpItem.Which() );
     830           0 :                     SfxRequest aSaveAsReq( SID_SAVEASDOC, SFX_CALLMODE_API, aArgs );
     831           0 :                     ExecFile_Impl( aSaveAsReq );
     832           0 :                     if ( !aSaveAsReq.IsDone() )
     833             :                     {
     834           0 :                         rReq.Ignore();
     835             :                         return;
     836           0 :                     }
     837             :                 }
     838             :                 else
     839           0 :                     SetModified(sal_False);
     840             :             }
     841             : 
     842             :             // Cancelled by the user?
     843           0 :             if ( !PrepareClose( 2 ) )
     844             :             {
     845           0 :                 rReq.SetReturnValue( SfxBoolItem(0, sal_False) );
     846           0 :                 rReq.Done();
     847             :                 return;
     848             :             }
     849             : 
     850           0 :             SetModified( sal_False );
     851           0 :             sal_uIntPtr lErr = GetErrorCode();
     852           0 :             ErrorHandler::HandleError(lErr);
     853             : 
     854           0 :             rReq.SetReturnValue( SfxBoolItem(0, sal_True) );
     855           0 :             rReq.Done();
     856           0 :             rReq.ReleaseArgs(); // because the pool is destroyed in Close
     857           0 :             DoClose();
     858             :             return;
     859             :         }
     860             : 
     861             :         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     862             :         case SID_DOCTEMPLATE:
     863             :         {
     864             :             // save as document templates
     865           0 :             SfxTemplateManagerDlg aDlg;
     866           0 :             aDlg.setDocumentModel(GetModel());
     867           0 :             aDlg.setSaveMode(true);
     868           0 :             aDlg.Execute();
     869             : 
     870           0 :             break;
     871             :         }
     872             : 
     873             :         case SID_CHECKOUT:
     874             :         {
     875           0 :             CheckOut( );
     876           0 :             break;
     877             :         }
     878             :         case SID_CANCELCHECKOUT:
     879             :         {
     880           0 :             if (  QueryBox( NULL, SfxResId( RID_QUERY_CANCELCHECKOUT ) ).Execute( ) == RET_YES )
     881             :             {
     882           0 :                 CancelCheckOut( );
     883             :             }
     884           0 :             break;
     885             :         }
     886             :         case SID_CHECKIN:
     887             :         {
     888           0 :             CheckIn( );
     889           0 :             break;
     890             :         }
     891             :     }
     892             : 
     893             :     // Prevent entry in the Pick-lists
     894           0 :     if ( rReq.IsAPI() )
     895           0 :         GetMedium()->SetUpdatePickList( sal_False );
     896           0 :     else if ( rReq.GetArgs() )
     897             :     {
     898           0 :         SFX_ITEMSET_GET( *rReq.GetArgs(), pPicklistItem, SfxBoolItem, SID_PICKLIST, sal_False );
     899           0 :         if ( pPicklistItem )
     900           0 :             GetMedium()->SetUpdatePickList( pPicklistItem->GetValue() );
     901             :     }
     902             : 
     903             :     // Ignore()-branches have already returned
     904           0 :     rReq.Done();
     905             : }
     906             : 
     907             : //-------------------------------------------------------------------------
     908             : 
     909           0 : void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
     910             : {
     911             :     DBG_CHKTHIS(SfxObjectShell, 0);
     912           0 :     SfxWhichIter aIter( rSet );
     913             : 
     914           0 :     for ( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich() )
     915             :     {
     916           0 :         switch ( nWhich )
     917             :         {
     918             :             case SID_DOCTEMPLATE :
     919             :             {
     920           0 :                 if ( !GetFactory().GetTemplateFilter() )
     921           0 :                     rSet.DisableItem( nWhich );
     922           0 :                 break;
     923             :             }
     924             : 
     925             :             case SID_CHECKOUT:
     926             :                 {
     927           0 :                     bool bShow = false;
     928           0 :                     Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY );
     929           0 :                     beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
     930             : 
     931           0 :                     if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
     932             :                     {
     933             :                         // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut
     934           0 :                         bool bFoundCheckedout = false;
     935           0 :                         sal_Bool bCheckedOut = sal_False;
     936           0 :                         for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i )
     937             :                         {
     938           0 :                             if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" )
     939             :                             {
     940           0 :                                 bFoundCheckedout = true;
     941           0 :                                 aCmisProperties[i].Value >>= bCheckedOut;
     942             :                             }
     943             :                         }
     944           0 :                         bShow = !bCheckedOut;
     945             :                     }
     946             : 
     947           0 :                     if ( !bShow )
     948             :                     {
     949           0 :                         rSet.DisableItem( nWhich );
     950           0 :                         rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
     951           0 :                     }
     952             :                 }
     953           0 :                 break;
     954             : 
     955             :             case SID_CANCELCHECKOUT:
     956             :             case SID_CHECKIN:
     957             :                 {
     958           0 :                     bool bShow = false;
     959           0 :                     Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY );
     960           0 :                     beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
     961             : 
     962           0 :                     if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
     963             :                     {
     964             :                         // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut
     965           0 :                         bool bFoundCheckedout = false;
     966           0 :                         sal_Bool bCheckedOut = sal_False;
     967           0 :                         for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i )
     968             :                         {
     969           0 :                             if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" )
     970             :                             {
     971           0 :                                 bFoundCheckedout = true;
     972           0 :                                 aCmisProperties[i].Value >>= bCheckedOut;
     973             :                             }
     974             :                         }
     975           0 :                         bShow = bCheckedOut;
     976             :                     }
     977             : 
     978           0 :                     if ( !bShow )
     979             :                     {
     980           0 :                         rSet.DisableItem( nWhich );
     981           0 :                         rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
     982           0 :                     }
     983             :                 }
     984           0 :                 break;
     985             : 
     986             :             case SID_VERSION:
     987             :                 {
     988           0 :                     SfxObjectShell *pDoc = this;
     989           0 :                     SfxViewFrame* pFrame = GetFrame();
     990           0 :                     if ( !pFrame )
     991           0 :                         pFrame = SfxViewFrame::GetFirst( this );
     992           0 :                     if ( pFrame  )
     993             :                     {
     994           0 :                         if ( pFrame->GetFrame().GetParentFrame() )
     995             :                         {
     996           0 :                             pFrame = pFrame->GetTopViewFrame();
     997           0 :                             pDoc = pFrame->GetObjectShell();
     998             :                         }
     999             :                     }
    1000             : 
    1001           0 :                     if ( !pFrame || !pDoc->HasName() ||
    1002           0 :                         !IsOwnStorageFormat_Impl( *pDoc->GetMedium() ) )
    1003           0 :                         rSet.DisableItem( nWhich );
    1004           0 :                     break;
    1005             :                 }
    1006             :             case SID_SAVEDOC:
    1007             :                 {
    1008           0 :                     SvtMiscOptions aMiscOptions;
    1009           0 :                     bool bAlwaysAllowSave = aMiscOptions.IsSaveAlwaysAllowed();
    1010           0 :                     bool bAllowSave = (bAlwaysAllowSave || IsModified());
    1011           0 :                     bool bMediumRO = IsReadOnlyMedium();
    1012           0 :                     if ( !bMediumRO && GetMedium() && bAllowSave )
    1013             :                         rSet.Put(SfxStringItem(
    1014           0 :                             nWhich, SfxResId(STR_SAVEDOC).toString()));
    1015             :                     else
    1016           0 :                         rSet.DisableItem(nWhich);
    1017             :                 }
    1018           0 :                 break;
    1019             : 
    1020             :             case SID_DOCINFO:
    1021           0 :                 if ( 0 != ( pImp->eFlags & SFXOBJECTSHELL_NODOCINFO ) )
    1022           0 :                     rSet.DisableItem( nWhich );
    1023           0 :                 break;
    1024             : 
    1025             :             case SID_CLOSEDOC:
    1026             :             {
    1027           0 :                 SfxObjectShell *pDoc = this;
    1028           0 :                 SfxViewFrame *pFrame = GetFrame();
    1029           0 :                 if ( pFrame && pFrame->GetFrame().GetParentFrame() )
    1030             :                 {
    1031             : 
    1032             :                     // If SID_CLOSEDOC is excecuted through menu and so on, but
    1033             :                     // the current document is in a frame, then the
    1034             :                     // FrameSetDocument should actually be closed.
    1035           0 :                     pDoc = pFrame->GetTopViewFrame()->GetObjectShell();
    1036             :                 }
    1037             : 
    1038           0 :                 if ( pDoc->GetFlags() & SFXOBJECTSHELL_DONTCLOSE )
    1039           0 :                     rSet.DisableItem(nWhich);
    1040             :                 else
    1041           0 :                     rSet.Put(SfxStringItem(nWhich, SfxResId(STR_CLOSEDOC).toString()));
    1042           0 :                 break;
    1043             :             }
    1044             : 
    1045             :             case SID_SAVEASDOC:
    1046             :             {
    1047           0 :                 if( ( pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) != SFX_LOADED_MAINDOCUMENT )
    1048             :                 {
    1049           0 :                     rSet.DisableItem( nWhich );
    1050           0 :                     break;
    1051             :                 }
    1052           0 :                 if ( /*!pCombinedFilters ||*/ !GetMedium() )
    1053           0 :                     rSet.DisableItem( nWhich );
    1054             :                 else
    1055           0 :                     rSet.Put( SfxStringItem( nWhich, SfxResId(STR_SAVEASDOC).toString() ) );
    1056           0 :                 break;
    1057             :             }
    1058             : 
    1059             :             case SID_EXPORTDOCASPDF:
    1060             :             case SID_DIRECTEXPORTDOCASPDF:
    1061             :             {
    1062           0 :                 break;
    1063             :             }
    1064             : 
    1065             :             case SID_DOC_MODIFIED:
    1066             :             {
    1067           0 :                 rSet.Put( SfxBoolItem( SID_DOC_MODIFIED, IsModified() ) );
    1068           0 :                 break;
    1069             :             }
    1070             : 
    1071             :             case SID_MODIFIED:
    1072             :             {
    1073           0 :                 rSet.Put( SfxBoolItem( SID_MODIFIED, IsModified() ) );
    1074           0 :                 break;
    1075             :             }
    1076             : 
    1077             :             case SID_DOCINFO_TITLE:
    1078             :             {
    1079             :                 rSet.Put( SfxStringItem(
    1080           0 :                     SID_DOCINFO_TITLE, getDocProperties()->getTitle() ) );
    1081           0 :                 break;
    1082             :             }
    1083             :             case SID_FILE_NAME:
    1084             :             {
    1085           0 :                 if( GetMedium() && HasName() )
    1086             :                     rSet.Put( SfxStringItem(
    1087           0 :                         SID_FILE_NAME, GetMedium()->GetName() ) );
    1088           0 :                 break;
    1089             :             }
    1090             :             case SID_SIGNATURE:
    1091             :             {
    1092           0 :                 rSet.Put( SfxUInt16Item( SID_SIGNATURE, GetDocumentSignatureState() ) );
    1093           0 :                 break;
    1094             :             }
    1095             :             case SID_MACRO_SIGNATURE:
    1096             :             {
    1097             :                 // the slot makes sense only if there is a macro in the document
    1098           0 :                 if ( pImp->documentStorageHasMacros() || pImp->aMacroMode.hasMacroLibrary() )
    1099           0 :                     rSet.Put( SfxUInt16Item( SID_MACRO_SIGNATURE, GetScriptingSignatureState() ) );
    1100             :                 else
    1101           0 :                     rSet.DisableItem( nWhich );
    1102           0 :                 break;
    1103             :             }
    1104             :         }
    1105           0 :     }
    1106           0 : }
    1107             : 
    1108             : //--------------------------------------------------------------------
    1109             : 
    1110           0 : void SfxObjectShell::ExecProps_Impl(SfxRequest &rReq)
    1111             : {
    1112           0 :     switch ( rReq.GetSlot() )
    1113             :     {
    1114             :         case SID_MODIFIED:
    1115             :         {
    1116           0 :             SetModified( ( (SfxBoolItem&) rReq.GetArgs()->Get(SID_MODIFIED)).GetValue() );
    1117           0 :             rReq.Done();
    1118           0 :             break;
    1119             :         }
    1120             : 
    1121             :         case SID_DOCTITLE:
    1122           0 :             SetTitle( ( (SfxStringItem&) rReq.GetArgs()->Get(SID_DOCTITLE)).GetValue() );
    1123           0 :             rReq.Done();
    1124           0 :             break;
    1125             : 
    1126             :         case SID_DOCINFO_AUTHOR :
    1127             :         {
    1128           0 :             ::rtl::OUString aStr = ( (SfxStringItem&)rReq.GetArgs()->Get(rReq.GetSlot())).GetValue();
    1129           0 :             getDocProperties()->setAuthor( aStr );
    1130           0 :             break;
    1131             :         }
    1132             : 
    1133             :         case SID_DOCINFO_COMMENTS :
    1134             :         {
    1135           0 :             ::rtl::OUString aStr = ( (SfxStringItem&)rReq.GetArgs()->Get(rReq.GetSlot())).GetValue();
    1136           0 :             getDocProperties()->setDescription( aStr );
    1137           0 :             break;
    1138             :         }
    1139             : 
    1140             :         case SID_DOCINFO_KEYWORDS :
    1141             :         {
    1142           0 :             ::rtl::OUString aStr = ( (SfxStringItem&)rReq.GetArgs()->Get(rReq.GetSlot())).GetValue();
    1143           0 :             getDocProperties()->setKeywords(
    1144           0 :                 ::comphelper::string::convertCommaSeparated(aStr) );
    1145           0 :             break;
    1146             :         }
    1147             :     }
    1148           0 : }
    1149             : 
    1150             : //--------------------------------------------------------------------
    1151             : 
    1152           0 : void SfxObjectShell::StateProps_Impl(SfxItemSet &rSet)
    1153             : {
    1154           0 :     SfxWhichIter aIter(rSet);
    1155           0 :     for ( sal_uInt16 nSID = aIter.FirstWhich(); nSID; nSID = aIter.NextWhich() )
    1156             :     {
    1157           0 :         switch ( nSID )
    1158             :         {
    1159             :             case SID_DOCINFO_AUTHOR :
    1160             :             {
    1161             :                 rSet.Put( SfxStringItem( nSID,
    1162           0 :                             getDocProperties()->getAuthor() ) );
    1163           0 :                 break;
    1164             :             }
    1165             : 
    1166             :             case SID_DOCINFO_COMMENTS :
    1167             :             {
    1168             :                 rSet.Put( SfxStringItem( nSID,
    1169           0 :                             getDocProperties()->getDescription()) );
    1170           0 :                 break;
    1171             :             }
    1172             : 
    1173             :             case SID_DOCINFO_KEYWORDS :
    1174             :             {
    1175             :                 rSet.Put( SfxStringItem( nSID, ::comphelper::string::
    1176           0 :                     convertCommaSeparated(getDocProperties()->getKeywords())) );
    1177           0 :                 break;
    1178             :             }
    1179             : 
    1180             :             case SID_DOCPATH:
    1181             :             {
    1182             :                 OSL_FAIL( "Not supported anymore!" );
    1183           0 :                 break;
    1184             :             }
    1185             : 
    1186             :             case SID_DOCFULLNAME:
    1187             :             {
    1188           0 :                 rSet.Put( SfxStringItem( SID_DOCFULLNAME, GetTitle(SFX_TITLE_FULLNAME) ) );
    1189           0 :                 break;
    1190             :             }
    1191             : 
    1192             :             case SID_DOCTITLE:
    1193             :             {
    1194           0 :                 rSet.Put( SfxStringItem( SID_DOCTITLE, GetTitle() ) );
    1195           0 :                 break;
    1196             :             }
    1197             : 
    1198             :             case SID_DOC_READONLY:
    1199             :             {
    1200           0 :                 rSet.Put( SfxBoolItem( SID_DOC_READONLY, IsReadOnly() ) );
    1201           0 :                 break;
    1202             :             }
    1203             : 
    1204             :             case SID_DOC_SAVED:
    1205             :             {
    1206           0 :                 rSet.Put( SfxBoolItem( SID_DOC_SAVED, !IsModified() ) );
    1207           0 :                 break;
    1208             :             }
    1209             : 
    1210             :             case SID_CLOSING:
    1211             :             {
    1212           0 :                 rSet.Put( SfxBoolItem( SID_CLOSING, false ) );
    1213           0 :                 break;
    1214             :             }
    1215             : 
    1216             :             case SID_DOC_LOADING:
    1217             :                 rSet.Put( SfxBoolItem( nSID, SFX_LOADED_MAINDOCUMENT !=
    1218           0 :                             ( pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) ) );
    1219           0 :                 break;
    1220             : 
    1221             :             case SID_IMG_LOADING:
    1222             :                 rSet.Put( SfxBoolItem( nSID, SFX_LOADED_IMAGES !=
    1223           0 :                             ( pImp->nLoadedFlags & SFX_LOADED_IMAGES ) ) );
    1224           0 :                 break;
    1225             :         }
    1226           0 :     }
    1227           0 : }
    1228             : 
    1229             : //--------------------------------------------------------------------
    1230             : 
    1231           0 : void SfxObjectShell::ExecView_Impl(SfxRequest &rReq)
    1232             : {
    1233           0 :     switch ( rReq.GetSlot() )
    1234             :     {
    1235             :         case SID_ACTIVATE:
    1236             :         {
    1237           0 :             SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, sal_True );
    1238           0 :             if ( pFrame )
    1239           0 :                 pFrame->GetFrame().Appear();
    1240           0 :             rReq.SetReturnValue( SfxObjectItem( 0, pFrame ) );
    1241           0 :             rReq.Done();
    1242           0 :             break;
    1243             :         }
    1244             :         case SID_NEWWINDOWFOREDIT:
    1245             :         {
    1246           0 :             SfxViewFrame* pFrame = SfxViewFrame::Current();
    1247           0 :             if( pFrame->GetObjectShell() == this &&
    1248           0 :                 ( pFrame->GetFrameType() & SFXFRAME_HASTITLE ) )
    1249           0 :                 pFrame->ExecuteSlot( rReq );
    1250             :             else
    1251             :             {
    1252           0 :                 String aFileName( GetObjectShell()->GetMedium()->GetName() );
    1253           0 :                 if ( aFileName.Len() )
    1254             :                 {
    1255           0 :                     SfxStringItem aName( SID_FILE_NAME, aFileName );
    1256           0 :                     SfxBoolItem aCreateView( SID_OPEN_NEW_VIEW, sal_True );
    1257             :                     SFX_APP()->GetAppDispatcher_Impl()->Execute(
    1258             :                         SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, &aName,
    1259           0 :                         &aCreateView, 0L);
    1260           0 :                 }
    1261             :             }
    1262             :         }
    1263             :     }
    1264           0 : }
    1265             : 
    1266             : //--------------------------------------------------------------------
    1267             : 
    1268           0 : void SfxObjectShell::StateView_Impl(SfxItemSet& /*rSet*/)
    1269             : {
    1270           0 : }
    1271             : 
    1272         489 : sal_uInt16 SfxObjectShell::ImplCheckSignaturesInformation( const uno::Sequence< security::DocumentSignatureInformation >& aInfos )
    1273             : {
    1274         489 :     sal_Bool bCertValid = sal_True;
    1275         489 :     sal_uInt16 nResult = SIGNATURESTATE_NOSIGNATURES;
    1276         489 :     int nInfos = aInfos.getLength();
    1277         489 :     bool bCompleteSignature = true;
    1278         489 :     if( nInfos )
    1279             :     {
    1280           0 :         nResult = SIGNATURESTATE_SIGNATURES_OK;
    1281           0 :         for ( int n = 0; n < nInfos; n++ )
    1282             :         {
    1283           0 :             if ( bCertValid )
    1284             :             {
    1285           0 :                 sal_Int32 nCertStat = aInfos[n].CertificateStatus;
    1286           0 :                 bCertValid = nCertStat == security::CertificateValidity::VALID ? sal_True : sal_False;
    1287             :             }
    1288             : 
    1289           0 :             if ( !aInfos[n].SignatureIsValid )
    1290             :             {
    1291           0 :                 nResult = SIGNATURESTATE_SIGNATURES_BROKEN;
    1292           0 :                 break; // we know enough
    1293             :             }
    1294           0 :             bCompleteSignature &= !aInfos[n].PartialDocumentSignature;
    1295             :         }
    1296             :     }
    1297             : 
    1298         489 :     if ( nResult == SIGNATURESTATE_SIGNATURES_OK && !bCertValid )
    1299           0 :         nResult = SIGNATURESTATE_SIGNATURES_NOTVALIDATED;
    1300         489 :     else if ( nResult == SIGNATURESTATE_SIGNATURES_OK && bCertValid && !bCompleteSignature)
    1301           0 :         nResult = SIGNATURESTATE_SIGNATURES_PARTIAL_OK;
    1302             : 
    1303             :     // this code must not check whether the document is modified
    1304             :     // it should only check the provided info
    1305             : 
    1306         489 :     return nResult;
    1307             : }
    1308             : 
    1309         489 : uno::Sequence< security::DocumentSignatureInformation > SfxObjectShell::ImplAnalyzeSignature( sal_Bool bScriptingContent, const uno::Reference< security::XDocumentDigitalSignatures >& xSigner )
    1310             : {
    1311         489 :     uno::Sequence< security::DocumentSignatureInformation > aResult;
    1312         489 :     uno::Reference< security::XDocumentDigitalSignatures > xLocSigner = xSigner;
    1313             : 
    1314         489 :     if ( GetMedium() && !GetMedium()->GetName().isEmpty() && IsOwnStorageFormat_Impl( *GetMedium())  && GetMedium()->GetStorage().is() )
    1315             :     {
    1316             :         try
    1317             :         {
    1318          40 :             if ( !xLocSigner.is() )
    1319             :             {
    1320          40 :                 OUString aVersion;
    1321             :                 try
    1322             :                 {
    1323          40 :                     uno::Reference < beans::XPropertySet > xPropSet( GetStorage(), uno::UNO_QUERY_THROW );
    1324          40 :                     xPropSet->getPropertyValue( ::rtl::OUString( "Version"  ) ) >>= aVersion;
    1325             :                 }
    1326           0 :                 catch( uno::Exception& )
    1327             :                 {
    1328             :                 }
    1329             : 
    1330          40 :                 xLocSigner.set( security::DocumentDigitalSignatures::createWithVersion(comphelper::getProcessComponentContext(), aVersion) );
    1331             : 
    1332             :             }
    1333             : 
    1334          21 :             if ( bScriptingContent )
    1335           0 :                 aResult = xLocSigner->verifyScriptingContentSignatures( GetMedium()->GetZipStorageToSign_Impl(),
    1336           0 :                                                                 uno::Reference< io::XInputStream >() );
    1337             :             else
    1338          21 :                 aResult = xLocSigner->verifyDocumentContentSignatures( GetMedium()->GetZipStorageToSign_Impl(),
    1339          21 :                                                                 uno::Reference< io::XInputStream >() );
    1340             :         }
    1341          19 :         catch( com::sun::star::uno::Exception& )
    1342             :         {
    1343             :         }
    1344             :     }
    1345             : 
    1346         489 :     return aResult;
    1347             : }
    1348             : 
    1349        1304 : sal_uInt16 SfxObjectShell::ImplGetSignatureState( sal_Bool bScriptingContent )
    1350             : {
    1351        1304 :     sal_Int16* pState = bScriptingContent ? &pImp->nScriptingSignatureState : &pImp->nDocumentSignatureState;
    1352             : 
    1353        1304 :     if ( *pState == SIGNATURESTATE_UNKNOWN )
    1354             :     {
    1355         489 :         *pState = SIGNATURESTATE_NOSIGNATURES;
    1356             : 
    1357         489 :         uno::Sequence< security::DocumentSignatureInformation > aInfos = ImplAnalyzeSignature( bScriptingContent );
    1358         489 :         *pState = ImplCheckSignaturesInformation( aInfos );
    1359             :     }
    1360             : 
    1361        1304 :     if ( *pState == SIGNATURESTATE_SIGNATURES_OK || *pState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
    1362             :         || *pState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK)
    1363             :     {
    1364           0 :         if ( IsModified() )
    1365           0 :             *pState = SIGNATURESTATE_SIGNATURES_INVALID;
    1366             :     }
    1367             : 
    1368        1304 :     return (sal_uInt16)*pState;
    1369             : }
    1370             : 
    1371           0 : void SfxObjectShell::ImplSign( sal_Bool bScriptingContent )
    1372             : {
    1373             :     // Check if it is stored in OASIS format...
    1374           0 :     if  (   GetMedium()
    1375           0 :         &&  GetMedium()->GetFilter()
    1376           0 :         &&  !GetMedium()->GetName().isEmpty()
    1377           0 :         &&  (   !GetMedium()->GetFilter()->IsOwnFormat()
    1378           0 :             ||  !GetMedium()->HasStorage_Impl()
    1379             :             )
    1380             :         )
    1381             :     {
    1382             :         // Only OASIS and OOo6.x formats will be handled further
    1383           0 :         InfoBox( NULL, SfxResId( RID_XMLSEC_INFO_WRONGDOCFORMAT ) ).Execute();
    1384             :         return;
    1385             :     }
    1386             : 
    1387             :     // check whether the document is signed
    1388           0 :     ImplGetSignatureState( sal_False ); // document signature
    1389           0 :     ImplGetSignatureState( sal_True ); // script signature
    1390           0 :     sal_Bool bHasSign = ( pImp->nScriptingSignatureState != SIGNATURESTATE_NOSIGNATURES || pImp->nDocumentSignatureState != SIGNATURESTATE_NOSIGNATURES );
    1391             : 
    1392             :     // the target ODF version on saving
    1393           0 :     SvtSaveOptions aSaveOpt;
    1394           0 :     SvtSaveOptions::ODFDefaultVersion nVersion = aSaveOpt.GetODFDefaultVersion();
    1395             : 
    1396             :     // the document is not new and is not modified
    1397           0 :     ::rtl::OUString aODFVersion;
    1398             :     try
    1399             :     {
    1400             :         // check the version of the document
    1401           0 :         uno::Reference < beans::XPropertySet > xPropSet( GetStorage(), uno::UNO_QUERY_THROW );
    1402           0 :         xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= aODFVersion;
    1403             :     }
    1404           0 :     catch( uno::Exception& )
    1405             :     {}
    1406             : 
    1407           0 :     bool bNoSig = false;
    1408             : 
    1409           0 :     if ( IsModified() || !GetMedium() || GetMedium()->GetName().isEmpty()
    1410           0 :       || (!aODFVersion.equals( ODFVER_012_TEXT ) && !bHasSign) )
    1411             :     {
    1412             :         // the document might need saving ( new, modified or in ODF1.1 format without signature )
    1413             : 
    1414           0 :         if ( nVersion >= SvtSaveOptions::ODFVER_012 )
    1415             :         {
    1416             : 
    1417           0 :             if ( (bHasSign && QueryBox( NULL, SfxResId( MSG_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN ) ).Execute() == RET_YES)
    1418           0 :               || (!bHasSign && QueryBox( NULL, SfxResId( RID_XMLSEC_QUERY_SAVEBEFORESIGN ) ).Execute() == RET_YES) )
    1419             :             {
    1420           0 :                 sal_uInt16 nId = SID_SAVEDOC;
    1421           0 :                 if ( !GetMedium() || GetMedium()->GetName().isEmpty() )
    1422           0 :                     nId = SID_SAVEASDOC;
    1423           0 :                 SfxRequest aSaveRequest( nId, 0, GetPool() );
    1424             :                 //ToDo: Review. We needed to call SetModified, otherwise the document would not be saved.
    1425           0 :                 SetModified(sal_True);
    1426           0 :                 ExecFile_Impl( aSaveRequest );
    1427             : 
    1428             :                 // Check if it is stored in OASIS format...
    1429           0 :                 if ( GetMedium() && GetMedium()->GetFilter()
    1430           0 :                   && ( !GetMedium()->GetFilter()->IsOwnFormat() || !GetMedium()->HasStorage_Impl()
    1431           0 :                     || SotStorage::GetVersion( GetMedium()->GetStorage() ) <= SOFFICE_FILEFORMAT_60 ) )
    1432             :                 {
    1433             :                     // Only OASIS format will be handled further
    1434           0 :                     InfoBox( NULL, SfxResId( RID_XMLSEC_INFO_WRONGDOCFORMAT ) ).Execute();
    1435             :                     return;
    1436           0 :                 }
    1437             :             }
    1438             :             else
    1439             :             {
    1440             :                 // When the document is modified then we must not show the
    1441             :                 // digital signatures dialog
    1442             :                 // If we have come here then the user denied to save.
    1443           0 :                 if (!bHasSign)
    1444           0 :                     bNoSig = true;
    1445             :             }
    1446             :         }
    1447             :         else
    1448             :         {
    1449           0 :             ErrorBox( NULL, WB_OK, SfxResId(STR_XMLSEC_ODF12_EXPECTED).toString() ).Execute();
    1450             :             return;
    1451             :         }
    1452             : 
    1453           0 :         if ( IsModified() || !GetMedium() || GetMedium()->GetName().isEmpty() )
    1454             :             return;
    1455             :     }
    1456             : 
    1457             :     // the document is not modified currently, so it can not become modified after signing
    1458           0 :     sal_Bool bAllowModifiedBack = sal_False;
    1459           0 :     if ( IsEnableSetModified() )
    1460             :     {
    1461           0 :         EnableSetModified( sal_False );
    1462           0 :         bAllowModifiedBack = sal_True;
    1463             :     }
    1464             : 
    1465             :     // we have to store to the original document, the original medium should be closed for this time
    1466           0 :     if ( !bNoSig
    1467           0 :       && ConnectTmpStorage_Impl( pMedium->GetStorage(), pMedium ) )
    1468             :     {
    1469           0 :         GetMedium()->CloseAndRelease();
    1470             : 
    1471             :         // We sign only ODF1.2, that means that if this point has been reached,
    1472             :         // the ODF1.2 signing process should be used.
    1473             :         // This code still might be called to show the signature of ODF1.1 document.
    1474             :         sal_Bool bSigned = GetMedium()->SignContents_Impl(
    1475             :             bScriptingContent,
    1476             :             aODFVersion,
    1477             :             pImp->nDocumentSignatureState == SIGNATURESTATE_SIGNATURES_OK
    1478             :             || pImp->nDocumentSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
    1479           0 :             || pImp->nDocumentSignatureState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK);
    1480             : 
    1481           0 :         DoSaveCompleted( GetMedium() );
    1482             : 
    1483           0 :         if ( bSigned )
    1484             :         {
    1485           0 :             if ( bScriptingContent )
    1486             :             {
    1487           0 :                 pImp->nScriptingSignatureState = SIGNATURESTATE_UNKNOWN;// Re-Check
    1488             : 
    1489             :                 // adding of scripting signature removes existing document signature
    1490           0 :                 pImp->nDocumentSignatureState = SIGNATURESTATE_UNKNOWN;// Re-Check
    1491             :             }
    1492             :             else
    1493           0 :                 pImp->nDocumentSignatureState = SIGNATURESTATE_UNKNOWN;// Re-Check
    1494             : 
    1495           0 :             pImp->bSignatureErrorIsShown = sal_False;
    1496             : 
    1497           0 :             Invalidate( SID_SIGNATURE );
    1498           0 :             Invalidate( SID_MACRO_SIGNATURE );
    1499           0 :             Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) );
    1500             :         }
    1501             :     }
    1502             : 
    1503           0 :     if ( bAllowModifiedBack )
    1504           0 :         EnableSetModified( sal_True );
    1505             : }
    1506             : 
    1507        1304 : sal_uInt16 SfxObjectShell::GetDocumentSignatureState()
    1508             : {
    1509        1304 :     return ImplGetSignatureState( sal_False );
    1510             : }
    1511             : 
    1512           0 : void SfxObjectShell::SignDocumentContent()
    1513             : {
    1514           0 :     ImplSign( sal_False );
    1515           0 : }
    1516             : 
    1517           0 : sal_uInt16 SfxObjectShell::GetScriptingSignatureState()
    1518             : {
    1519           0 :     return ImplGetSignatureState( sal_True );
    1520             : }
    1521             : 
    1522           0 : void SfxObjectShell::SignScriptingContent()
    1523             : {
    1524           0 :     ImplSign( sal_True );
    1525           0 : }
    1526             : 
    1527             : namespace
    1528             : {
    1529             :     class theSfxObjectShellUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSfxObjectShellUnoTunnelId > {};
    1530             : }
    1531             : 
    1532        1908 : const uno::Sequence<sal_Int8>& SfxObjectShell::getUnoTunnelId()
    1533             : {
    1534        1908 :     return theSfxObjectShellUnoTunnelId::get().getSeq();
    1535          66 : }
    1536             : 
    1537             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10