xmlsecurity/inc/xmlsecurity/certificateviewer.hxx | 10 - xmlsecurity/inc/xmlsecurity/macrosecurity.hxx | 2 xmlsecurity/inc/xmlsecurity/stbcontrl.hxx | 50 ------- xmlsecurity/source/dialogs/certificatechooser.cxx | 14 +- xmlsecurity/source/dialogs/certificateviewer.cxx | 71 +++++----- xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 14 -- xmlsecurity/source/dialogs/macrosecurity.cxx | 10 - xmlsecurity/source/dialogs/resourcemanager.cxx | 27 +--- xmlsecurity/source/dialogs/resourcemanager.hxx | 8 - xmlsecurity/source/dialogs/stbcontrl.cxx | 112 ----------------- xmlsecurity/source/helper/xsecctl.cxx | 41 ++---- xmlsecurity/workben/signaturetest.cxx | 43 +++--- 12 files changed, 116 insertions(+), 286 deletions(-)
New commits: commit 3e46a434eb50f8d73f64be8619598dae6dc32a06 Author: Ivan Timofeev <timofeev....@gmail.com> Date: Tue Sep 25 10:31:20 2012 +0400 String -> OUString Change-Id: I4fc17b5fff7a00edc96bd4f75565b5f041c1dcb0 diff --git a/xmlsecurity/workben/signaturetest.cxx b/xmlsecurity/workben/signaturetest.cxx index 4adb6cb..1653b8f 100644 --- a/xmlsecurity/workben/signaturetest.cxx +++ b/xmlsecurity/workben/signaturetest.cxx @@ -180,18 +180,18 @@ MyWin::MyWin( Window* pParent, WinBits nWinStyle ) : { Size aOutputSize( 400, 400 ); SetOutputSizePixel( aOutputSize ); - SetText( String( RTL_CONSTASCII_USTRINGPARAM( "XML Signature Test" ) ) ); + SetText( OUString("XML Signature Test") ); long nY = 15; maTokenLine.SetPosSizePixel( TEXTFIELDSTARTX, nY, aOutputSize.Width()-2*TEXTFIELDSTARTX, FIXEDLINEHEIGHT ); - maTokenLine.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Crypto Settings" ) ) ); + maTokenLine.SetText( OUString("Crypto Settings") ); maTokenLine.Show(); nY += EDITHEIGHT*3/2; maCryptoCheckBox.SetPosSizePixel( TEXTFIELDSTARTX, nY, aOutputSize.Width()-2*TEXTFIELDSTARTX, FIXEDLINEHEIGHT ); - maCryptoCheckBox.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Use Default Token (NSS option only)" ) ) ); + maCryptoCheckBox.SetText( OUString("Use Default Token (NSS option only)") ); maCryptoCheckBox.Check( sal_True ); maEditTokenName.Disable(); maFixedTextTokenName.Disable(); @@ -201,7 +201,7 @@ MyWin::MyWin( Window* pParent, WinBits nWinStyle ) : nY += EDITHEIGHT; maFixedTextTokenName.SetPosSizePixel( TEXTFIELDSTARTX, nY, TEXTFIELDWIDTH, EDITHEIGHT ); - maFixedTextTokenName.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Crypto Token:" ) ) ); + maFixedTextTokenName.SetText( OUString("Crypto Token:") ); maFixedTextTokenName.Show(); maEditTokenName.SetPosSizePixel( TEXTFIELDSTARTX+TEXTFIELDWIDTH, nY, EDITWIDTH, EDITHEIGHT ); @@ -210,14 +210,14 @@ MyWin::MyWin( Window* pParent, WinBits nWinStyle ) : nY += EDITHEIGHT*3; maTest2Line.SetPosSizePixel( TEXTFIELDSTARTX, nY, aOutputSize.Width()-2*TEXTFIELDSTARTX, FIXEDLINEHEIGHT ); - maTest2Line.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Test Office Document" ) ) ); + maTest2Line.SetText( OUString("Test Office Document") ); maTest2Line.Show(); nY += EDITHEIGHT*3/2; maFixedTextDOCFileName.SetPosSizePixel( TEXTFIELDSTARTX, nY, TEXTFIELDWIDTH, EDITHEIGHT ); - maFixedTextDOCFileName.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Office File:" ) ) ); + maFixedTextDOCFileName.SetText( OUString("Office File:") ); maFixedTextDOCFileName.Show(); maEditDOCFileName.SetPosSizePixel( TEXTFIELDSTARTX+TEXTFIELDWIDTH, nY, EDITWIDTH, EDITHEIGHT ); @@ -226,12 +226,12 @@ MyWin::MyWin( Window* pParent, WinBits nWinStyle ) : nY += EDITHEIGHT*2; maDigitalSignaturesButton.SetPosSizePixel( TEXTFIELDSTARTX, nY, BUTTONWIDTH*2, BUTTONHEIGHT ); - maDigitalSignaturesButton.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Digital Signatures..." ) ) ); + maDigitalSignaturesButton.SetText( OUString("Digital Signatures...") ); maDigitalSignaturesButton.SetClickHdl( LINK( this, MyWin, DigitalSignaturesWithServiceHdl ) ); maDigitalSignaturesButton.Show(); maVerifyDigitalSignaturesButton.SetPosSizePixel( TEXTFIELDSTARTX+BUTTONWIDTH*2+BUTTONSPACE, nY, BUTTONWIDTH*2, BUTTONHEIGHT ); - maVerifyDigitalSignaturesButton.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Verify Signatures" ) ) ); + maVerifyDigitalSignaturesButton.SetText( OUString("Verify Signatures") ); maVerifyDigitalSignaturesButton.SetClickHdl( LINK( this, MyWin, VerifyDigitalSignaturesHdl ) ); maVerifyDigitalSignaturesButton.Show(); @@ -243,24 +243,23 @@ MyWin::MyWin( Window* pParent, WinBits nWinStyle ) : nY += EDITHEIGHT*2; maHintText.SetPosSizePixel( TEXTFIELDSTARTX, nY, aOutputSize.Width()-2*TEXTFIELDSTARTX, aOutputSize.Height()-nY ); - maHintText.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Hint: Copy crypto files from xmlsecurity/tools/cryptoken/nss and sample files from xmlsecurity/tools/examples to <temp>/nss.\nThis location will be used from the demo as the default location." ) ) ); + maHintText.SetText( OUString("Hint: Copy crypto files from xmlsecurity/tools/cryptoken/nss and sample files from xmlsecurity/tools/examples to <temp>/nss.\nThis location will be used from the demo as the default location.") ); maHintText.Show(); // Help the user with some default values ::rtl::OUString aTempDirURL; ::osl::File::getTempDirURL( aTempDirURL ); INetURLObject aURLObj( aTempDirURL ); - aURLObj.insertName( String( RTL_CONSTASCII_USTRINGPARAM( "nss" ) ), true ); + aURLObj.insertName( "nss", true ); ::rtl::OUString aNSSFolder = aURLObj.getFSysPath( INetURLObject::FSYS_DETECT ); - String aDefaultXMLFileName( aNSSFolder ); - maEditXMLFileName.SetText( aNSSFolder + String( RTL_CONSTASCII_USTRINGPARAM( "demo-sample.xml" ) ) ); - maEditBINFileName.SetText( aNSSFolder + String( RTL_CONSTASCII_USTRINGPARAM( "demo-sample.gif" ) ) ); - maEditDOCFileName.SetText( aNSSFolder + String( RTL_CONSTASCII_USTRINGPARAM( "demo-sample.sxw" ) ) ); - maEditSIGFileName.SetText( aNSSFolder + String( RTL_CONSTASCII_USTRINGPARAM( "demo-result.xml" ) ) ); + maEditXMLFileName.SetText( aNSSFolder + "demo-sample.xml" ); + maEditBINFileName.SetText( aNSSFolder + "demo-sample.gif" ); + maEditDOCFileName.SetText( aNSSFolder + "demo-sample.sxw" ); + maEditSIGFileName.SetText( aNSSFolder + "demo-result.xml" ); maEditTokenName.SetText( aNSSFolder ); #ifdef WNT - maEditTokenName.SetText( String() ); + maEditTokenName.SetText( OUString() ); maEditTokenName.Disable(); maCryptoCheckBox.Disable(); #endif @@ -309,13 +308,13 @@ IMPL_LINK_NOARG(MyWin, VerifyDigitalSignaturesHdl) for ( int n = 0; n < nInfos; n++ ) { security::DocumentSignatureInformation& rInf = aInfos[n]; - String aText( RTL_CONSTASCII_USTRINGPARAM( "The document is signed by\n\n " ) ); - aText += String( rInf.Signer->getSubjectName() ); - aText += String( RTL_CONSTASCII_USTRINGPARAM( "\n\n The signature is " ) ); + OUStringBuffer aText( "The document is signed by\n\n " ); + aText.append( rInf.Signer->getSubjectName() ); + aText.append( "\n\n The signature is " ); if ( !rInf.SignatureIsValid ) - aText += String( RTL_CONSTASCII_USTRINGPARAM( "NOT " ) ); - aText += String( RTL_CONSTASCII_USTRINGPARAM( "valid" ) ); - InfoBox( this, aText ).Execute(); + aText.append( "NOT " ); + aText.append( "valid" ); + InfoBox( this, aText.makeStringAndClear() ).Execute(); } return 0; commit 4f850e065632dc56d0c76bbbe23c3f44d1a7872d Author: Ivan Timofeev <timofeev....@gmail.com> Date: Mon Sep 24 21:32:49 2012 +0400 String -> OUString Change-Id: I252675bf223b8a14dff2b4bcdbfd926979e56dc3 diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx index 8037ef9..56f4df3 100644 --- a/xmlsecurity/source/helper/xsecctl.cxx +++ b/xmlsecurity/source/helper/xsecctl.cxx @@ -30,7 +30,6 @@ #include <xmloff/attrlist.hxx> #include <rtl/math.hxx> -#include <tools/string.hxx> namespace cssu = com::sun::star::uno; namespace cssl = com::sun::star::lang; @@ -112,42 +111,40 @@ sal_Bool XSecController::convertNumber( sal_Int32& rValue, void XSecController::convertDateTime( ::rtl::OUStringBuffer& rBuffer, const com::sun::star::util::DateTime& rDateTime ) { - String aString( String::CreateFromInt32( rDateTime.Year ) ); - aString += '-'; + rBuffer.append((sal_Int32) rDateTime.Year); + rBuffer.append('-'); if( rDateTime.Month < 10 ) - aString += '0'; - aString += String::CreateFromInt32( rDateTime.Month ); - aString += '-'; + rBuffer.append('0'); + rBuffer.append((sal_Int32) rDateTime.Month); + rBuffer.append('-'); if( rDateTime.Day < 10 ) - aString += '0'; - aString += String::CreateFromInt32( rDateTime.Day ); + rBuffer.append('0'); + rBuffer.append((sal_Int32) rDateTime.Day); if( rDateTime.Seconds != 0 || rDateTime.Minutes != 0 || rDateTime.Hours != 0 ) { - aString += 'T'; + rBuffer.append('T'); if( rDateTime.Hours < 10 ) - aString += '0'; - aString += String::CreateFromInt32( rDateTime.Hours ); - aString += ':'; + rBuffer.append('0'); + rBuffer.append((sal_Int32) rDateTime.Hours); + rBuffer.append(':'); if( rDateTime.Minutes < 10 ) - aString += '0'; - aString += String::CreateFromInt32( rDateTime.Minutes ); - aString += ':'; + rBuffer.append('0'); + rBuffer.append((sal_Int32) rDateTime.Minutes); + rBuffer.append(':'); if( rDateTime.Seconds < 10 ) - aString += '0'; - aString += String::CreateFromInt32( rDateTime.Seconds ); + rBuffer.append('0'); + rBuffer.append((sal_Int32) rDateTime.Seconds); if ( rDateTime.HundredthSeconds > 0) { - aString += ','; + rBuffer.append(','); if (rDateTime.HundredthSeconds < 10) - aString += '0'; - aString += String::CreateFromInt32( rDateTime.HundredthSeconds ); + rBuffer.append('0'); + rBuffer.append((sal_Int32) rDateTime.HundredthSeconds); } } - - rBuffer.append( aString ); } /** convert ISO Date String to util::DateTime */ commit 57bd5cf70a875db4ec50761c6e53f4b478c10372 Author: Ivan Timofeev <timofeev....@gmail.com> Date: Mon Sep 24 16:46:37 2012 +0400 remove unused files Change-Id: I0b656cd8ac242913fba142554ecbc58440d14e41 diff --git a/xmlsecurity/inc/xmlsecurity/stbcontrl.hxx b/xmlsecurity/inc/xmlsecurity/stbcontrl.hxx deleted file mode 100644 index 50eb27c..0000000 --- a/xmlsecurity/inc/xmlsecurity/stbcontrl.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _XMLSECURITY_STBCONTRL_HXX -#define _XMLSECURITY_STBCONTRL_HXX - -#include <sfx2/stbitem.hxx> - - -class SvxSizeItem; - -// class SvxPosSizeToolBoxControl ---------------------------------------- - -class XmlSecStatusBarControl : public SfxStatusBarControl -{ -private: - struct XmlSecStatusBarControl_Impl; - - XmlSecStatusBarControl_Impl* mpImpl; - -public: - SFX_DECL_STATUSBAR_CONTROL(); - - XmlSecStatusBarControl( sal_uInt16 _nId, StatusBar& _rStb, SfxBindings& _rBind ); - ~XmlSecStatusBarControl(); - - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); - virtual void Paint( const UserDrawEvent& rEvt ); - virtual void Command( const CommandEvent& rCEvt ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/dialogs/stbcontrl.cxx b/xmlsecurity/source/dialogs/stbcontrl.cxx deleted file mode 100644 index bd4339b..0000000 --- a/xmlsecurity/source/dialogs/stbcontrl.cxx +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <tools/shl.hxx> -#include <vcl/status.hxx> -#include <vcl/menu.hxx> -#include <vcl/image.hxx> -#include <sfx2/app.hxx> -#include <sfx2/module.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/objsh.hxx> -#include <svl/eitem.hxx> -#include <xmlsecurity/stbcontrl.hxx> - -#define PAINT_OFFSET 5 - -SFX_IMPL_STATUSBAR_CONTROL( XmlSecStatusBarControl, SfxBoolItem ); - - -struct XmlSecStatusBarControl::XmlSecStatusBarControl_Impl -{ - Point maPos; - Size maSize; - bool mbSigned; - Image maImage; -}; - - -XmlSecStatusBarControl::XmlSecStatusBarControl( sal_uInt16 _nId, StatusBar& _rStb, SfxBindings& _rBind ) - :SfxStatusBarControl( _nId, _rStb, _rBind ) - - ,mpImpl( new XmlSecStatusBarControl_Impl ) -{ - mpImpl->mbSigned = false; -} - -XmlSecStatusBarControl::~XmlSecStatusBarControl() -{ - delete mpImpl; -} - -void XmlSecStatusBarControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) -{ - GetStatusBar().SetHelpText( GetId(), String() ); // necessary ? - GetStatusBar().SetHelpId( GetId(), nSID ); // necessary ? - - if( SFX_ITEM_AVAILABLE != eState ) - { - mpImpl->mbSigned = false; - } - else if( pState->ISA( SfxBoolItem ) ) - { - mpImpl->mbSigned = ( ( SfxBoolItem* ) pState )->GetValue(); - } - else - { - SAL_WARN( "xmlsecurity.dialogs", "+XmlSecStatusBarControl::StateChanged(): invalid item type" ); - mpImpl->mbSigned = false; - } - - if( GetStatusBar().AreItemsVisible() ) // necessary ? - GetStatusBar().SetItemData( GetId(), 0 ); - - GetStatusBar().SetItemText( GetId(), String() ); // necessary ? -} - -void XmlSecStatusBarControl::Command( const CommandEvent& rCEvt ) -{ - // can / has to be done when integrated in Office! - SfxStatusBarControl::Command( rCEvt ); -} - -void XmlSecStatusBarControl::Paint( const UserDrawEvent& rUsrEvt ) -{ - OutputDevice* pDev = rUsrEvt.GetDevice(); - DBG_ASSERT( pDev, "-XmlSecStatusBarControl::Paint(): no Output Device... this will lead to nirvana..." ); - const Rectangle& rRect = rUsrEvt.GetRect(); - StatusBar& rBar = GetStatusBar(); - Point aItemPos = rBar.GetItemTextPos( GetId() ); - Color aOldLineColor = pDev->GetLineColor(); - Color aOldFillColor = pDev->GetFillColor(); - - // just 4 testing until we've got a bitmap - pDev->SetLineColor(); - pDev->SetFillColor( pDev->GetBackground().GetColor() ); - - String s( String::CreateFromAscii( mpImpl->mbSigned? "X" : "-" ) ); - pDev->DrawRect( rRect ); - pDev->DrawText( Point( rRect.Left() + rRect.GetWidth() / 2 - pDev->GetTextWidth( s ) / 2, aItemPos.Y() ), s ); - - pDev->SetLineColor( aOldLineColor ); - pDev->SetFillColor( aOldFillColor ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 62a7d56345cc5d774fbcd79d55fa516c17aa0aa5 Author: Ivan Timofeev <timofeev....@gmail.com> Date: Mon Sep 24 16:39:58 2012 +0400 String -> OUString Change-Id: Ia4d1fd7ef627459666ed204601313a96507b9104 diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx index 3051b29..aa920d5 100644 --- a/xmlsecurity/source/dialogs/resourcemanager.cxx +++ b/xmlsecurity/source/dialogs/resourcemanager.cxx @@ -29,7 +29,6 @@ #include <rtl/ustrbuf.h> #include <vector> -using ::rtl::OUString; using namespace std; namespace XmlSec @@ -58,18 +57,18 @@ namespace XmlSec Time( _rDT.Hours, _rDT.Minutes, _rDT.Seconds, _rDT.HundredthSeconds ) ); } - String GetDateTimeString( const ::com::sun::star::util::DateTime& _rDT ) + OUString GetDateTimeString( const ::com::sun::star::util::DateTime& _rDT ) { // String with date and time information (#i20172#) DateTime aDT( GetDateTime( _rDT ) ); const LocaleDataWrapper& rLoDa = GetLocaleData(); - String sRet( rLoDa.getDate( aDT ) ); - sRet += ' '; - sRet += rLoDa.getTime( aDT ); - return sRet; + OUStringBuffer sRet( rLoDa.getDate( aDT ) ); + sRet.append( ' ' ); + sRet.append( rLoDa.getTime( aDT ) ); + return sRet.makeStringAndClear(); } - String GetDateString( const ::com::sun::star::util::DateTime& _rDT ) + OUString GetDateString( const ::com::sun::star::util::DateTime& _rDT ) { return GetLocaleData().getDate( GetDateTime( _rDT ) ); } @@ -295,7 +294,7 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString) #endif - String GetContentPart( const String& _rRawString ) + OUString GetContentPart( const OUString& _rRawString ) { char const * aIDs[] = { "CN", "OU", "O", "E", NULL }; OUString retVal; @@ -319,11 +318,11 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString) return retVal; } - String GetHexString( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rSeq, const char* _pSep, sal_uInt16 _nLineBreak ) + OUString GetHexString( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rSeq, const char* _pSep, sal_uInt16 _nLineBreak ) { const sal_Int8* pSerNumSeq = _rSeq.getConstArray(); int nCnt = _rSeq.getLength(); - String aStr; + OUStringBuffer aStr; const char pHexDigs[ 17 ] = "0123456789ABCDEF"; char pBuffer[ 3 ] = " "; sal_uInt8 nNum; @@ -337,19 +336,19 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString) pBuffer[ 1 ] = pHexDigs[ nNum & 0x0F ]; nNum >>= 4; pBuffer[ 0 ] = pHexDigs[ nNum ]; - aStr.AppendAscii( pBuffer ); + aStr.appendAscii( pBuffer ); --nBreak; if( nBreak ) - aStr.AppendAscii( _pSep ); + aStr.appendAscii( _pSep ); else { nBreak = nBreakStart; - aStr.AppendAscii( "\n" ); + aStr.append( '\n' ); } } - return aStr; + return aStr.makeStringAndClear(); } long ShrinkToFitWidth( Control& _rCtrl, long _nOffs ) diff --git a/xmlsecurity/source/dialogs/resourcemanager.hxx b/xmlsecurity/source/dialogs/resourcemanager.hxx index 7c3d05b..aa893fa 100644 --- a/xmlsecurity/source/dialogs/resourcemanager.hxx +++ b/xmlsecurity/source/dialogs/resourcemanager.hxx @@ -38,16 +38,16 @@ namespace XmlSec const LocaleDataWrapper& GetLocaleData( void ); DateTime GetDateTime( const ::com::sun::star::util::DateTime& _rDT ); - String GetDateTimeString( const ::com::sun::star::util::DateTime& _rDT ); - String GetDateString( const ::com::sun::star::util::DateTime& _rDT ); + OUString GetDateTimeString( const ::com::sun::star::util::DateTime& _rDT ); + OUString GetDateString( const ::com::sun::star::util::DateTime& _rDT ); std::vector< std::pair< ::rtl::OUString, ::rtl::OUString> > parseDN(const ::rtl::OUString& rRawString); std::pair< ::rtl::OUString, ::rtl::OUString> GetDNForCertDetailsView( const ::rtl::OUString & rRawString); - String GetContentPart( const String& _rRawString ); + OUString GetContentPart( const OUString& _rRawString ); - String GetHexString( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rSeq, const char* _pSep = ":", sal_uInt16 _nLineBreak = 0xFFFF ); + OUString GetHexString( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rSeq, const char* _pSep = ":", sal_uInt16 _nLineBreak = 0xFFFF ); long ShrinkToFitWidth( Control& _rCtrl, long _nOffs = 0 ); // return = new width void AlignAfterImage( const FixedImage& _rImage, Control& _rCtrl, long _nXOffset = 0 ); commit b4c8346a1e9d127bd7d086b0a30d854b8fc3b263 Author: Ivan Timofeev <timofeev....@gmail.com> Date: Mon Sep 24 16:20:00 2012 +0400 String -> OUString Change-Id: I896ce861e55d98a45bd4e6b4a65607f25489557e diff --git a/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx b/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx index b1b42c0..7c6e44c 100644 --- a/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx +++ b/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx @@ -50,7 +50,7 @@ public: ~ReadOnlyImage(); virtual void RequestHelp( const HelpEvent& rHEvt ); - static const String& GetHelpTip(); + static const OUString& GetHelpTip(); }; class MacroSecurity : public TabDialog diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index 47926d6..c93e692 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -67,7 +67,7 @@ CertificateChooser::CertificateChooser( Window* _pParent, uno::Reference< uno::X { static long nTabs[] = { 3, 0, 30*CS_LB_WIDTH/100, 60*CS_LB_WIDTH/100 }; maCertLB.SetTabs( &nTabs[0] ); - maCertLB.InsertHeaderEntry( String( XMLSEC_RES( STR_HEADERBAR ) ) ); + maCertLB.InsertHeaderEntry( XMLSEC_RES( STR_HEADERBAR ) ); maCertLB.SetSelectHdl( LINK( this, CertificateChooser, CertificateHighlightHdl ) ); maCertLB.SetDoubleClickHdl( LINK( this, CertificateChooser, CertificateSelectHdl ) ); maViewBtn.SetClickHdl( LINK( this, CertificateChooser, ViewButtonHdl ) ); @@ -172,12 +172,12 @@ void CertificateChooser::ImplInitialize() // fill list of certificates; the first entry will be selected for ( sal_Int32 nC = 0; nC < nCertificates; ++nC ) { - String sEntry( XmlSec::GetContentPart( maCerts[ nC ]->getSubjectName() ) ); - sEntry += '\t'; - sEntry += XmlSec::GetContentPart( maCerts[ nC ]->getIssuerName() ); - sEntry += '\t'; - sEntry += XmlSec::GetDateString( maCerts[ nC ]->getNotValidAfter() ); - SvLBoxEntry* pEntry = maCertLB.InsertEntry( sEntry ); + OUStringBuffer sEntry( XmlSec::GetContentPart( maCerts[ nC ]->getSubjectName() ) ); + sEntry.append( '\t' ); + sEntry.append( XmlSec::GetContentPart( maCerts[ nC ]->getIssuerName() ) ); + sEntry.append( '\t' ); + sEntry.append( XmlSec::GetDateString( maCerts[ nC ]->getNotValidAfter() ) ); + SvLBoxEntry* pEntry = maCertLB.InsertEntry( sEntry.makeStringAndClear() ); pEntry->SetUserData( ( void* )(sal_IntPtr)nC ); // missuse user data as index } diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index b98a590..32616ae 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -69,7 +69,6 @@ using namespace ::com::sun::star::security; using namespace ::com::sun::star::uno; using namespace ::com::sun::star; namespace css = ::com::sun::star; -using ::rtl::OUString; namespace { @@ -208,9 +207,9 @@ DigitalSignaturesDialog::DigitalSignaturesDialog( const long nControlWidth = aControlSize.Width(); static long nTabs[] = { 4, 0, 6*nControlWidth/100, 36*nControlWidth/100, 74*nControlWidth/100 }; maSignaturesLB.SetTabs( &nTabs[ 0 ] ); - maSignaturesLB.InsertHeaderEntry( String( XMLSEC_RES( STR_HEADERBAR ) ) ); + maSignaturesLB.InsertHeaderEntry( XMLSEC_RES( STR_HEADERBAR ) ); - maSigsNotvalidatedFI.SetText( String( XMLSEC_RES( STR_NO_INFO_TO_VERIFY ) ) ); + maSigsNotvalidatedFI.SetText( XMLSEC_RES( STR_NO_INFO_TO_VERIFY ) ); FreeResource(); @@ -577,7 +576,6 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox() uno::Reference< ::com::sun::star::security::XCertificate > xCert; - String aNullStr; size_t nInfos = maCurrentSignatureInformations.size(); size_t nValidSigs = 0, nValidCerts = 0; bool bAllNewSignatures = true; @@ -613,9 +611,9 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox() DBG_ASSERT( xCert.is(), "Certificate not found and can't be created!" ); - String aSubject; - String aIssuer; - String aDateTimeStr; + OUString aSubject; + OUString aIssuer; + OUString aDateTimeStr; bool bSigValid = false; bool bCertValid = false; @@ -681,7 +679,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox() aImage = maSigsValidImg.GetImage(); } - SvLBoxEntry* pEntry = maSignaturesLB.InsertEntry( aNullStr, aImage, aImage ); + SvLBoxEntry* pEntry = maSignaturesLB.InsertEntry( OUString(), aImage, aImage ); maSignaturesLB.SetEntryText( aSubject, pEntry, 1 ); maSignaturesLB.SetEntryText( aIssuer, pEntry, 2 ); maSignaturesLB.SetEntryText( aDateTimeStr, pEntry, 3 ); diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx index eb4cee5..4d951ed 100644 --- a/xmlsecurity/source/dialogs/macrosecurity.cxx +++ b/xmlsecurity/source/dialogs/macrosecurity.cxx @@ -245,7 +245,7 @@ IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, AddLocPBHdl) ::rtl::OUString aSystemFileURL = ( aNewObj.GetProtocol() != INET_PROT_NOT_VALID ) ? aPathStr : aNewObj.getFSysPath( INetURLObject::FSYS_DETECT ); - String aNewPathStr(aSystemFileURL); + OUString aNewPathStr(aSystemFileURL); if ( osl::FileBase::getSystemPathFromFileURL( aSystemFileURL, aSystemFileURL ) == osl::FileBase::E_None ) aNewPathStr = aSystemFileURL; @@ -340,7 +340,7 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP( Window* _pParent, { static long nTabs[] = { 3, 0, 35*CS_LB_WIDTH/100, 70*CS_LB_WIDTH/100 }; maTrustCertLB.SetTabs( &nTabs[ 0 ] ); - maTrustCertLB.InsertHeaderEntry( String( XMLSEC_RES( STR_HEADERBAR ) ) ); + maTrustCertLB.InsertHeaderEntry( XMLSEC_RES( STR_HEADERBAR ) ); FreeResource(); @@ -425,7 +425,7 @@ void ReadOnlyImage::RequestHelp( const HelpEvent& rHEvt ) Rectangle aScreenRect( OutputToScreenPixel( aLogicPix.TopLeft() ), OutputToScreenPixel( aLogicPix.BottomRight() ) ); - String aStr(ReadOnlyImage::GetHelpTip()); + OUString aStr(ReadOnlyImage::GetHelpTip()); if ( Help::IsBalloonHelpEnabled() ) Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aScreenRect, aStr ); @@ -436,9 +436,9 @@ void ReadOnlyImage::RequestHelp( const HelpEvent& rHEvt ) Window::RequestHelp( rHEvt ); } -const String& ReadOnlyImage::GetHelpTip() +const OUString& ReadOnlyImage::GetHelpTip() { - static String aStr(XMLSEC_RES( RID_XMLSECTP_READONLY_CONFIG_TIP)); + static OUString aStr(XMLSEC_RES( RID_XMLSECTP_READONLY_CONFIG_TIP)); return aStr; } commit 003bb87fc00521ab5e5ac16623b598e53624e3bf Author: Ivan Timofeev <timofeev....@gmail.com> Date: Mon Sep 24 15:56:40 2012 +0400 String -> OUString Change-Id: I4f5b9dff78913e14414eeb8f9457c2b91836edb6 diff --git a/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx b/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx index ffc1f73..2bbbe08 100644 --- a/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx +++ b/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx @@ -113,8 +113,8 @@ private: DECL_LINK( ElementSelectHdl, void* ); void Clear( void ); - void InsertElement( const String& _rField, const String& _rValue, - const String& _rDetails, bool _bFixedWidthFont = false ); + void InsertElement( const OUString& _rField, const OUString& _rValue, + const OUString& _rDetails, bool _bFixedWidthFont = false ); public: CertificateViewerDetailsTP( Window* pParent, CertificateViewer* _pDlg ); virtual ~CertificateViewerDetailsTP(); @@ -136,13 +136,13 @@ private: bool mbFirstActivateDone; Image maCertImage; Image maCertNotValidatedImage; - String msCertOK; - String msCertNotValidated; + OUString msCertOK; + OUString msCertNotValidated; DECL_LINK( ViewCertHdl, void* ); DECL_LINK( CertSelectHdl, void* ); void Clear( void ); - SvLBoxEntry* InsertCert( SvLBoxEntry* _pParent, const String& _rName, + SvLBoxEntry* InsertCert( SvLBoxEntry* _pParent, const OUString& _rName, cssu::Reference< dcss::security::XCertificate > rxCert, bool bValid); diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 63a70ff..b75e37e 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -110,7 +110,7 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, Certif { maCertImg.SetImage( Image( XMLSEC_RES( IMG_STATE_NOT_VALIDATED ) ) ); - maHintNotTrustedFI.SetText( String( XMLSEC_RES( STR_CERTIFICATE_NOT_VALIDATED ) ) ); + maHintNotTrustedFI.SetText( XMLSEC_RES( STR_CERTIFICATE_NOT_VALIDATED ) ); } FreeResource(); @@ -170,11 +170,11 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, Certif DateTime aDateTimeEnd( DateTime::EMPTY ); utl::typeConvert( xCert->getNotValidBefore(), aDateTimeStart ); utl::typeConvert( xCert->getNotValidAfter(), aDateTimeEnd ); - String sText = maValidDateFI.GetText(); - sText.SearchAndReplace( rtl::OUString( "%SDATE%" ), - GetSettings().GetUILocaleDataWrapper().getDate( aDateTimeStart.GetDate() ) ); - sText.SearchAndReplace( rtl::OUString( "%EDATE%" ), - GetSettings().GetUILocaleDataWrapper().getDate( aDateTimeEnd.GetDate() ) ); + OUString sText = maValidDateFI.GetText(); + sText.replaceFirst( "%SDATE%", + GetSettings().GetUILocaleDataWrapper().getDate( aDateTimeStart.GetDate() ) ); + sText.replaceFirst( "%EDATE%", + GetSettings().GetUILocaleDataWrapper().getDate( aDateTimeEnd.GetDate() ) ); maValidDateFI.SetText( sText ); // adjust position of fixed text depending on image sizes @@ -206,13 +206,13 @@ void CertificateViewerGeneralTP::ActivatePage() struct Details_UserDatat { - String maTxt; + OUString maTxt; bool mbFixedWidthFont; - inline Details_UserDatat( const String& _rTxt, bool _bFixedWidthFont ); + inline Details_UserDatat( const OUString& _rTxt, bool _bFixedWidthFont ); }; -inline Details_UserDatat::Details_UserDatat( const String& _rTxt, bool _bFixedWidthFont ) +inline Details_UserDatat::Details_UserDatat( const OUString& _rTxt, bool _bFixedWidthFont ) :maTxt ( _rTxt ) ,mbFixedWidthFont ( _bFixedWidthFont ) { @@ -221,7 +221,7 @@ inline Details_UserDatat::Details_UserDatat( const String& _rTxt, bool _bFixedWi void CertificateViewerDetailsTP::Clear( void ) { - maElementML.SetText( String() ); + maElementML.SetText( OUString() ); sal_uLong i = 0; SvLBoxEntry* pEntry = maElementsLB.GetEntry( i ); while( pEntry ) @@ -234,8 +234,8 @@ void CertificateViewerDetailsTP::Clear( void ) maElementsLB.Clear(); } -void CertificateViewerDetailsTP::InsertElement( const String& _rField, const String& _rValue, - const String& _rDetails, bool _bFixedWidthFont ) +void CertificateViewerDetailsTP::InsertElement( const OUString& _rField, const OUString& _rValue, + const OUString& _rDetails, bool _bFixedWidthFont ) { SvLBoxEntry* pEntry = maElementsLB.InsertEntry( _rField ); maElementsLB.SetEntryText( _rValue, pEntry, 1 ); @@ -258,66 +258,66 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, Certif static long nTabs[] = { 2, 0, 30*CS_LB_WIDTH/100 }; maElementsLB.SetTabs( &nTabs[ 0 ] ); - maElementsLB.InsertHeaderEntry( String( XMLSEC_RES( STR_HEADERBAR ) ) ); + maElementsLB.InsertHeaderEntry( XMLSEC_RES( STR_HEADERBAR ) ); // fill list box Reference< security::XCertificate > xCert = mpDlg->mxCert; sal_uInt16 nLineBreak = 16; const char* pHexSep = " "; - String aLBEntry; - String aDetails; + OUString aLBEntry; + OUString aDetails; // Certificate Versions are reported wrong (#i35107#) - 0 == "V1", 1 == "V2", ..., n = "V(n+1)" aLBEntry = rtl::OUString( "V" ); - aLBEntry += String::CreateFromInt32( xCert->getVersion() + 1 ); - InsertElement( String( XMLSEC_RES( STR_VERSION ) ), aLBEntry, aLBEntry ); + aLBEntry += OUString::valueOf( sal_Int32( xCert->getVersion() + 1 ) ); + InsertElement( XMLSEC_RES( STR_VERSION ), aLBEntry, aLBEntry ); Sequence< sal_Int8 > aSeq = xCert->getSerialNumber(); aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); - InsertElement( String( XMLSEC_RES( STR_SERIALNUM ) ), aLBEntry, aDetails, true ); + InsertElement( XMLSEC_RES( STR_SERIALNUM ), aLBEntry, aDetails, true ); std::pair< ::rtl::OUString, ::rtl::OUString> pairIssuer = XmlSec::GetDNForCertDetailsView(xCert->getIssuerName()); aLBEntry = pairIssuer.first; aDetails = pairIssuer.second; - InsertElement( String( XMLSEC_RES( STR_ISSUER ) ), aLBEntry, aDetails ); + InsertElement( XMLSEC_RES( STR_ISSUER ), aLBEntry, aDetails ); DateTime aDateTime( DateTime::EMPTY ); utl::typeConvert( xCert->getNotValidBefore(), aDateTime ); aLBEntry = GetSettings().GetUILocaleDataWrapper().getDate( aDateTime.GetDate() ); aLBEntry += rtl::OUString( " " ); aLBEntry += GetSettings().GetUILocaleDataWrapper().getTime( aDateTime.GetTime() ); - InsertElement( String( XMLSEC_RES( STR_VALIDFROM ) ), aLBEntry, aLBEntry ); + InsertElement( XMLSEC_RES( STR_VALIDFROM ), aLBEntry, aLBEntry ); utl::typeConvert( xCert->getNotValidAfter(), aDateTime ); aLBEntry = GetSettings().GetUILocaleDataWrapper().getDate( aDateTime.GetDate() ); aLBEntry += rtl::OUString( " " ); aLBEntry += GetSettings().GetUILocaleDataWrapper().getTime( aDateTime.GetTime() ); - InsertElement( String( XMLSEC_RES( STR_VALIDTO ) ), aLBEntry, aLBEntry ); + InsertElement( XMLSEC_RES( STR_VALIDTO ), aLBEntry, aLBEntry ); std::pair< ::rtl::OUString, ::rtl::OUString > pairSubject = XmlSec::GetDNForCertDetailsView(xCert->getSubjectName()); aLBEntry = pairSubject.first; aDetails = pairSubject.second; - InsertElement( String( XMLSEC_RES( STR_SUBJECT ) ), aLBEntry, aDetails ); + InsertElement( XMLSEC_RES( STR_SUBJECT ), aLBEntry, aDetails ); aLBEntry = aDetails = xCert->getSubjectPublicKeyAlgorithm(); - InsertElement( String( XMLSEC_RES( STR_SUBJECT_PUBKEY_ALGO ) ), aLBEntry, aDetails ); + InsertElement( XMLSEC_RES( STR_SUBJECT_PUBKEY_ALGO ), aLBEntry, aDetails ); aSeq = xCert->getSubjectPublicKeyValue(); aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); - InsertElement( String( XMLSEC_RES( STR_SUBJECT_PUBKEY_VAL ) ), aLBEntry, aDetails, true ); + InsertElement( XMLSEC_RES( STR_SUBJECT_PUBKEY_VAL ), aLBEntry, aDetails, true ); aLBEntry = aDetails = xCert->getSignatureAlgorithm(); - InsertElement( String( XMLSEC_RES( STR_SIGNATURE_ALGO ) ), aLBEntry, aDetails ); + InsertElement( XMLSEC_RES( STR_SIGNATURE_ALGO ), aLBEntry, aDetails ); aSeq = xCert->getSHA1Thumbprint(); aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); - InsertElement( String( XMLSEC_RES( STR_THUMBPRINT_SHA1 ) ), aLBEntry, aDetails, true ); + InsertElement( XMLSEC_RES( STR_THUMBPRINT_SHA1 ), aLBEntry, aDetails, true ); aSeq = xCert->getMD5Thumbprint(); aLBEntry = XmlSec::GetHexString( aSeq, pHexSep ); aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak ); - InsertElement( String( XMLSEC_RES( STR_THUMBPRINT_MD5 ) ), aLBEntry, aDetails, true ); + InsertElement( XMLSEC_RES( STR_THUMBPRINT_MD5 ), aLBEntry, aDetails, true ); FreeResource(); @@ -336,7 +336,7 @@ void CertificateViewerDetailsTP::ActivatePage() IMPL_LINK_NOARG(CertificateViewerDetailsTP, ElementSelectHdl) { SvLBoxEntry* pEntry = maElementsLB.FirstSelected(); - String aElementText; + OUString aElementText; bool bFixedWidthFont; if( pEntry ) { @@ -357,7 +357,7 @@ IMPL_LINK_NOARG(CertificateViewerDetailsTP, ElementSelectHdl) struct CertPath_UserData { cssu::Reference< dcss::security::XCertificate > mxCert; - String maStatus; + OUString maStatus; bool mbValid; CertPath_UserData( cssu::Reference< dcss::security::XCertificate > xCert, bool bValid): @@ -392,9 +392,9 @@ CertificateViewerCertPathTP::CertificateViewerCertPathTP( Window* _pParent, Cert // check if buttontext is to wide const long nOffset = 10; - String sText = maViewCertPB.GetText(); + OUString sText = maViewCertPB.GetText(); long nTxtW = maViewCertPB.GetTextWidth( sText ); - if ( sText.Search( '~' ) == STRING_NOTFOUND ) + if ( sText.indexOf( '~' ) == -1 ) nTxtW += nOffset; long nBtnW = maViewCertPB.GetSizePixel().Width(); if ( nTxtW > nBtnW ) @@ -425,13 +425,12 @@ void CertificateViewerCertPathTP::ActivatePage() mpParent->mxSecurityEnvironment->buildCertificatePath( mpParent->mxCert ); const Reference< security::XCertificate >* pCertPath = aCertPath.getConstArray(); - String aState; sal_Int32 i, nCnt = aCertPath.getLength(); SvLBoxEntry* pParent = NULL; for( i = nCnt; i; ) { const Reference< security::XCertificate > rCert = pCertPath[ --i ]; - String sName = XmlSec::GetContentPart( rCert->getSubjectName() ); + OUString sName = XmlSec::GetContentPart( rCert->getSubjectName() ); //Verify the certificate sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(rCert, Sequence<Reference<css::security::XCertificate> >()); @@ -466,7 +465,7 @@ IMPL_LINK_NOARG(CertificateViewerCertPathTP, ViewCertHdl) IMPL_LINK_NOARG(CertificateViewerCertPathTP, CertSelectHdl) { - String sStatus; + OUString sStatus; SvLBoxEntry* pEntry = maCertPathLB.FirstSelected(); if( pEntry ) { @@ -482,7 +481,7 @@ IMPL_LINK_NOARG(CertificateViewerCertPathTP, CertSelectHdl) void CertificateViewerCertPathTP::Clear( void ) { - maCertStatusML.SetText( String() ); + maCertStatusML.SetText( OUString() ); sal_uLong i = 0; SvLBoxEntry* pEntry = maCertPathLB.GetEntry( i ); while( pEntry ) @@ -496,7 +495,7 @@ void CertificateViewerCertPathTP::Clear( void ) } SvLBoxEntry* CertificateViewerCertPathTP::InsertCert( - SvLBoxEntry* _pParent, const String& _rName, cssu::Reference< dcss::security::XCertificate > rxCert, + SvLBoxEntry* _pParent, const OUString& _rName, cssu::Reference< dcss::security::XCertificate > rxCert, bool bValid) { Image aImage = bValid ? maCertImage : maCertNotValidatedImage; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits