Kaydet (Commit) b1b0cdf5 authored tarafından gt's avatar gt

#i20883#

üst 9a4ece8a
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: certificateviewer.hxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -150,10 +150,13 @@ class CertificateViewerDetailsTP : public CertificateViewerTP ...@@ -150,10 +150,13 @@ class CertificateViewerDetailsTP : public CertificateViewerTP
private: private:
SvxSimpleTable maElementsLB; SvxSimpleTable maElementsLB;
MultiLineEdit maElementML; MultiLineEdit maElementML;
Font maStdFont;
Font maFixedWidthFont;
DECL_LINK( ElementSelectHdl, void* ); DECL_LINK( ElementSelectHdl, void* );
void Clear( 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: public:
CertificateViewerDetailsTP( Window* pParent, CertificateViewer* _pDlg ); CertificateViewerDetailsTP( Window* pParent, CertificateViewer* _pDlg );
virtual ~CertificateViewerDetailsTP(); virtual ~CertificateViewerDetailsTP();
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: certificateviewer.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -84,17 +84,52 @@ using namespace ::com::sun::star; ...@@ -84,17 +84,52 @@ using namespace ::com::sun::star;
namespace 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 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() ); long nWidth = _rCtrl.GetTextWidth( _rCtrl.GetText() );
Size aSize( _rCtrl.GetSizePixel() ); Size aSize( _rCtrl.GetSizePixel() );
nWidth += _nOffs; nWidth += _nOffs;
aSize.Width() = nWidth; aSize.Width() = nWidth;
_rCtrl.SetPosPixel( _rStartIn_EndOut );
_rCtrl.SetSizePixel( aSize ); _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 ...@@ -193,39 +228,16 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, Certif
// recalc positions for date fields according to real size // recalc positions for date fields according to real size
Point aPos( maValidFromLabelFI.GetPosPixel() ); Point aPos( maValidFromLabelFI.GetPosPixel() );
// long nWidth;
// nWidth = GetTextWidth( maValidFromLabelFI.GetText() );
// maValidFromLabelFI.SetSizePixel
// aPos.X() += nWidth;
AdjustPosAndSize( maValidFromLabelFI, aPos ); AdjustPosAndSize( maValidFromLabelFI, aPos );
// maValidFromFI.SetPosPixel( aPos );
// nWidth = GetTextWidth( maValidFromFI.GetText() );
// aPos.X() += nWidth;
AdjustPosAndSize( maValidFromFI, aPos ); AdjustPosAndSize( maValidFromFI, aPos );
// maValidToLabelFI.SetPosPixel( aPos );
// nWidth = GetTextWidth( maValidToLabelFI.GetText() );
// aPos.X() += nWidth;
// maValidToFI.SetPosPixel( aPos );
AdjustPosAndSize( maValidToLabelFI, aPos ); AdjustPosAndSize( maValidToLabelFI, aPos );
AdjustPosAndSize( maValidToFI, aPos ); AdjustPosAndSize( maValidToFI, aPos );
// adjust position of fixed text depending on image sizes // adjust position of fixed text depending on image sizes
long nWidth = maCertImg.GetSizePixel().Width(); ShrinkToFit( maCertImg );
aPos = maCertInfoFI.GetPosPixel(); ShrinkToFit( maKeyImg );
aPos.X() = maCertImg.GetPosPixel().X(); AlignAfterImage( maCertImg, maCertInfoFI, 12 );
aPos.X() += nWidth; AlignAfterImage( maKeyImg, maHintCorrespPrivKeyFI, 12 );
maCertInfoFI.SetPosPixel( aPos );
nWidth = maKeyImg.GetSizePixel().Width();
aPos = maHintCorrespPrivKeyFI.GetPosPixel();
aPos.X() = maKeyImg.GetPosPixel().X();
aPos.X() += nWidth;
// maHintCorrespPrivKeyFI.SetPosPixel( aPos );
AdjustPosAndSize( maHintCorrespPrivKeyFI, aPos );
} }
void CertificateViewerGeneralTP::ActivatePage() void CertificateViewerGeneralTP::ActivatePage()
...@@ -233,6 +245,21 @@ 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 ) void CertificateViewerDetailsTP::Clear( void )
{ {
maElementML.SetText( String() ); maElementML.SetText( String() );
...@@ -240,7 +267,8 @@ void CertificateViewerDetailsTP::Clear( void ) ...@@ -240,7 +267,8 @@ void CertificateViewerDetailsTP::Clear( void )
SvLBoxEntry* pEntry = maElementsLB.GetEntry( i ); SvLBoxEntry* pEntry = maElementsLB.GetEntry( i );
while( pEntry ) while( pEntry )
{ {
delete ( String* ) pEntry->GetUserData(); // delete ( String* ) pEntry->GetUserData();
delete ( Details_UserDatat* ) pEntry->GetUserData();
++i; ++i;
pEntry = maElementsLB.GetEntry( i ); pEntry = maElementsLB.GetEntry( i );
} }
...@@ -248,18 +276,21 @@ void CertificateViewerDetailsTP::Clear( void ) ...@@ -248,18 +276,21 @@ void CertificateViewerDetailsTP::Clear( void )
maElementsLB.Clear(); 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 ); SvLBoxEntry* pEntry = maElementsLB.InsertEntry( _rField );
maElementsLB.SetEntryText( _rValue, pEntry, 1 ); maElementsLB.SetEntryText( _rValue, pEntry, 1 );
pEntry->SetUserData( ( void* ) new String( _rDetails ) ); // extended view of value // pEntry->SetUserData( ( void* ) new String( _rDetails ) ); // extended view of value
// pEntry->SetUserData( ( void* ) new String( XmlSec::GetPureContent( _rValue, "\n", true ) ) ); pEntry->SetUserData( ( void* ) new Details_UserDatat( _rDetails, _bFixedWidthFont ) );
} }
CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, CertificateViewer* _pDlg ) CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, CertificateViewer* _pDlg )
:CertificateViewerTP ( _pParent, XMLSEC_RES( RID_XMLSECTP_DETAILS ), _pDlg ) :CertificateViewerTP ( _pParent, XMLSEC_RES( RID_XMLSECTP_DETAILS ), _pDlg )
,maElementsLB ( this, ResId( LB_ELEMENTS ) ) ,maElementsLB ( this, ResId( LB_ELEMENTS ) )
,maElementML ( this, ResId( ML_ELEMENT ) ) ,maElementML ( this, ResId( ML_ELEMENT ) )
,maStdFont ( maElementML.GetFont() )
,maFixedWidthFont ( )
{ {
static long nTabs[] = { 2, 0, 40*CS_LB_WIDTH/100 }; static long nTabs[] = { 2, 0, 40*CS_LB_WIDTH/100 };
maElementsLB.SetTabs( &nTabs[ 0 ] ); maElementsLB.SetTabs( &nTabs[ 0 ] );
...@@ -288,8 +319,8 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, Certif ...@@ -288,8 +319,8 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, Certif
// aSerNumStr.AppendAscii( " " ); // aSerNumStr.AppendAscii( " " );
aSerNumStr.AppendAscii( pBuffer ); aSerNumStr.AppendAscii( pBuffer );
} }
InsertElement( String( ResId( STR_SERIALNUM ) ), aSerNumStr, aSerNumStr ); InsertElement( String( ResId( STR_SERIALNUM ) ), aSerNumStr, aSerNumStr, true );
InsertElement( String( ResId( STR_SIGALGORITHM ) ), String::CreateFromAscii( "n/a" ), String() ); // InsertElement( String( ResId( STR_SIGALGORITHM ) ), String::CreateFromAscii( "n/a" ), String() );
aLBEntry = XmlSec::GetPureContent( xCert->getIssuerName(), ", " ); aLBEntry = XmlSec::GetPureContent( xCert->getIssuerName(), ", " );
aDetails = XmlSec::GetPureContent( xCert->getIssuerName(), "\n", true ); aDetails = XmlSec::GetPureContent( xCert->getIssuerName(), "\n", true );
InsertElement( String( ResId( STR_ISSUER ) ), aLBEntry, aDetails ); InsertElement( String( ResId( STR_ISSUER ) ), aLBEntry, aDetails );
...@@ -319,11 +350,18 @@ IMPL_LINK( CertificateViewerDetailsTP, ElementSelectHdl, void*, EMPTYARG ) ...@@ -319,11 +350,18 @@ IMPL_LINK( CertificateViewerDetailsTP, ElementSelectHdl, void*, EMPTYARG )
{ {
SvLBoxEntry* pEntry = maElementsLB.FirstSelected(); SvLBoxEntry* pEntry = maElementsLB.FirstSelected();
String aElementText; String aElementText;
bool bFixedWidthFont;
if( pEntry ) 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 ); maElementML.SetText( aElementText );
return 0; return 0;
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: certificateviewer.src,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -129,12 +129,12 @@ TabPage RID_XMLSECTP_GENERAL ...@@ -129,12 +129,12 @@ TabPage RID_XMLSECTP_GENERAL
FixedImage IMG_CERT FixedImage IMG_CERT
{ {
Pos = MAP_APPFONT( CW_COL_0, CW_ROW_0 ); Pos = MAP_APPFONT( CW_COL_0, CW_ROW_0 );
Size = MAP_APPFONT( CW_COL_2-CW_COL_0, CW_ROW_2-CW_ROW_0 ); Size = MAP_APPFONT( IMG1_WIDTH, IMG1_HEIGHT );
// Fixed = Image Fixed = Image
// { {
// ImageBitmap = Bitmap { File = "xmlsec_cert_l.bmp"; }; ImageBitmap = Bitmap { File = "certificate_40x56.png"; };
// MaskColor = STD_MASKCOLOR; MaskColor = STD_MASKCOLOR;
// }; };
}; };
FixedText FI_CERTINFO FixedText FI_CERTINFO
{ {
...@@ -212,12 +212,12 @@ TabPage RID_XMLSECTP_GENERAL ...@@ -212,12 +212,12 @@ TabPage RID_XMLSECTP_GENERAL
FixedImage IMG_KEY FixedImage IMG_KEY
{ {
Pos = MAP_APPFONT( CW_COL_0, CW_ROW_9 ); Pos = MAP_APPFONT( CW_COL_0, CW_ROW_9 );
Size = MAP_APPFONT( CW_COL_2-CW_COL_0, CW_ROW_11-CW_ROW_9 ); Size = MAP_APPFONT( IMG2_WIDTH, IMG2_HEIGHT );
// Fixed = Image Fixed = Image
// { {
// ImageBitmap = Bitmap { File = "xmlsec_key.bmp"; }; ImageBitmap = Bitmap { File = "key_12.png"; };
// MaskColor = STD_MASKCOLOR; MaskColor = STD_MASKCOLOR;
// }; };
}; };
FixedText FI_CORRPRIVKEY FixedText FI_CORRPRIVKEY
{ {
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: resourcemanager.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -105,24 +105,25 @@ namespace XmlSec ...@@ -105,24 +105,25 @@ namespace XmlSec
String GetDateTimeString( const ::com::sun::star::util::DateTime& _rDT ) 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 ) 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 ) 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; String s;
STATE e = ID; STATE e = _bPreserveId? PRE_ID : ID;
const sal_Unicode* p = _rRawString.GetBuffer(); const sal_Unicode* p = _rRawString.GetBuffer();
sal_Unicode c; sal_Unicode c;
const sal_Unicode cComma = ','; const sal_Unicode cComma = ',';
const sal_Unicode cEqualSign = '='; const sal_Unicode cEqualSign = '=';
const sal_Unicode cSpace = ' ';
String aCommaReplacement; String aCommaReplacement;
if( _pCommaReplacement ) if( _pCommaReplacement )
aCommaReplacement = String::CreateFromAscii( _pCommaReplacement ); aCommaReplacement = String::CreateFromAscii( _pCommaReplacement );
...@@ -132,20 +133,34 @@ namespace XmlSec ...@@ -132,20 +133,34 @@ namespace XmlSec
c = *p; c = *p;
switch( e ) switch( e )
{ {
case PRE_ID:
if( c != cSpace )
{
s += c;
e = ID;
}
break;
case ID: case ID:
if( _bPreserveId ) if( _bPreserveId )
s += c; s += c;
if( c == cEqualSign ) if( c == cEqualSign )
e = CONT; e = _bPreserveId? PRE_CONT : CONT;
break; break;
// case EQUALSIGN: // case EQUALSIGN:
// break; // break;
case PRE_CONT:
if( c != cSpace )
{
s += c;
e = CONT;
}
break;
case CONT: case CONT:
if( c == cComma ) if( c == cComma )
{ {
s += aCommaReplacement; s += aCommaReplacement;
e = ID; e = _bPreserveId? PRE_ID : ID;
} }
else else
s += c; s += c;
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
# #
# $RCSfile: makefile.mk,v $ # $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 # The Contents of this file are made available subject to the terms of
# either of the following licenses # either of the following licenses
...@@ -150,6 +150,7 @@ SRSFILELIST= \ ...@@ -150,6 +150,7 @@ SRSFILELIST= \
$(SRS)$/dialogs.srs $(SRS)$/dialogs.srs
RESLIB1NAME=xmlsec RESLIB1NAME=xmlsec
RESLIB1IMAGES=$(PRJ)$/res
RESLIB1SRSFILES= $(SRSFILELIST) RESLIB1SRSFILES= $(SRSFILELIST)
SHL4TARGET=$(TARGET) SHL4TARGET=$(TARGET)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment