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