1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> 29*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 30*cdf0e10cSrcweir #include <com/sun/star/security/XDocumentDigitalSignatures.hpp> 31*cdf0e10cSrcweir #include <comphelper/sequence.hxx> 32*cdf0e10cSrcweir #include "comphelper/documentconstants.hxx" 33*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 36*cdf0e10cSrcweir #include <com/sun/star/security/NoPasswordException.hpp> 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir using namespace ::com::sun::star::security; 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include "ids.hrc" 41*cdf0e10cSrcweir #include "secmacrowarnings.hxx" 42*cdf0e10cSrcweir #include "secmacrowarnings.hrc" 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir #ifdef _MSC_VER 45*cdf0e10cSrcweir #pragma warning (disable : 4355) // 4355: this used in initializer-list 46*cdf0e10cSrcweir #endif 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir using namespace ::com::sun::star; 49*cdf0e10cSrcweir using namespace ::com::sun::star; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir // HACK!!! copied from xmlsecurity/source/dialog/resourcemanager.cxx 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir namespace 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir String GetContentPart( const String& _rRawString, const String& _rPartId ) 57*cdf0e10cSrcweir { 58*cdf0e10cSrcweir String s; 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir xub_StrLen nContStart = _rRawString.Search( _rPartId ); 61*cdf0e10cSrcweir if( nContStart != STRING_NOTFOUND ) 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir nContStart = nContStart + _rPartId.Len(); 64*cdf0e10cSrcweir ++nContStart; // now it's start of content, directly after Id 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir xub_StrLen nContEnd = _rRawString.Search( sal_Unicode( ',' ), nContStart ); 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir s = String( _rRawString, nContStart, nContEnd - nContStart ); 69*cdf0e10cSrcweir } 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir return s; 72*cdf0e10cSrcweir } 73*cdf0e10cSrcweir } 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir MacroWarning::MacroWarning( Window* _pParent, bool _bWithSignatures, ResMgr& rResMgr ) 77*cdf0e10cSrcweir :ModalDialog ( _pParent, ResId( RID_XMLSECDLG_MACROWARN, rResMgr ) ) 78*cdf0e10cSrcweir ,mpInfos ( NULL ) 79*cdf0e10cSrcweir ,maSymbolImg ( this, ResId( IMG_SYMBOL, rResMgr ) ) 80*cdf0e10cSrcweir ,maDocNameFI ( this, ResId( FI_DOCNAME, rResMgr ) ) 81*cdf0e10cSrcweir ,maDescr1aFI ( this, ResId( FI_DESCR1A, rResMgr ) ) 82*cdf0e10cSrcweir ,maDescr1bFI ( this, ResId( FI_DESCR1B, rResMgr ) ) 83*cdf0e10cSrcweir ,maSignsFI ( this, ResId( FI_SIGNS, rResMgr ) ) 84*cdf0e10cSrcweir ,maViewSignsBtn ( this, ResId( PB_VIEWSIGNS, rResMgr ) ) 85*cdf0e10cSrcweir ,maDescr2FI ( this, ResId( FI_DESCR2, rResMgr ) ) 86*cdf0e10cSrcweir ,maAlwaysTrustCB ( this, ResId( CB_ALWAYSTRUST, rResMgr ) ) 87*cdf0e10cSrcweir ,maBottomSepFL ( this, ResId( FL_BOTTOM_SEP, rResMgr ) ) 88*cdf0e10cSrcweir ,maEnableBtn ( this, ResId( PB_ENABLE, rResMgr ) ) 89*cdf0e10cSrcweir ,maDisableBtn ( this, ResId( PB_DISABLE, rResMgr ) ) 90*cdf0e10cSrcweir ,maHelpBtn ( this, ResId( BTN_HELP, rResMgr ) ) 91*cdf0e10cSrcweir ,mbSignedMode ( true ) 92*cdf0e10cSrcweir ,mbShowSignatures ( _bWithSignatures ) 93*cdf0e10cSrcweir ,mnActSecLevel ( 0 ) 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir FreeResource(); 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir InitControls(); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir maDisableBtn.SetClickHdl( LINK( this, MacroWarning, DisableBtnHdl ) ); 100*cdf0e10cSrcweir maEnableBtn.SetClickHdl( LINK( this, MacroWarning, EnableBtnHdl ) ); 101*cdf0e10cSrcweir maDisableBtn.GrabFocus(); // Default button, but focus is on view button 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir MacroWarning::~MacroWarning() 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir short MacroWarning::Execute() 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir FitControls(); 111*cdf0e10cSrcweir return ModalDialog::Execute(); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir void MacroWarning::SetDocumentURL( const String& rDocURL ) 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir maDocNameFI.SetText( rDocURL ); 117*cdf0e10cSrcweir } 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir IMPL_LINK( MacroWarning, ViewSignsBtnHdl, void*, EMPTYARG ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir DBG_ASSERT( mxCert.is(), "*MacroWarning::ViewSignsBtnHdl(): no certificate set!" ); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir uno::Sequence< uno::Any > aArgs( 1 ); 124*cdf0e10cSrcweir aArgs[0] = uno::makeAny( maODFVersion ); 125*cdf0e10cSrcweir uno::Reference< security::XDocumentDigitalSignatures > xD( 126*cdf0e10cSrcweir comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ), aArgs ), uno::UNO_QUERY ); 127*cdf0e10cSrcweir if( xD.is() ) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir if( mxCert.is() ) 130*cdf0e10cSrcweir xD->showCertificate( mxCert ); 131*cdf0e10cSrcweir else if( mxStore.is() ) 132*cdf0e10cSrcweir xD->showScriptingContentSignatures( mxStore, uno::Reference< io::XInputStream >() ); 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir return 0; 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir IMPL_LINK( MacroWarning, EnableBtnHdl, void*, EMPTYARG ) 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir if( mbSignedMode && maAlwaysTrustCB.IsChecked() ) 141*cdf0e10cSrcweir { // insert path into trusted path list 142*cdf0e10cSrcweir uno::Sequence< uno::Any > aArgs( 1 ); 143*cdf0e10cSrcweir aArgs[0] = uno::makeAny( maODFVersion ); 144*cdf0e10cSrcweir uno::Reference< security::XDocumentDigitalSignatures > xD( 145*cdf0e10cSrcweir comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ), aArgs ), uno::UNO_QUERY ); 146*cdf0e10cSrcweir if( xD.is() ) 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir if( mxCert.is() ) 149*cdf0e10cSrcweir xD->addAuthorToTrustedSources( mxCert ); 150*cdf0e10cSrcweir else if( mxStore.is() ) 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir DBG_ASSERT( mpInfos, "-MacroWarning::EnableBtnHdl(): no infos, search in nirvana..." ); 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir sal_Int32 nCnt = mpInfos->getLength(); 155*cdf0e10cSrcweir for( sal_Int32 i = 0 ; i < nCnt ; ++i ) 156*cdf0e10cSrcweir xD->addAuthorToTrustedSources( (*mpInfos)[ i ].Signer ); 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir } 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir EndDialog( RET_OK ); 162*cdf0e10cSrcweir return 0; 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir IMPL_LINK( MacroWarning, DisableBtnHdl, void*, EMPTYARG ) 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir EndDialog( RET_CANCEL ); 168*cdf0e10cSrcweir return 0; 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir IMPL_LINK( MacroWarning, AlwaysTrustCheckHdl, void*, EMPTYARG ) 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir bool bEnable = ( mnActSecLevel < 2 || maAlwaysTrustCB.IsChecked() ); 174*cdf0e10cSrcweir maEnableBtn.Enable( bEnable ); 175*cdf0e10cSrcweir maDisableBtn.Enable( !maAlwaysTrustCB.IsChecked() ); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir return 0; 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir void MacroWarning::InitControls() 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir // set warning image 183*cdf0e10cSrcweir Image aImg( WarningBox::GetStandardImage() ); 184*cdf0e10cSrcweir maSymbolImg.SetImage( aImg ); 185*cdf0e10cSrcweir maSymbolImg.SetSizePixel( aImg.GetSizePixel() ); 186*cdf0e10cSrcweir // set bold font and path ellipsis for docname fixedtext 187*cdf0e10cSrcweir Font aTmpFont = maDocNameFI.GetControlFont(); 188*cdf0e10cSrcweir aTmpFont.SetWeight( WEIGHT_BOLD ); 189*cdf0e10cSrcweir maDocNameFI.SetControlFont( aTmpFont ); 190*cdf0e10cSrcweir WinBits nStyle = maDocNameFI.GetStyle(); 191*cdf0e10cSrcweir nStyle |= WB_PATHELLIPSIS; 192*cdf0e10cSrcweir maDocNameFI.SetStyle( nStyle ); 193*cdf0e10cSrcweir // show signature controls? 194*cdf0e10cSrcweir if( mbShowSignatures ) 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir maDescr1bFI.Hide(); 197*cdf0e10cSrcweir maViewSignsBtn.SetClickHdl( LINK( this, MacroWarning, ViewSignsBtnHdl ) ); 198*cdf0e10cSrcweir maViewSignsBtn.Disable(); // default 199*cdf0e10cSrcweir maAlwaysTrustCB.SetClickHdl( LINK( this, MacroWarning, AlwaysTrustCheckHdl ) ); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir mnActSecLevel = SvtSecurityOptions().GetMacroSecurityLevel(); 202*cdf0e10cSrcweir if ( mnActSecLevel >= 2 ) 203*cdf0e10cSrcweir maEnableBtn.Disable(); 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir else 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir maDescr1aFI.Hide(); 208*cdf0e10cSrcweir maSignsFI.Hide(); 209*cdf0e10cSrcweir maViewSignsBtn.Hide(); 210*cdf0e10cSrcweir maAlwaysTrustCB.Hide(); 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir // move hint up to position of signer list 213*cdf0e10cSrcweir maDescr2FI.SetPosPixel( maSignsFI.GetPosPixel() ); 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir // without signature controls could be smaller 216*cdf0e10cSrcweir if ( !mbShowSignatures ) 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir Point aPos = maDescr2FI.GetPosPixel(); 219*cdf0e10cSrcweir aPos.Y() += maDescr2FI.GetSizePixel().Height(); 220*cdf0e10cSrcweir aPos.Y() += LogicToPixel( Size( 3, 3 ) ).Height(); 221*cdf0e10cSrcweir long nDelta = maBottomSepFL.GetPosPixel().Y() - aPos.Y(); 222*cdf0e10cSrcweir Window* pWins[] = 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir &maBottomSepFL, &maEnableBtn, &maDisableBtn, &maHelpBtn 225*cdf0e10cSrcweir }; 226*cdf0e10cSrcweir Window** pCurrent = pWins; 227*cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir Point aNewPos = (*pCurrent)->GetPosPixel(); 230*cdf0e10cSrcweir aNewPos.Y() -= nDelta; 231*cdf0e10cSrcweir (*pCurrent)->SetPosPixel( aNewPos ); 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir Size aDlgSz = GetSizePixel(); 235*cdf0e10cSrcweir aDlgSz.Height() -= nDelta; 236*cdf0e10cSrcweir SetSizePixel( aDlgSz ); 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir // check if some buttontexts are to wide 240*cdf0e10cSrcweir String sText = maViewSignsBtn.GetText(); 241*cdf0e10cSrcweir long nTxtW = maViewSignsBtn.GetTextWidth( sText ); 242*cdf0e10cSrcweir const long nOffset = 12; 243*cdf0e10cSrcweir if ( sText.Search( '~' ) == STRING_NOTFOUND ) 244*cdf0e10cSrcweir nTxtW += nOffset; 245*cdf0e10cSrcweir long nBtnW = maViewSignsBtn.GetSizePixel().Width(); 246*cdf0e10cSrcweir if ( nTxtW >= nBtnW ) 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir // broaden the button 249*cdf0e10cSrcweir long nDelta = Max( nTxtW - nBtnW, nOffset/3 ); 250*cdf0e10cSrcweir Size aNewSize = maViewSignsBtn.GetSizePixel(); 251*cdf0e10cSrcweir aNewSize.Width() += nDelta; 252*cdf0e10cSrcweir maViewSignsBtn.SetSizePixel( aNewSize ); 253*cdf0e10cSrcweir // and give it a new position 254*cdf0e10cSrcweir Point aNewPos = maViewSignsBtn.GetPosPixel(); 255*cdf0e10cSrcweir aNewPos.X() -= nDelta; 256*cdf0e10cSrcweir maViewSignsBtn.SetPosPixel( aNewPos ); 257*cdf0e10cSrcweir // the the left fixedtext must be smaller 258*cdf0e10cSrcweir aNewSize = maSignsFI.GetSizePixel(); 259*cdf0e10cSrcweir aNewSize.Width() -= nDelta; 260*cdf0e10cSrcweir maSignsFI.SetSizePixel( aNewSize ); 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir // if the button text (we compare with the longest of both) is too wide, then broaden the buttons 263*cdf0e10cSrcweir String sText1 = maEnableBtn.GetText(); 264*cdf0e10cSrcweir long nTxtW1 = maEnableBtn.GetTextWidth( sText1 ); 265*cdf0e10cSrcweir if ( sText1.Search( '~' ) == STRING_NOTFOUND ) 266*cdf0e10cSrcweir nTxtW1 += nOffset; 267*cdf0e10cSrcweir String sText2 = maDisableBtn.GetText(); 268*cdf0e10cSrcweir long nTxtW2 = maDisableBtn.GetTextWidth( sText2 ); 269*cdf0e10cSrcweir if ( sText2.Search( '~' ) == STRING_NOTFOUND ) 270*cdf0e10cSrcweir nTxtW2 += nOffset; 271*cdf0e10cSrcweir nTxtW = Max( nTxtW1, nTxtW2 ); 272*cdf0e10cSrcweir nBtnW = maEnableBtn.GetSizePixel().Width(); 273*cdf0e10cSrcweir if ( nTxtW > nBtnW ) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir // broaden both buttons 276*cdf0e10cSrcweir long nDelta = nTxtW - nBtnW; 277*cdf0e10cSrcweir Size aNewSize = maEnableBtn.GetSizePixel(); 278*cdf0e10cSrcweir aNewSize.Width() += nDelta; 279*cdf0e10cSrcweir maEnableBtn.SetSizePixel( aNewSize ); 280*cdf0e10cSrcweir maDisableBtn.SetSizePixel( aNewSize ); 281*cdf0e10cSrcweir // and give them a new position 282*cdf0e10cSrcweir Point aNewPos = maEnableBtn.GetPosPixel(); 283*cdf0e10cSrcweir aNewPos.X() -= (2*nDelta); 284*cdf0e10cSrcweir maEnableBtn.SetPosPixel( aNewPos ); 285*cdf0e10cSrcweir aNewPos = maDisableBtn.GetPosPixel(); 286*cdf0e10cSrcweir aNewPos.X() -= nDelta; 287*cdf0e10cSrcweir maDisableBtn.SetPosPixel( aNewPos ); 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir void MacroWarning::FitControls() 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir Size a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT ); 294*cdf0e10cSrcweir Size aNewSize, aMinSize; 295*cdf0e10cSrcweir long nTxtH = 0; 296*cdf0e10cSrcweir long nCtrlH = 0; 297*cdf0e10cSrcweir long nDelta = 0; 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir if ( mbShowSignatures ) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir aMinSize = maSignsFI.CalcMinimumSize( maSignsFI.GetSizePixel().Width() ); 302*cdf0e10cSrcweir nTxtH = Max( aMinSize.Height(), maViewSignsBtn.GetSizePixel().Height() ); 303*cdf0e10cSrcweir nTxtH += a3Size.Height() / 2; 304*cdf0e10cSrcweir nCtrlH = maSignsFI.GetSizePixel().Height(); 305*cdf0e10cSrcweir nDelta = Max( nCtrlH - nTxtH, static_cast< long >( -100 ) ); // not too large 306*cdf0e10cSrcweir aNewSize = maSignsFI.GetSizePixel(); 307*cdf0e10cSrcweir aNewSize.Height() -= nDelta; 308*cdf0e10cSrcweir maSignsFI.SetSizePixel( aNewSize ); 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir aMinSize = maDescr2FI.CalcMinimumSize( maDescr2FI.GetSizePixel().Width() ); 312*cdf0e10cSrcweir nTxtH = aMinSize.Height(); 313*cdf0e10cSrcweir nCtrlH = maDescr2FI.GetSizePixel().Height(); 314*cdf0e10cSrcweir long nDelta2 = ( nCtrlH - nTxtH ); 315*cdf0e10cSrcweir aNewSize = maDescr2FI.GetSizePixel(); 316*cdf0e10cSrcweir aNewSize.Height() -= nDelta2; 317*cdf0e10cSrcweir maDescr2FI.SetSizePixel( aNewSize ); 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir // new position for the succeeding windows 320*cdf0e10cSrcweir Window* pWins[] = 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir &maDescr2FI, &maAlwaysTrustCB, &maBottomSepFL, &maEnableBtn, &maDisableBtn, &maHelpBtn 323*cdf0e10cSrcweir }; 324*cdf0e10cSrcweir Window** pCurrent = pWins; 325*cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir Point aNewPos = (*pCurrent)->GetPosPixel(); 328*cdf0e10cSrcweir aNewPos.Y() -= nDelta; 329*cdf0e10cSrcweir (*pCurrent)->SetPosPixel( aNewPos ); 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir if ( *pCurrent == &maDescr2FI ) 332*cdf0e10cSrcweir nDelta += nDelta2; 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir // new size of the dialog 336*cdf0e10cSrcweir aNewSize = GetSizePixel(); 337*cdf0e10cSrcweir aNewSize.Height() -= nDelta; 338*cdf0e10cSrcweir SetSizePixel( aNewSize ); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir void MacroWarning::SetStorage( const cssu::Reference < css::embed::XStorage >& rxStore, 342*cdf0e10cSrcweir const ::rtl::OUString& aODFVersion, 343*cdf0e10cSrcweir const cssu::Sequence< security::DocumentSignatureInformation >& rInfos ) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir mxStore = rxStore; 346*cdf0e10cSrcweir maODFVersion = aODFVersion; 347*cdf0e10cSrcweir sal_Int32 nCnt = rInfos.getLength(); 348*cdf0e10cSrcweir if( mxStore.is() && nCnt > 0 ) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir mpInfos = &rInfos; 351*cdf0e10cSrcweir String aCN_Id( String::CreateFromAscii( "CN" ) ); 352*cdf0e10cSrcweir String s; 353*cdf0e10cSrcweir s = GetContentPart( rInfos[ 0 ].Signer->getSubjectName(), aCN_Id ); 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir for( sal_Int32 i = 1 ; i < nCnt ; ++i ) 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir s.AppendAscii( "\n" ); 358*cdf0e10cSrcweir s += GetContentPart( rInfos[ i ].Signer->getSubjectName(), aCN_Id ); 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir maSignsFI.SetText( s ); 362*cdf0e10cSrcweir maViewSignsBtn.Enable(); 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir void MacroWarning::SetCertificate( const cssu::Reference< css::security::XCertificate >& _rxCert ) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir mxCert = _rxCert; 369*cdf0e10cSrcweir if( mxCert.is() ) 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir String aCN_Id( String::CreateFromAscii( "CN" ) ); 372*cdf0e10cSrcweir String s; 373*cdf0e10cSrcweir s = GetContentPart( mxCert->getSubjectName(), aCN_Id ); 374*cdf0e10cSrcweir maSignsFI.SetText( s ); 375*cdf0e10cSrcweir maViewSignsBtn.Enable(); 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir 379