[Libreoffice-commits] .: 2 commits - comphelper/inc comphelper/source sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Aug 25 03:41:56 PDT 2012
comphelper/inc/comphelper/servicehelper.hxx | 4 ++--
comphelper/source/misc/accimplaccess.cxx | 3 ++-
comphelper/source/misc/docpasswordhelper.cxx | 11 ++++++-----
sc/source/ui/optdlg/tpdefaults.cxx | 17 ++++++++++++-----
4 files changed, 22 insertions(+), 13 deletions(-)
New commits:
commit f92fcff04a6a88fd004e721294a4817249cabf26
Author: Jean-Baptiste FAURE <jbf.faure at orange.fr>
Date: Tue Aug 21 22:15:32 2012 +0200
The label size is computed from the length of the string it contains
Change-Id: I586a31a5d563ea8a11282836ca1d54b0c8be1bf4
Signed-off-by: Arnaud Versini <arnaud.versini at gmail.com>
diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx
index b67e87b..c0db2c1 100644
--- a/sc/source/ui/optdlg/tpdefaults.cxx
+++ b/sc/source/ui/optdlg/tpdefaults.cxx
@@ -48,16 +48,23 @@ ScTpDefaultsOptions::ScTpDefaultsOptions(Window *pParent, const SfxItemSet &rCor
{
FreeResource();
- long nTxtW = aFtNSheets.GetCtrlTextWidth( aFtNSheets.GetText() );
- long nCtrlW = aFtNSheets.GetSizePixel().Width();
- if ( nTxtW >= nCtrlW )
+ // the following computation must be modified accordingly if a third line is added to this dialog
+ long nTxtW1 = aFtNSheets.GetCtrlTextWidth( aFtNSheets.GetText() );
+ long nCtrlW1 = aFtNSheets.GetSizePixel().Width();
+ long nTxtW2 = aFtSheetPrefix.GetCtrlTextWidth(aFtSheetPrefix.GetText() );
+ long nCtrlW2 = aFtSheetPrefix.GetSizePixel().Width();
+ if ( nTxtW1 >= nCtrlW1 || nTxtW2 >= nCtrlW2)
{
+ long nTxtW = std::max(nTxtW1,nTxtW2);
Size aNewSize = aFtNSheets.GetSizePixel();
- aNewSize.Width() += ( nTxtW - nCtrlW );
+ aNewSize.Width() = nTxtW;
aFtNSheets.SetSizePixel( aNewSize );
+ aFtSheetPrefix.SetSizePixel( aNewSize );
Point aNewPoint = aEdNSheets.GetPosPixel();
- aNewPoint.X() += ( nTxtW - nCtrlW );
+ aNewPoint.X() += (nTxtW - nCtrlW1);
aEdNSheets.SetPosPixel( aNewPoint );
+ aNewPoint.Y() = aEdSheetPrefix.GetPosPixel().Y();
+ aEdSheetPrefix.SetPosPixel( aNewPoint );
}
aEdNSheets.SetModifyHdl( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) );
aEdSheetPrefix.SetModifyHdl( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) );
commit 1cd0f1bdb5b2ed998b35dc5120559284a2beb80e
Author: Arnaud Versini <arnaud.versini at gmail.com>
Date: Sat Aug 25 10:59:00 2012 +0200
Replace usage of rtl/memory.h in comphelper with equivalent from string.h
Change-Id: I41d452aa4892606d127e9565cf83c21f78a67392
diff --git a/comphelper/inc/comphelper/servicehelper.hxx b/comphelper/inc/comphelper/servicehelper.hxx
index 3cdffa9..a861e88 100644
--- a/comphelper/inc/comphelper/servicehelper.hxx
+++ b/comphelper/inc/comphelper/servicehelper.hxx
@@ -78,7 +78,7 @@ classname* classname::getImplementation( const uno::Reference< uno::XInterface >
UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
sal_Int64 SAL_CALL classname::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
{ \
- if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), \
+ if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), \
rId.getConstArray(), 16 ) ) \
{ \
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \
@@ -90,7 +90,7 @@ sal_Int64 SAL_CALL classname::getSomething( const ::com::sun::star::uno::Sequenc
UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
sal_Int64 SAL_CALL classname::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
{ \
- if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), \
+ if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), \
rId.getConstArray(), 16 ) ) \
{ \
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \
diff --git a/comphelper/source/misc/accimplaccess.cxx b/comphelper/source/misc/accimplaccess.cxx
index dab11af..f70fa54 100644
--- a/comphelper/source/misc/accimplaccess.cxx
+++ b/comphelper/source/misc/accimplaccess.cxx
@@ -23,6 +23,7 @@
#include <cppuhelper/typeprovider.hxx>
#include <set>
+#include <string.h>
//.........................................................................
namespace comphelper
@@ -113,7 +114,7 @@ namespace comphelper
sal_Int64 nReturn( 0 );
if ( ( _rIdentifier.getLength() == 16 )
- && ( 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 ) )
+ && ( 0 == memcmp( getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 ) )
)
nReturn = reinterpret_cast< sal_Int64 >( this );
diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx
index 0c65d72..3e349a7 100644
--- a/comphelper/source/misc/docpasswordhelper.cxx
+++ b/comphelper/source/misc/docpasswordhelper.cxx
@@ -25,6 +25,7 @@
#include <osl/time.h>
#include <rtl/digest.h>
#include <rtl/random.h>
+#include <string.h>
using ::rtl::OUString;
using ::com::sun::star::uno::Sequence;
@@ -269,10 +270,10 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
if ( !aPassword.isEmpty() && aDocId.getLength() == 16 )
{
sal_uInt16 pPassData[16];
- rtl_zeroMemory( pPassData, sizeof(pPassData) );
+ memset( pPassData, 0, sizeof(pPassData) );
sal_Int32 nPassLen = ::std::min< sal_Int32 >( aPassword.getLength(), 15 );
- rtl_copyMemory( pPassData, aPassword.getStr(), nPassLen * sizeof(pPassData[0]) );
+ memcpy( pPassData, aPassword.getStr(), nPassLen * sizeof(pPassData[0]) );
aResultKey = GenerateStd97Key( pPassData, aDocId );
}
@@ -287,7 +288,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
if ( pPassData[0] && aDocId.getLength() == 16 )
{
sal_uInt8 pKeyData[64];
- rtl_zeroMemory( pKeyData, sizeof(pKeyData) );
+ memset( pKeyData, 0, sizeof(pKeyData) );
sal_Int32 nInd = 0;
@@ -317,7 +318,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
// Update digest with padding.
pKeyData[16] = 0x80;
- rtl_zeroMemory( pKeyData + 17, sizeof(pKeyData) - 17 );
+ memset( pKeyData + 17, 0, sizeof(pKeyData) - 17 );
pKeyData[56] = 0x80;
pKeyData[57] = 0x0a;
@@ -328,7 +329,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
rtl_digest_rawMD5 ( hDigest, (sal_uInt8*)aResultKey.getArray(), aResultKey.getLength() );
// Erase KeyData array and leave.
- rtl_zeroMemory( pKeyData, sizeof(pKeyData) );
+ memset( pKeyData, 0, sizeof(pKeyData) );
}
return aResultKey;
More information about the Libreoffice-commits
mailing list