LCOV - code coverage report
Current view: top level - libreoffice/xmlsecurity/source/dialogs - macrosecurity.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 238 0.0 %
Date: 2012-12-27 Functions: 0 32 0.0 %
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             : 
      21             : #include <xmlsecurity/macrosecurity.hxx>
      22             : #include <xmlsecurity/certificatechooser.hxx>
      23             : #include <xmlsecurity/certificateviewer.hxx>
      24             : #include <xmlsecurity/biginteger.hxx>
      25             : 
      26             : #include <osl/file.hxx>
      27             : #include <vcl/help.hxx>
      28             : 
      29             : 
      30             : #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
      31             : #include <com/sun/star/security/SerialNumberAdapter.hpp>
      32             : #include <comphelper/sequence.hxx>
      33             : #include <sfx2/filedlghelper.hxx>
      34             : #include <comphelper/processfactory.hxx>
      35             : #include <com/sun/star/uno/Exception.hpp>
      36             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      37             : #include <com/sun/star/ui/dialogs/FolderPicker.hpp>
      38             : #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
      39             : #include <tools/urlobj.hxx>
      40             : #include "svtools/treelistentry.hxx"
      41             : 
      42             : #include <vcl/msgbox.hxx>
      43             : 
      44             : #include "dialogs.hrc"
      45             : #include "resourcemanager.hxx"
      46             : 
      47             : /* HACK: disable some warnings for MS-C */
      48             : #ifdef _MSC_VER
      49             : #pragma warning (disable : 4355)    // 4355: this used in initializer-list
      50             : #endif
      51             : 
      52             : using namespace ::com::sun::star;
      53             : 
      54             : 
      55           0 : IMPL_LINK_NOARG(MacroSecurity, OkBtnHdl)
      56             : {
      57           0 :     mpLevelTP->ClosePage();
      58           0 :     mpTrustSrcTP->ClosePage();
      59             : 
      60           0 :     EndDialog( RET_OK );
      61             : 
      62           0 :     return 0;
      63             : }
      64             : 
      65           0 : MacroSecurity::MacroSecurity( Window* _pParent, const cssu::Reference< cssu::XComponentContext> &_rxCtx, const cssu::Reference< dcss::xml::crypto::XSecurityEnvironment >& _rxSecurityEnvironment )
      66           0 :     :TabDialog          ( _pParent, XMLSEC_RES( RID_XMLSECTP_MACROSEC ) )
      67           0 :     ,maTabCtrl          ( this, XMLSEC_RES( 1 ) )
      68           0 :     ,maOkBtn            ( this, XMLSEC_RES( BTN_OK ) )
      69           0 :     ,maCancelBtn        ( this, XMLSEC_RES( BTN_CANCEL ) )
      70           0 :     ,maHelpBtn          ( this, XMLSEC_RES( BTN_HELP ) )
      71           0 :     ,maResetBtn         ( this, XMLSEC_RES( BTN_RESET ) )
      72             : {
      73           0 :     FreeResource();
      74             : 
      75           0 :     mxCtx = _rxCtx;
      76           0 :     mxSecurityEnvironment = _rxSecurityEnvironment;
      77             : 
      78           0 :     mpLevelTP = new MacroSecurityLevelTP( &maTabCtrl, this );
      79           0 :     mpTrustSrcTP = new MacroSecurityTrustedSourcesTP( &maTabCtrl, this );
      80             : 
      81           0 :     maTabCtrl.SetTabPage( RID_XMLSECTP_SECLEVEL, mpLevelTP );
      82           0 :     maTabCtrl.SetTabPage( RID_XMLSECTP_TRUSTSOURCES, mpTrustSrcTP );
      83           0 :     maTabCtrl.SetCurPageId( RID_XMLSECTP_SECLEVEL );
      84             : 
      85           0 :     maOkBtn.SetClickHdl( LINK( this, MacroSecurity, OkBtnHdl ) );
      86           0 : }
      87             : 
      88           0 : MacroSecurity::~MacroSecurity()
      89             : {
      90           0 :     delete maTabCtrl.GetTabPage( RID_XMLSECTP_TRUSTSOURCES );
      91           0 :     delete maTabCtrl.GetTabPage( RID_XMLSECTP_SECLEVEL );
      92           0 : }
      93             : 
      94             : 
      95           0 : MacroSecurityTP::MacroSecurityTP( Window* _pParent, const ResId& _rResId, MacroSecurity* _pDlg )
      96             :     :TabPage        ( _pParent, _rResId )
      97           0 :     ,mpDlg          ( _pDlg )
      98             : {
      99           0 : }
     100             : 
     101           0 : MacroSecurityLevelTP::MacroSecurityLevelTP( Window* _pParent, MacroSecurity* _pDlg )
     102           0 :     :MacroSecurityTP    ( _pParent, XMLSEC_RES( RID_XMLSECTP_SECLEVEL ), _pDlg )
     103           0 :     ,maSecLevelFL       ( this, XMLSEC_RES( FL_SECLEVEL ) )
     104           0 :     ,maSecReadonlyFI    ( this, XMLSEC_RES( FI_SEC_READONLY ))
     105           0 :     ,maVeryHighRB       ( this, XMLSEC_RES( RB_VERYHIGH ) )
     106           0 :     ,maHighRB           ( this, XMLSEC_RES( RB_HIGH ) )
     107           0 :     ,maMediumRB         ( this, XMLSEC_RES( RB_MEDIUM ) )
     108           0 :     ,maLowRB            ( this, XMLSEC_RES( RB_LOW ) )
     109             : {
     110           0 :     FreeResource();
     111             : 
     112           0 :     maLowRB.SetClickHdl( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) );
     113           0 :     maMediumRB.SetClickHdl( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) );
     114           0 :     maHighRB.SetClickHdl( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) );
     115           0 :     maVeryHighRB.SetClickHdl( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) );
     116             : 
     117           0 :     mnCurLevel = (sal_uInt16) mpDlg->maSecOptions.GetMacroSecurityLevel();
     118           0 :     sal_Bool bReadonly = mpDlg->maSecOptions.IsReadOnly( SvtSecurityOptions::E_MACRO_SECLEVEL );
     119             : 
     120           0 :     RadioButton* pCheck = 0;
     121           0 :     switch( mnCurLevel )
     122             :     {
     123           0 :         case 3: pCheck = &maVeryHighRB;   break;
     124           0 :         case 2: pCheck = &maHighRB;       break;
     125           0 :         case 1: pCheck = &maMediumRB;     break;
     126           0 :         case 0: pCheck = &maLowRB;        break;
     127             :     }
     128           0 :     if(pCheck)
     129           0 :         pCheck->Check();
     130             :     else
     131             :     {
     132             :         OSL_FAIL("illegal macro security level");
     133             :     }
     134           0 :     maSecReadonlyFI.Show(bReadonly);
     135           0 :     if(bReadonly)
     136             :     {
     137             :         //move to the selected button
     138           0 :         if( pCheck && pCheck != &maVeryHighRB)
     139             :         {
     140           0 :             long nDiff = pCheck->GetPosPixel().Y() - maVeryHighRB.GetPosPixel().Y();
     141           0 :             Point aPos(maSecReadonlyFI.GetPosPixel());
     142           0 :             aPos.Y() += nDiff;
     143           0 :             maSecReadonlyFI.SetPosPixel(aPos);
     144             :         }
     145           0 :         maVeryHighRB.Enable(sal_False);
     146           0 :         maHighRB.Enable(sal_False);
     147           0 :         maMediumRB.Enable(sal_False);
     148           0 :         maLowRB.Enable(sal_False);
     149             :     }
     150             : 
     151           0 : }
     152             : 
     153           0 : IMPL_LINK_NOARG(MacroSecurityLevelTP, RadioButtonHdl)
     154             : {
     155           0 :     sal_uInt16 nNewLevel = 0;
     156           0 :     if( maVeryHighRB.IsChecked() )
     157           0 :         nNewLevel = 3;
     158           0 :     else if( maHighRB.IsChecked() )
     159           0 :         nNewLevel = 2;
     160           0 :     else if( maMediumRB.IsChecked() )
     161           0 :         nNewLevel = 1;
     162             : 
     163           0 :     if ( nNewLevel != mnCurLevel )
     164             :     {
     165           0 :         mnCurLevel = nNewLevel;
     166           0 :         mpDlg->EnableReset();
     167             :     }
     168             : 
     169           0 :     return 0;
     170             : }
     171             : 
     172           0 : void MacroSecurityLevelTP::ClosePage( void )
     173             : {
     174           0 :     mpDlg->maSecOptions.SetMacroSecurityLevel( mnCurLevel );
     175           0 : }
     176             : 
     177           0 : void MacroSecurityTrustedSourcesTP::ImplCheckButtons()
     178             : {
     179           0 :     bool bCertSelected = maTrustCertLB.FirstSelected() != NULL;
     180           0 :     maViewCertPB.Enable( bCertSelected );
     181           0 :     maRemoveCertPB.Enable( bCertSelected && !mbAuthorsReadonly);
     182             : 
     183           0 :     bool bLocationSelected = maTrustFileLocLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND;
     184           0 :     maRemoveLocPB.Enable( bLocationSelected && !mbURLsReadonly);
     185           0 : }
     186             : 
     187             : 
     188           0 : IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, ViewCertPBHdl)
     189             : {
     190           0 :     if( maTrustCertLB.FirstSelected() )
     191             :     {
     192           0 :         sal_uInt16 nSelected = sal_uInt16( sal_uIntPtr( maTrustCertLB.FirstSelected()->GetUserData() ) );
     193             : 
     194             :         uno::Reference< dcss::security::XSerialNumberAdapter > xSerialNumberAdapter =
     195           0 :             ::com::sun::star::security::SerialNumberAdapter::create(mpDlg->mxCtx);
     196             : 
     197           0 :         uno::Reference< dcss::security::XCertificate > xCert = mpDlg->mxSecurityEnvironment->getCertificate( maTrustedAuthors[nSelected][0], xSerialNumberAdapter->toSequence( maTrustedAuthors[nSelected][1] ) );
     198             : 
     199             :         // If we don't get it, create it from signature data:
     200           0 :         if ( !xCert.is() )
     201           0 :             xCert = mpDlg->mxSecurityEnvironment->createCertificateFromAscii( maTrustedAuthors[nSelected][2] ) ;
     202             : 
     203             :         DBG_ASSERT( xCert.is(), "*MacroSecurityTrustedSourcesTP::ViewCertPBHdl(): Certificate not found and can't be created!" );
     204             : 
     205           0 :         if ( xCert.is() )
     206             :         {
     207           0 :             CertificateViewer aViewer( this, mpDlg->mxSecurityEnvironment, xCert, false );
     208           0 :             aViewer.Execute();
     209           0 :         }
     210             :     }
     211           0 :     return 0;
     212             : }
     213             : 
     214           0 : IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, RemoveCertPBHdl)
     215             : {
     216           0 :     if( maTrustCertLB.FirstSelected() )
     217             :     {
     218           0 :         sal_uInt16 nAuthor = sal_uInt16( sal_uIntPtr( maTrustCertLB.FirstSelected()->GetUserData() ) );
     219           0 :         ::comphelper::removeElementAt( maTrustedAuthors, nAuthor );
     220             : 
     221           0 :         FillCertLB();
     222           0 :         ImplCheckButtons();
     223             :     }
     224             : 
     225           0 :     return 0;
     226             : }
     227             : 
     228           0 : IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, AddLocPBHdl)
     229             : {
     230             :     try
     231             :     {
     232           0 :         uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
     233           0 :         uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = ui::dialogs::FolderPicker::create(xContext);
     234             : 
     235           0 :         short nRet = xFolderPicker->execute();
     236             : 
     237           0 :         if( ui::dialogs::ExecutableDialogResults::OK != nRet )
     238           0 :             return 0;
     239             : 
     240           0 :         rtl::OUString aPathStr = xFolderPicker->getDirectory();
     241           0 :         INetURLObject aNewObj( aPathStr );
     242           0 :         aNewObj.removeFinalSlash();
     243             : 
     244             :         // then the new path also an URL else system path
     245           0 :         ::rtl::OUString aSystemFileURL = ( aNewObj.GetProtocol() != INET_PROT_NOT_VALID ) ?
     246           0 :             aPathStr : aNewObj.getFSysPath( INetURLObject::FSYS_DETECT );
     247             : 
     248           0 :         OUString aNewPathStr(aSystemFileURL);
     249             : 
     250           0 :         if ( osl::FileBase::getSystemPathFromFileURL( aSystemFileURL, aSystemFileURL ) == osl::FileBase::E_None )
     251           0 :             aNewPathStr = aSystemFileURL;
     252             : 
     253           0 :         if( maTrustFileLocLB.GetEntryPos( aNewPathStr ) == LISTBOX_ENTRY_NOTFOUND )
     254             :         {
     255           0 :             maTrustFileLocLB.InsertEntry( aNewPathStr );
     256             :         }
     257             : 
     258           0 :         ImplCheckButtons();
     259             :     }
     260           0 :     catch( uno::Exception& )
     261             :     {
     262             :         SAL_WARN( "xmlsecurity.dialogs", "MacroSecurityTrustedSourcesTP::AddLocPBHdl(): exception from folder picker" );
     263             :     }
     264             : 
     265           0 :     return 0;
     266             : }
     267             : 
     268           0 : IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, RemoveLocPBHdl)
     269             : {
     270           0 :     sal_uInt16  nSel = maTrustFileLocLB.GetSelectEntryPos();
     271           0 :     if( nSel != LISTBOX_ENTRY_NOTFOUND )
     272             :     {
     273           0 :         maTrustFileLocLB.RemoveEntry( nSel );
     274             :         // Trusted Path could not be removed (#i33584#)
     275             :         // after remove an entry, select another one if exists
     276           0 :         sal_uInt16 nNewCount = maTrustFileLocLB.GetEntryCount();
     277           0 :         if ( nNewCount > 0 )
     278             :         {
     279           0 :             if ( nSel >= nNewCount )
     280           0 :                 nSel = nNewCount - 1;
     281           0 :             maTrustFileLocLB.SelectEntryPos( nSel );
     282             :         }
     283           0 :         ImplCheckButtons();
     284             :     }
     285             : 
     286           0 :     return 0;
     287             : }
     288             : 
     289           0 : IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, TrustCertLBSelectHdl)
     290             : {
     291           0 :     ImplCheckButtons();
     292           0 :     return 0;
     293             : }
     294             : 
     295           0 : IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, TrustFileLocLBSelectHdl)
     296             : {
     297           0 :     ImplCheckButtons();
     298           0 :     return 0;
     299             : }
     300             : 
     301           0 : void MacroSecurityTrustedSourcesTP::FillCertLB( void )
     302             : {
     303           0 :     maTrustCertLB.Clear();
     304             : 
     305           0 :     sal_uInt32 nEntries = maTrustedAuthors.getLength();
     306             : 
     307           0 :     if ( nEntries && mpDlg->mxSecurityEnvironment.is() )
     308             :     {
     309           0 :         for( sal_uInt32 nEntry = 0 ; nEntry < nEntries ; ++nEntry )
     310             :         {
     311           0 :             cssu::Sequence< ::rtl::OUString >&              rEntry = maTrustedAuthors[ nEntry ];
     312           0 :             uno::Reference< css::security::XCertificate >   xCert;
     313             : 
     314             :             // create from RawData
     315           0 :             xCert = mpDlg->mxSecurityEnvironment->createCertificateFromAscii( rEntry[ 2 ] );
     316             : 
     317           0 :             SvTreeListEntry*    pLBEntry = maTrustCertLB.InsertEntry( XmlSec::GetContentPart( xCert->getSubjectName() ) );
     318           0 :             maTrustCertLB.SetEntryText( XmlSec::GetContentPart( xCert->getIssuerName() ), pLBEntry, 1 );
     319           0 :             maTrustCertLB.SetEntryText( XmlSec::GetDateTimeString( xCert->getNotValidAfter() ), pLBEntry, 2 );
     320           0 :             pLBEntry->SetUserData( ( void* ) (sal_IntPtr)nEntry );      // missuse user data as index
     321           0 :         }
     322             :     }
     323           0 : }
     324             : 
     325           0 : MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP( Window* _pParent, MacroSecurity* _pDlg )
     326           0 :     :MacroSecurityTP    ( _pParent, XMLSEC_RES( RID_XMLSECTP_TRUSTSOURCES ), _pDlg )
     327           0 :     ,maTrustCertFL      ( this, XMLSEC_RES( FL_TRUSTCERT ) )
     328           0 :     ,maTrustCertROFI    ( this, XMLSEC_RES( FI_TRUSTCERT_RO ) )
     329           0 :     ,m_aTrustCertLBContainer(this, XMLSEC_RES(LB_TRUSTCERT))
     330             :     ,maTrustCertLB(m_aTrustCertLBContainer)
     331           0 :     ,maAddCertPB        ( this, XMLSEC_RES( PB_ADD_TRUSTCERT ) )
     332           0 :     ,maViewCertPB       ( this, XMLSEC_RES( PB_VIEW_TRUSTCERT ) )
     333           0 :     ,maRemoveCertPB     ( this, XMLSEC_RES( PB_REMOVE_TRUSTCERT ) )
     334           0 :     ,maTrustFileLocFL   ( this, XMLSEC_RES( FL_TRUSTFILELOC ) )
     335           0 :     ,maTrustFileROFI    ( this, XMLSEC_RES( FI_TRUSTFILE_RO ) )
     336           0 :     ,maTrustFileLocFI   ( this, XMLSEC_RES( FI_TRUSTFILELOC ) )
     337           0 :     ,maTrustFileLocLB   ( this, XMLSEC_RES( LB_TRUSTFILELOC ) )
     338           0 :     ,maAddLocPB         ( this, XMLSEC_RES( FL_ADD_TRUSTFILELOC ) )
     339           0 :     ,maRemoveLocPB      ( this, XMLSEC_RES( FL_REMOVE_TRUSTFILELOC ) )
     340             : {
     341             :     static long nTabs[] = { 3, 0, 35*CS_LB_WIDTH/100, 70*CS_LB_WIDTH/100 };
     342           0 :     maTrustCertLB.SetTabs( &nTabs[ 0 ] );
     343           0 :     maTrustCertLB.InsertHeaderEntry( XMLSEC_RES( STR_HEADERBAR ) );
     344             : 
     345           0 :     FreeResource();
     346             : 
     347           0 :     maTrustCertLB.SetSelectHdl( LINK( this, MacroSecurityTrustedSourcesTP, TrustCertLBSelectHdl ) );
     348           0 :     maAddCertPB.Hide();     // not used in the moment...
     349           0 :     maViewCertPB.SetClickHdl( LINK( this, MacroSecurityTrustedSourcesTP, ViewCertPBHdl ) );
     350           0 :     maViewCertPB.Disable();
     351           0 :     maRemoveCertPB.SetClickHdl( LINK( this, MacroSecurityTrustedSourcesTP, RemoveCertPBHdl ) );
     352           0 :     maRemoveCertPB.Disable();
     353             : 
     354           0 :     maTrustFileLocLB.SetSelectHdl( LINK( this, MacroSecurityTrustedSourcesTP, TrustFileLocLBSelectHdl ) );
     355           0 :     maAddLocPB.SetClickHdl( LINK( this, MacroSecurityTrustedSourcesTP, AddLocPBHdl ) );
     356           0 :     maRemoveLocPB.SetClickHdl( LINK( this, MacroSecurityTrustedSourcesTP, RemoveLocPBHdl ) );
     357           0 :     maRemoveLocPB.Disable();
     358             : 
     359           0 :     maTrustedAuthors = mpDlg->maSecOptions.GetTrustedAuthors();
     360           0 :     mbAuthorsReadonly = mpDlg->maSecOptions.IsReadOnly( SvtSecurityOptions::E_MACRO_TRUSTEDAUTHORS );
     361           0 :     maTrustCertROFI.Show( mbAuthorsReadonly );
     362           0 :     mbAuthorsReadonly ? maTrustCertLB.DisableTable() : maTrustCertLB.EnableTable();
     363             : 
     364           0 :     FillCertLB();
     365             : 
     366           0 :     cssu::Sequence< rtl::OUString > aSecureURLs = mpDlg->maSecOptions.GetSecureURLs();
     367           0 :     mbURLsReadonly = mpDlg->maSecOptions.IsReadOnly( SvtSecurityOptions::E_SECUREURLS );
     368           0 :     maTrustFileROFI.Show( mbURLsReadonly );
     369           0 :     maTrustFileLocLB.Enable( !mbURLsReadonly );
     370           0 :     maAddLocPB      .Enable( !mbURLsReadonly );
     371             : 
     372           0 :     sal_Int32 nEntryCnt = aSecureURLs.getLength();
     373           0 :     for( sal_Int32 i = 0 ; i < nEntryCnt ; ++i )
     374             :     {
     375           0 :         ::rtl::OUString aSystemFileURL( aSecureURLs[ i ] );
     376           0 :         osl::FileBase::getSystemPathFromFileURL( aSystemFileURL, aSystemFileURL );
     377           0 :         maTrustFileLocLB.InsertEntry( aSystemFileURL );
     378           0 :     }
     379           0 : }
     380             : 
     381           0 : void MacroSecurityTrustedSourcesTP::ActivatePage()
     382             : {
     383           0 :     mpDlg->EnableReset( false );
     384           0 :     FillCertLB();
     385           0 : }
     386             : 
     387           0 : void MacroSecurityTrustedSourcesTP::ClosePage( void )
     388             : {
     389           0 :     sal_uInt16  nEntryCnt = maTrustFileLocLB.GetEntryCount();
     390           0 :     if( nEntryCnt )
     391             :     {
     392           0 :         cssu::Sequence< rtl::OUString > aSecureURLs( nEntryCnt );
     393           0 :         for( sal_uInt16 i = 0 ; i < nEntryCnt ; ++i )
     394             :         {
     395           0 :             ::rtl::OUString aURL( maTrustFileLocLB.GetEntry( i ) );
     396           0 :             osl::FileBase::getFileURLFromSystemPath( aURL, aURL );
     397           0 :             aSecureURLs[ i ] = aURL;
     398           0 :         }
     399             : 
     400           0 :         mpDlg->maSecOptions.SetSecureURLs( aSecureURLs );
     401             :     }
     402             :     // Trusted Path could not be removed (#i33584#)
     403             :     // don't forget to remove the old saved SecureURLs
     404             :     else
     405           0 :         mpDlg->maSecOptions.SetSecureURLs( cssu::Sequence< rtl::OUString >() );
     406             : 
     407           0 :     mpDlg->maSecOptions.SetTrustedAuthors( maTrustedAuthors );
     408           0 : }
     409             : 
     410           0 : ReadOnlyImage::ReadOnlyImage(Window* pParent, const ResId rResId) :
     411           0 :             FixedImage(pParent, rResId)
     412             : {
     413           0 :     SetImage( Image(XMLSEC_RES( RID_XMLSECTP_LOCK )));
     414           0 : }
     415             : 
     416           0 : ReadOnlyImage::~ReadOnlyImage()
     417             : {
     418           0 : }
     419             : 
     420           0 : void ReadOnlyImage::RequestHelp( const HelpEvent& rHEvt )
     421             : {
     422           0 :     if( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() )
     423             :     {
     424           0 :         Rectangle   aLogicPix( LogicToPixel( Rectangle( Point(), GetOutputSize() ) ) );
     425           0 :         Rectangle   aScreenRect( OutputToScreenPixel( aLogicPix.TopLeft() ),
     426           0 :                                      OutputToScreenPixel( aLogicPix.BottomRight() ) );
     427             : 
     428           0 :         OUString aStr(ReadOnlyImage::GetHelpTip());
     429           0 :         if ( Help::IsBalloonHelpEnabled() )
     430           0 :             Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aScreenRect,
     431           0 :             aStr );
     432           0 :         else if ( Help::IsQuickHelpEnabled() )
     433           0 :             Help::ShowQuickHelp( this, aScreenRect, aStr );
     434             :     }
     435             :     else
     436           0 :         Window::RequestHelp( rHEvt );
     437           0 : }
     438             : 
     439           0 : const OUString& ReadOnlyImage::GetHelpTip()
     440             : {
     441           0 :      static OUString aStr(XMLSEC_RES( RID_XMLSECTP_READONLY_CONFIG_TIP));
     442           0 :      return aStr;
     443             : }
     444             : 
     445             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10