diff options
-rw-r--r-- | xmlsecurity/inc/xmlsecurity/certificateviewer.hxx | 9 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/certificateviewer.cxx | 116 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/certificateviewer.src | 28 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/resourcemanager.cxx | 31 | ||||
-rw-r--r-- | xmlsecurity/util/makefile.mk | 5 |
5 files changed, 123 insertions, 66 deletions
diff --git a/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx b/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx index 9683d18aa..dd7cb6a7f 100644 --- a/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx +++ b/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx @@ -2,9 +2,9 @@ * * $RCSfile: certificateviewer.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:20 $ + * last change: $Author: gt $ $Date: 2004-07-14 11:34:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -150,10 +150,13 @@ class CertificateViewerDetailsTP : public CertificateViewerTP private: SvxSimpleTable maElementsLB; MultiLineEdit maElementML; + Font maStdFont; + Font maFixedWidthFont; DECL_LINK( ElementSelectHdl, void* ); void Clear( void ); - void InsertElement( const String& _rField, const String& _rValue, const String& _rDetails ); + void InsertElement( const String& _rField, const String& _rValue, + const String& _rDetails, bool _bFixedWidthFont = false ); public: CertificateViewerDetailsTP( Window* pParent, CertificateViewer* _pDlg ); virtual ~CertificateViewerDetailsTP(); diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 0f64743a3..3c24529bf 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: certificateviewer.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:23 $ + * last change: $Author: gt $ $Date: 2004-07-14 11:36:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,17 +84,52 @@ using namespace ::com::sun::star; namespace { + void ShrinkToFit( FixedImage& _rImage ); + long ShrinkToFitWidth( Control& _rCtrl, long _nOffs = 0 ); // return = new width void AdjustPosAndSize( Control& _rCtrl, Point& _rStartIn_EndOut, long _nXOffset = 0 ); + void AlignAfterImage( const FixedImage& _rImage, Control& _rCtrl, long _nXOffset = 0 ); + void AlignAfterImage( const FixedImage& _rImage, FixedInfo& _rFI, long _nXOffset = 0 ); - void AdjustPosAndSize( Control& _rCtrl, Point& _rStartIn_EndOut, long _nOffs ) + void ShrinkToFit( FixedImage& _rImg ) + { + _rImg.SetSizePixel( _rImg.GetImage().GetSizePixel() ); + } + + long ShrinkToFitWidth( Control& _rCtrl, long _nOffs ) { long nWidth = _rCtrl.GetTextWidth( _rCtrl.GetText() ); Size aSize( _rCtrl.GetSizePixel() ); nWidth += _nOffs; aSize.Width() = nWidth; - _rCtrl.SetPosPixel( _rStartIn_EndOut ); _rCtrl.SetSizePixel( aSize ); - _rStartIn_EndOut.X() += nWidth; + return nWidth; + } + + void AdjustPosAndSize( Control& _rCtrl, Point& _rStartIn_EndOut, long _nOffs ) + { + _rCtrl.SetPosPixel( _rStartIn_EndOut ); + _rStartIn_EndOut.X() += ShrinkToFitWidth( _rCtrl, _nOffs ); + } + + void AlignAfterImage( const FixedImage& _rImage, Control& _rCtrl, long _nXOffset ) + { + Point aPos( _rImage.GetPosPixel() ); + Size aSize( _rImage.GetSizePixel() ); + long n = aPos.X(); + n += aSize.Width(); + n += _nXOffset; + aPos.X() = n; + n = aPos.Y(); + n += aSize.Height() / 2; // y-position is in the middle of the image + n -= _rCtrl.GetSizePixel().Height() / 2; // center Control + aPos.Y() = n; + _rCtrl.SetPosPixel( aPos ); + } + + void AlignAfterImage( const FixedImage& _rImage, FixedInfo& _rFI, long _nXOffset ) + { + AlignAfterImage( _rImage, static_cast< Control& >( _rFI ), _nXOffset ); + ShrinkToFitWidth( _rFI ); } }; @@ -193,39 +228,16 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, Certif // recalc positions for date fields according to real size Point aPos( maValidFromLabelFI.GetPosPixel() ); -// long nWidth; - -// nWidth = GetTextWidth( maValidFromLabelFI.GetText() ); -// maValidFromLabelFI.SetSizePixel -// aPos.X() += nWidth; AdjustPosAndSize( maValidFromLabelFI, aPos ); - -// maValidFromFI.SetPosPixel( aPos ); -// nWidth = GetTextWidth( maValidFromFI.GetText() ); -// aPos.X() += nWidth; AdjustPosAndSize( maValidFromFI, aPos ); - -// maValidToLabelFI.SetPosPixel( aPos ); -// nWidth = GetTextWidth( maValidToLabelFI.GetText() ); -// aPos.X() += nWidth; - -// maValidToFI.SetPosPixel( aPos ); AdjustPosAndSize( maValidToLabelFI, aPos ); AdjustPosAndSize( maValidToFI, aPos ); // adjust position of fixed text depending on image sizes - long nWidth = maCertImg.GetSizePixel().Width(); - aPos = maCertInfoFI.GetPosPixel(); - aPos.X() = maCertImg.GetPosPixel().X(); - aPos.X() += nWidth; - maCertInfoFI.SetPosPixel( aPos ); - - nWidth = maKeyImg.GetSizePixel().Width(); - aPos = maHintCorrespPrivKeyFI.GetPosPixel(); - aPos.X() = maKeyImg.GetPosPixel().X(); - aPos.X() += nWidth; -// maHintCorrespPrivKeyFI.SetPosPixel( aPos ); - AdjustPosAndSize( maHintCorrespPrivKeyFI, aPos ); + ShrinkToFit( maCertImg ); + ShrinkToFit( maKeyImg ); + AlignAfterImage( maCertImg, maCertInfoFI, 12 ); + AlignAfterImage( maKeyImg, maHintCorrespPrivKeyFI, 12 ); } void CertificateViewerGeneralTP::ActivatePage() @@ -233,6 +245,21 @@ void CertificateViewerGeneralTP::ActivatePage() } +struct Details_UserDatat +{ + String maTxt; + bool mbFixedWidthFont; + + inline Details_UserDatat( const String& _rTxt, bool _bFixedWidthFont ); +}; + +inline Details_UserDatat::Details_UserDatat( const String& _rTxt, bool _bFixedWidthFont ) + :maTxt ( _rTxt ) + ,mbFixedWidthFont ( _bFixedWidthFont ) +{ +} + + void CertificateViewerDetailsTP::Clear( void ) { maElementML.SetText( String() ); @@ -240,7 +267,8 @@ void CertificateViewerDetailsTP::Clear( void ) SvLBoxEntry* pEntry = maElementsLB.GetEntry( i ); while( pEntry ) { - delete ( String* ) pEntry->GetUserData(); +// delete ( String* ) pEntry->GetUserData(); + delete ( Details_UserDatat* ) pEntry->GetUserData(); ++i; pEntry = maElementsLB.GetEntry( i ); } @@ -248,18 +276,21 @@ void CertificateViewerDetailsTP::Clear( void ) maElementsLB.Clear(); } -void CertificateViewerDetailsTP::InsertElement( const String& _rField, const String& _rValue, const String& _rDetails ) +void CertificateViewerDetailsTP::InsertElement( const String& _rField, const String& _rValue, + const String& _rDetails, bool _bFixedWidthFont ) { SvLBoxEntry* pEntry = maElementsLB.InsertEntry( _rField ); maElementsLB.SetEntryText( _rValue, pEntry, 1 ); - pEntry->SetUserData( ( void* ) new String( _rDetails ) ); // extended view of value -// pEntry->SetUserData( ( void* ) new String( XmlSec::GetPureContent( _rValue, "\n", true ) ) ); +// pEntry->SetUserData( ( void* ) new String( _rDetails ) ); // extended view of value + pEntry->SetUserData( ( void* ) new Details_UserDatat( _rDetails, _bFixedWidthFont ) ); } CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, CertificateViewer* _pDlg ) :CertificateViewerTP ( _pParent, XMLSEC_RES( RID_XMLSECTP_DETAILS ), _pDlg ) ,maElementsLB ( this, ResId( LB_ELEMENTS ) ) ,maElementML ( this, ResId( ML_ELEMENT ) ) + ,maStdFont ( maElementML.GetFont() ) + ,maFixedWidthFont ( ) { static long nTabs[] = { 2, 0, 40*CS_LB_WIDTH/100 }; maElementsLB.SetTabs( &nTabs[ 0 ] ); @@ -288,8 +319,8 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, Certif // aSerNumStr.AppendAscii( " " ); aSerNumStr.AppendAscii( pBuffer ); } - InsertElement( String( ResId( STR_SERIALNUM ) ), aSerNumStr, aSerNumStr ); - InsertElement( String( ResId( STR_SIGALGORITHM ) ), String::CreateFromAscii( "n/a" ), String() ); + InsertElement( String( ResId( STR_SERIALNUM ) ), aSerNumStr, aSerNumStr, true ); +// InsertElement( String( ResId( STR_SIGALGORITHM ) ), String::CreateFromAscii( "n/a" ), String() ); aLBEntry = XmlSec::GetPureContent( xCert->getIssuerName(), ", " ); aDetails = XmlSec::GetPureContent( xCert->getIssuerName(), "\n", true ); InsertElement( String( ResId( STR_ISSUER ) ), aLBEntry, aDetails ); @@ -319,11 +350,18 @@ IMPL_LINK( CertificateViewerDetailsTP, ElementSelectHdl, void*, EMPTYARG ) { SvLBoxEntry* pEntry = maElementsLB.FirstSelected(); String aElementText; + bool bFixedWidthFont; if( pEntry ) { - aElementText = *( ( String* ) pEntry->GetUserData() ); +// aElementText = *( ( String* ) pEntry->GetUserData() ); + const Details_UserDatat* p = ( Details_UserDatat* ) pEntry->GetUserData(); + aElementText = p->maTxt; + bFixedWidthFont = p->mbFixedWidthFont; } + else + bFixedWidthFont = false; + maElementML.SetFont( bFixedWidthFont? maFixedWidthFont : maStdFont ); maElementML.SetText( aElementText ); return 0; diff --git a/xmlsecurity/source/dialogs/certificateviewer.src b/xmlsecurity/source/dialogs/certificateviewer.src index 1df884d02..c3257dd0f 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.src +++ b/xmlsecurity/source/dialogs/certificateviewer.src @@ -2,9 +2,9 @@ * * $RCSfile: certificateviewer.src,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:23 $ + * last change: $Author: gt $ $Date: 2004-07-14 11:36:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -129,12 +129,12 @@ TabPage RID_XMLSECTP_GENERAL FixedImage IMG_CERT { Pos = MAP_APPFONT( CW_COL_0, CW_ROW_0 ); - Size = MAP_APPFONT( CW_COL_2-CW_COL_0, CW_ROW_2-CW_ROW_0 ); -// Fixed = Image -// { -// ImageBitmap = Bitmap { File = "xmlsec_cert_l.bmp"; }; -// MaskColor = STD_MASKCOLOR; -// }; + Size = MAP_APPFONT( IMG1_WIDTH, IMG1_HEIGHT ); + Fixed = Image + { + ImageBitmap = Bitmap { File = "certificate_40x56.png"; }; + MaskColor = STD_MASKCOLOR; + }; }; FixedText FI_CERTINFO { @@ -212,12 +212,12 @@ TabPage RID_XMLSECTP_GENERAL FixedImage IMG_KEY { Pos = MAP_APPFONT( CW_COL_0, CW_ROW_9 ); - Size = MAP_APPFONT( CW_COL_2-CW_COL_0, CW_ROW_11-CW_ROW_9 ); -// Fixed = Image -// { -// ImageBitmap = Bitmap { File = "xmlsec_key.bmp"; }; -// MaskColor = STD_MASKCOLOR; -// }; + Size = MAP_APPFONT( IMG2_WIDTH, IMG2_HEIGHT ); + Fixed = Image + { + ImageBitmap = Bitmap { File = "key_12.png"; }; + MaskColor = STD_MASKCOLOR; + }; }; FixedText FI_CORRPRIVKEY { diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx index 75a79c630..be44678d6 100644 --- a/xmlsecurity/source/dialogs/resourcemanager.cxx +++ b/xmlsecurity/source/dialogs/resourcemanager.cxx @@ -2,9 +2,9 @@ * * $RCSfile: resourcemanager.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:24 $ + * last change: $Author: gt $ $Date: 2004-07-14 11:36:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -105,24 +105,25 @@ namespace XmlSec String GetDateTimeString( const ::com::sun::star::util::DateTime& _rDT ) { - return GetInternational()->GetLongDate( GetDateTime( _rDT ) ); + return GetInternational()->GetDate( GetDateTime( _rDT ) ); } String GetDateString( const ::com::sun::star::util::DateTime& _rDT ) { - return GetInternational()->GetLongDate( GetDateTime( _rDT ) ); + return GetInternational()->GetDate( GetDateTime( _rDT ) ); } String GetPureContent( const String& _rRawString, const char* _pCommaReplacement, bool _bPreserveId ) { - enum STATE { ID, EQUALSIGN, CONT }; + enum STATE { PRE_ID, ID, EQUALSIGN, PRE_CONT, CONT }; String s; - STATE e = ID; + STATE e = _bPreserveId? PRE_ID : ID; const sal_Unicode* p = _rRawString.GetBuffer(); sal_Unicode c; const sal_Unicode cComma = ','; const sal_Unicode cEqualSign = '='; + const sal_Unicode cSpace = ' '; String aCommaReplacement; if( _pCommaReplacement ) aCommaReplacement = String::CreateFromAscii( _pCommaReplacement ); @@ -132,20 +133,34 @@ namespace XmlSec c = *p; switch( e ) { + case PRE_ID: + if( c != cSpace ) + { + s += c; + e = ID; + } + break; case ID: if( _bPreserveId ) s += c; if( c == cEqualSign ) - e = CONT; + e = _bPreserveId? PRE_CONT : CONT; break; // case EQUALSIGN: // break; + case PRE_CONT: + if( c != cSpace ) + { + s += c; + e = CONT; + } + break; case CONT: if( c == cComma ) { s += aCommaReplacement; - e = ID; + e = _bPreserveId? PRE_ID : ID; } else s += c; diff --git a/xmlsecurity/util/makefile.mk b/xmlsecurity/util/makefile.mk index 8af5a1ffb..272b7bc8a 100644 --- a/xmlsecurity/util/makefile.mk +++ b/xmlsecurity/util/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.4 $ +# $Revision: 1.5 $ # -# last change: $Author: mt $ $Date: 2004-07-14 11:05:46 $ +# last change: $Author: gt $ $Date: 2004-07-14 11:38:07 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -150,6 +150,7 @@ SRSFILELIST= \ $(SRS)$/dialogs.srs RESLIB1NAME=xmlsec +RESLIB1IMAGES=$(PRJ)$/res RESLIB1SRSFILES= $(SRSFILELIST) SHL4TARGET=$(TARGET) |