coverity#1426163 Improper use of negative value
started life as sal_uIntPtr and the various checks are typically
nPos < thing.size() just checking one bound, so sal_uInt32 looks safer
after all
Change-Id: Ibac839fc45b10d96ce4d4c8002fd26b20f70ae1c
Reviewed-on: https://gerrit.libreoffice.org/46697
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/svx/galctrl.hxx b/include/svx/galctrl.hxx
index 6c1091c..1ca3399 100644
--- a/include/svx/galctrl.hxx
+++ b/include/svx/galctrl.hxx
@@ -118,7 +118,7 @@ private:
Link<GalleryListView*,void> maSelectHdl;
GalleryTheme* mpTheme;
long mnCurRow;
sal_uInt32 mnCurRow;
void InitSettings();
diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
index 903ed7e..f720ce1 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -85,29 +85,29 @@ private:
GalleryThemeEntry* pThm;
sal_uInt32 mnThemeLockCount;
sal_uInt32 mnBroadcasterLockCount;
sal_Int32 nDragPos;
sal_uInt32 nDragPos;
bool bDragging;
bool bAbortActualize;
SAL_DLLPRIVATE void ImplCreateSvDrawStorage();
SgaObject* ImplReadSgaObject( GalleryObject const * pEntry );
SAL_DLLPRIVATE bool ImplWriteSgaObject( const SgaObject& rObj, sal_Int32 nPos, GalleryObject* pExistentEntry );
SAL_DLLPRIVATE bool ImplWriteSgaObject(const SgaObject& rObj, sal_uInt32 nPos, GalleryObject* pExistentEntry);
SAL_DLLPRIVATE void ImplWrite();
SAL_DLLPRIVATE const GalleryObject* ImplGetGalleryObject( sal_Int32 nPos ) const
{ return ( nPos >= 0 && nPos < sal_Int32(aObjectList.size()) ) ? aObjectList[nPos] : nullptr; }
SAL_DLLPRIVATE const GalleryObject* ImplGetGalleryObject(sal_uInt32 nPos) const
{ return ( nPos < aObjectList.size() ) ? aObjectList[ nPos ] : nullptr; }
const GalleryObject* ImplGetGalleryObject( const INetURLObject& rURL );
SAL_DLLPRIVATE sal_Int32 ImplGetGalleryObjectPos( const GalleryObject* pObj ) const
SAL_DLLPRIVATE sal_uInt32 ImplGetGalleryObjectPos( const GalleryObject* pObj ) const
{
for ( size_t i = 0, n = aObjectList.size(); i < n; ++i )
for (sal_uInt32 i = 0, n = aObjectList.size(); i < n; ++i)
if ( pObj == aObjectList[ i ] )
return i;
return -1;
return SAL_MAX_UINT32;
}
SAL_DLLPRIVATE static INetURLObject ImplGetURL( const GalleryObject* pObject );
SAL_DLLPRIVATE INetURLObject ImplCreateUniqueURL( SgaObjKind eObjKind, ConvertDataFormat nFormat = ConvertDataFormat::Unknown );
SAL_DLLPRIVATE void ImplSetModified( bool bModified );
SAL_DLLPRIVATE void ImplBroadcast( sal_Int32 nUpdatePos );
SAL_DLLPRIVATE void ImplBroadcast(sal_uInt32 nUpdatePos);
SAL_DLLPRIVATE GalleryTheme( Gallery* pGallery, GalleryThemeEntry* pThemeEntry );
@@ -120,14 +120,14 @@ public:
SAL_DLLPRIVATE static GalleryThemeEntry* CreateThemeEntry( const INetURLObject& rURL, bool bReadOnly );
SAL_DLLPRIVATE sal_Int32 GetObjectCount() const { return aObjectList.size(); }
SAL_DLLPRIVATE sal_uInt32 GetObjectCount() const { return aObjectList.size(); }
SgaObject* AcquireObject( sal_Int32 nPos );
static void ReleaseObject( SgaObject* pObj );
SgaObject* AcquireObject(sal_uInt32 nPos);
static void ReleaseObject(SgaObject* pObj);
bool InsertObject( const SgaObject& rObj, sal_Int32 nPos = SAL_MAX_INT32 );
bool RemoveObject( sal_Int32 nPos );
SAL_DLLPRIVATE bool ChangeObjectPos( sal_Int32 nOldPos, sal_Int32 nNewPos );
bool InsertObject(const SgaObject& rObj, sal_uInt32 nPos = SAL_MAX_UINT32);
bool RemoveObject(sal_uInt32 nPos);
SAL_DLLPRIVATE bool ChangeObjectPos(sal_uInt32 nOldPos, sal_uInt32 nNewPos);
const OUString& GetName() const;
@@ -152,8 +152,8 @@ public:
void UnlockBroadcaster();
SAL_DLLPRIVATE bool IsBroadcasterLocked() const { return mnBroadcasterLockCount > 0; }
SAL_DLLPRIVATE void SetDragPos( sal_Int32 nPos ) { nDragPos = nPos; }
SAL_DLLPRIVATE sal_Int32 GetDragPos() const { return nDragPos; }
SAL_DLLPRIVATE void SetDragPos(sal_uInt32 nPos) { nDragPos = nPos; }
SAL_DLLPRIVATE sal_uInt32 GetDragPos() const { return nDragPos; }
SAL_DLLPRIVATE bool IsThemeNameFromResource() const;
@@ -168,38 +168,38 @@ public:
public:
SAL_DLLPRIVATE SgaObjKind GetObjectKind( sal_Int32 nPos ) const
SAL_DLLPRIVATE SgaObjKind GetObjectKind(sal_uInt32 nPos) const
{
DBG_ASSERT( nPos < GetObjectCount(), "Position out of range" );
return ImplGetGalleryObject( nPos )->eObjKind;
}
SAL_DLLPRIVATE const INetURLObject& GetObjectURL( sal_Int32 nPos ) const
SAL_DLLPRIVATE const INetURLObject& GetObjectURL(sal_uInt32 nPos) const
{
DBG_ASSERT( nPos < GetObjectCount(), "Position out of range" );
return ImplGetGalleryObject( nPos )->aURL;
}
SAL_DLLPRIVATE bool GetThumb( sal_Int32 nPos, BitmapEx& rBmp );
SAL_DLLPRIVATE bool GetThumb(sal_uInt32 nPos, BitmapEx& rBmp);
bool GetGraphic( sal_Int32 nPos, Graphic& rGraphic, bool bProgress = false );
bool InsertGraphic( const Graphic& rGraphic, sal_Int32 nInsertPos );
bool GetGraphic(sal_uInt32 nPos, Graphic& rGraphic, bool bProgress = false);
bool InsertGraphic(const Graphic& rGraphic, sal_uInt32 nInsertPos);
bool GetModel( sal_Int32 nPos, SdrModel& rModel );
bool InsertModel( const FmFormModel& rModel, sal_Int32 nInsertPos );
bool GetModel(sal_uInt32 nPos, SdrModel& rModel);
bool InsertModel(const FmFormModel& rModel, sal_uInt32 nInsertPos);
SAL_DLLPRIVATE bool GetModelStream( sal_Int32 nPos, tools::SvRef<SotStorageStream> const & rModelStreamRef );
SAL_DLLPRIVATE bool InsertModelStream( const tools::SvRef<SotStorageStream>& rModelStream, sal_Int32 nInsertPos );
SAL_DLLPRIVATE bool GetModelStream(sal_uInt32 nPos, tools::SvRef<SotStorageStream> const & rModelStreamRef);
SAL_DLLPRIVATE bool InsertModelStream(const tools::SvRef<SotStorageStream>& rModelStream, sal_uInt32 nInsertPos);
SAL_DLLPRIVATE bool GetURL( sal_Int32 nPos, INetURLObject& rURL );
bool InsertURL( const INetURLObject& rURL, sal_Int32 nInsertPos = SAL_MAX_INT32 );
SAL_DLLPRIVATE bool InsertFileOrDirURL( const INetURLObject& rFileOrDirURL, sal_Int32 nInsertPos );
SAL_DLLPRIVATE bool GetURL(sal_uInt32 nPos, INetURLObject& rURL);
bool InsertURL(const INetURLObject& rURL, sal_uInt32 nInsertPos = SAL_MAX_UINT32);
SAL_DLLPRIVATE bool InsertFileOrDirURL(const INetURLObject& rFileOrDirURL, sal_uInt32 nInsertPos);
SAL_DLLPRIVATE bool InsertTransferable( const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable, sal_Int32 nInsertPos );
SAL_DLLPRIVATE bool InsertTransferable(const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable, sal_uInt32 nInsertPos);
SAL_DLLPRIVATE void CopyToClipboard( vcl::Window* pWindow, sal_Int32 nPos );
SAL_DLLPRIVATE void StartDrag( vcl::Window* pWindow, sal_Int32 nPos );
SAL_DLLPRIVATE void CopyToClipboard(vcl::Window* pWindow, sal_uInt32 nPos);
SAL_DLLPRIVATE void StartDrag(vcl::Window* pWindow, sal_uInt32 nPos);
public:
@@ -208,8 +208,8 @@ public:
static void InsertAllThemes( ListBox& rListBox );
// for buffering PreviewBitmaps and strings for object and path
SAL_DLLPRIVATE void GetPreviewBitmapExAndStrings(sal_Int32 nPos, BitmapEx& rBitmapEx, Size& rSize, OUString& rTitle, OUString& rPath) const;
SAL_DLLPRIVATE void SetPreviewBitmapExAndStrings(sal_Int32 nPos, const BitmapEx& rBitmapEx, const Size& rSize, const OUString& rTitle, const OUString& rPath);
SAL_DLLPRIVATE void GetPreviewBitmapExAndStrings(sal_uInt32 nPos, BitmapEx& rBitmapEx, Size& rSize, OUString& rTitle, OUString& rPath) const;
SAL_DLLPRIVATE void SetPreviewBitmapExAndStrings(sal_uInt32 nPos, const BitmapEx& rBitmapEx, const Size& rSize, const OUString& rTitle, const OUString& rPath);
};
SvStream& WriteGalleryTheme( SvStream& rOut, const GalleryTheme& rTheme );
diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx
index 01c7f1e..cbfef10 100644
--- a/svx/inc/galbrws2.hxx
+++ b/svx/inc/galbrws2.hxx
@@ -100,7 +100,7 @@ private:
VclPtr<GalleryToolBox> maViewBox;
VclPtr<FixedLine> maSeparator;
VclPtr<FixedText> maInfoBar;
sal_uIntPtr mnCurActionPos;
sal_uInt32 mnCurActionPos;
GalleryBrowserMode meMode;
GalleryBrowserMode meLastMode;
@@ -111,8 +111,8 @@ private:
void ImplUpdateViews( sal_uInt16 nSelectionId );
void ImplUpdateInfoBar();
sal_Int32 ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos );
void ImplSelectItemId( sal_uIntPtr nItemId );
sal_uInt32 ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos );
void ImplSelectItemId(sal_uInt32 nItemId);
// Control
virtual void Resize() override;
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index a3c96fb..ed02777 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -111,7 +111,7 @@ class GalleryThemePopup : public ::cppu::WeakImplHelper< css::frame::XStatusList
{
private:
const GalleryTheme* mpTheme;
sal_uIntPtr mnObjectPos;
sal_uInt32 mnObjectPos;
bool mbPreview;
VclBuilder maBuilder;
VclPtr<PopupMenu> mpPopupMenu;
@@ -128,7 +128,7 @@ private:
DECL_LINK( BackgroundMenuSelectHdl, Menu*, bool );
public:
GalleryThemePopup( const GalleryTheme* pTheme,
sal_uIntPtr nObjectPos,
sal_uInt32 nObjectPos,
bool bPreview,
GalleryBrowser2* pBrowser );
@@ -141,7 +141,7 @@ public:
GalleryThemePopup::GalleryThemePopup(
const GalleryTheme* pTheme,
sal_uIntPtr nObjectPos,
sal_uInt32 nObjectPos,
bool bPreview,
GalleryBrowser2* pBrowser )
: mpTheme( pTheme )
@@ -559,8 +559,8 @@ sal_Int8 GalleryBrowser2::ExecuteDrop( const ExecuteDropEvent& rEvt )
if( mpCurTheme )
{
Point aSelPos;
const sal_Int32 nItemId = ImplGetSelectedItemId( &rEvt.maPosPixel, aSelPos );
const sal_uIntPtr nInsertPos = (nItemId ? (nItemId - 1) : mpCurTheme->GetObjectCount());
const sal_uInt32 nItemId = ImplGetSelectedItemId( &rEvt.maPosPixel, aSelPos );
const sal_uInt32 nInsertPos = (nItemId ? (nItemId - 1) : mpCurTheme->GetObjectCount());
if( mpCurTheme->IsDragging() )
mpCurTheme->ChangeObjectPos( mpCurTheme->GetDragPos(), nInsertPos );
@@ -576,7 +576,7 @@ void GalleryBrowser2::StartDrag( const Point* pDragPoint )
if( mpCurTheme )
{
Point aSelPos;
const sal_Int32 nItemId = ImplGetSelectedItemId( pDragPoint, aSelPos );
const sal_uInt32 nItemId = ImplGetSelectedItemId( pDragPoint, aSelPos );
if( nItemId )
mpCurTheme->StartDrag( this, nItemId - 1 );
@@ -592,7 +592,7 @@ void GalleryBrowser2::TogglePreview()
void GalleryBrowser2::ShowContextMenu( const Point* pContextPoint )
{
Point aSelPos;
const sal_Int32 nItemId = ImplGetSelectedItemId( pContextPoint, aSelPos );
const sal_uInt32 nItemId = ImplGetSelectedItemId( pContextPoint, aSelPos );
if( mpCurTheme && nItemId && ( nItemId <= mpCurTheme->GetObjectCount() ) )
{
@@ -616,7 +616,7 @@ void GalleryBrowser2::ShowContextMenu( const Point* pContextPoint )
bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, vcl::Window* /*pWindow*/ )
{
Point aSelPos;
const sal_Int32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
bool bRet = false;
svx::sidebar::GalleryControl* pParentControl = dynamic_cast<svx::sidebar::GalleryControl*>(GetParent());
if (pParentControl != nullptr)
@@ -781,13 +781,13 @@ void GalleryBrowser2::SetMode( GalleryBrowserMode eMode )
{
Graphic aGraphic;
Point aSelPos;
const sal_Int32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
if( nItemId )
{
const sal_uIntPtr nPos = nItemId - 1;
const sal_uInt32 nPos = nItemId - 1;
mpIconView->Hide();
mpIconView->Hide();
mpListView->Hide();
if( mpCurTheme )
@@ -835,11 +835,11 @@ void GalleryBrowser2::Travel( GalleryBrowserTravel eTravel )
if( mpCurTheme )
{
Point aSelPos;
const sal_Int32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
if( nItemId )
{
sal_Int32 nNewItemId = nItemId;
sal_uInt32 nNewItemId = nItemId;
switch( eTravel )
{
@@ -864,7 +864,7 @@ void GalleryBrowser2::Travel( GalleryBrowserTravel eTravel )
if( GALLERYBROWSERMODE_PREVIEW == GetMode() )
{
Graphic aGraphic;
const sal_uIntPtr nPos = nNewItemId - 1;
const sal_uInt32 nPos = nNewItemId - 1;
mpCurTheme->GetGraphic( nPos, aGraphic );
mpPreview->SetGraphic( aGraphic );
@@ -890,7 +890,7 @@ void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId )
if( mpCurTheme )
{
for( sal_uIntPtr i = 0, nCount = mpCurTheme->GetObjectCount(); i < nCount; )
for (sal_uInt32 i = 0, nCount = mpCurTheme->GetObjectCount(); i < nCount;)
{
mpListView->RowInserted( i++ );
mpIconView->InsertItem( (sal_uInt16) i );
@@ -918,10 +918,10 @@ void GalleryBrowser2::ImplUpdateInfoBar()
maInfoBar->SetText( mpCurTheme->GetName() );
}
sal_Int32 GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& rSelPos )
sal_uInt32 GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& rSelPos )
{
const Size aOutputSizePixel( GetOutputSizePixel() );
sal_Int32 nRet = 0;
sal_uInt32 nRet = 0;
if( GALLERYBROWSERMODE_PREVIEW == GetMode() )
{
@@ -942,7 +942,7 @@ sal_Int32 GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& r
else
{
nRet = mpIconView->GetSelectItemId();
rSelPos = mpIconView->GetItemRect( (sal_uInt16) nRet ).Center();
rSelPos = mpIconView->GetItemRect(nRet).Center();
}
}
else
@@ -970,12 +970,12 @@ sal_Int32 GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& r
return nRet;
}
void GalleryBrowser2::ImplSelectItemId( sal_uIntPtr nItemId )
void GalleryBrowser2::ImplSelectItemId(sal_uInt32 nItemId)
{
if( nItemId )
{
mpIconView->SelectItem( (sal_uInt16) nItemId );
mpIconView->SelectItem(nItemId);
mpListView->SelectRow( nItemId - 1 );
}
}
@@ -999,7 +999,7 @@ void GalleryBrowser2::DispatchAdd(
const css::util::URL &rURL)
{
Point aSelPos;
const sal_Int32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
if( !mpCurTheme || !nItemId )
return;
@@ -1089,7 +1089,7 @@ void GalleryBrowser2::DispatchAdd(
void GalleryBrowser2::Execute(const OString &rIdent)
{
Point aSelPos;
const sal_Int32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
const sal_uInt32 nItemId = ImplGetSelectedItemId( nullptr, aSelPos );
if( mpCurTheme && nItemId )
{
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 5e060ad..6e8b16c 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -106,7 +106,7 @@ void GalleryTheme::ImplCreateSvDrawStorage()
}
}
bool GalleryTheme::ImplWriteSgaObject( const SgaObject& rObj, sal_Int32 nPos, GalleryObject* pExistentEntry )
bool GalleryTheme::ImplWriteSgaObject(const SgaObject& rObj, sal_uInt32 nPos, GalleryObject* pExistentEntry)
{
std::unique_ptr<SvStream> pOStm(::utl::UcbStreamHelper::CreateStream( GetSdgURL().GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::WRITE ));
bool bRet = false;
@@ -124,7 +124,7 @@ bool GalleryTheme::ImplWriteSgaObject( const SgaObject& rObj, sal_Int32 nPos, Ga
if( !pExistentEntry )
{
pEntry = new GalleryObject;
if ( nPos < sal_Int32(aObjectList.size()) )
if ( nPos < aObjectList.size() )
{
GalleryObjectList::iterator it = aObjectList.begin();
::std::advance( it, nPos );
@@ -330,7 +330,7 @@ INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, ConvertDat
return aNewURL;
}
void GalleryTheme::ImplBroadcast( sal_Int32 nUpdatePos )
void GalleryTheme::ImplBroadcast(sal_uInt32 nUpdatePos)
{
if( !IsBroadcasterLocked() )
{
@@ -364,14 +364,14 @@ void GalleryTheme::UnlockBroadcaster()
ImplBroadcast( 0 );
}
bool GalleryTheme::InsertObject( const SgaObject& rObj, sal_Int32 nInsertPos )
bool GalleryTheme::InsertObject(const SgaObject& rObj, sal_uInt32 nInsertPos)
{
if (!rObj.IsValid())
return false;
GalleryObject* pFoundEntry = nullptr;
size_t iFoundPos = 0;
for (size_t n = aObjectList.size(); iFoundPos < n; ++iFoundPos)
sal_uInt32 iFoundPos = 0;
for (sal_uInt32 n = aObjectList.size(); iFoundPos < n; ++iFoundPos)
{
if (aObjectList[ iFoundPos ]->aURL == rObj.GetURL())
{
@@ -409,14 +409,14 @@ bool GalleryTheme::InsertObject( const SgaObject& rObj, sal_Int32 nInsertPos )
return true;
}
SgaObject* GalleryTheme::AcquireObject( sal_Int32 nPos )
SgaObject* GalleryTheme::AcquireObject(sal_uInt32 nPos)
{
return ImplReadSgaObject( aObjectList[ nPos ] );
return ImplReadSgaObject(ImplGetGalleryObject(nPos));
}
void GalleryTheme::GetPreviewBitmapExAndStrings(sal_Int32 nPos, BitmapEx& rBitmapEx, Size& rSize, OUString& rTitle, OUString& rPath) const
void GalleryTheme::GetPreviewBitmapExAndStrings(sal_uInt32 nPos, BitmapEx& rBitmapEx, Size& rSize, OUString& rTitle, OUString& rPath) const
{
const GalleryObject* pGalleryObject = nPos < sal_Int32(aObjectList.size()) ? aObjectList[ nPos ] : nullptr;
const GalleryObject* pGalleryObject = nPos < aObjectList.size() ? aObjectList[ nPos ] : nullptr;
if(pGalleryObject)
{
@@ -431,9 +431,9 @@ void GalleryTheme::GetPreviewBitmapExAndStrings(sal_Int32 nPos, BitmapEx& rBitma
}
}
void GalleryTheme::SetPreviewBitmapExAndStrings(sal_Int32 nPos, const BitmapEx& rBitmapEx, const Size& rSize, const OUString& rTitle, const OUString& rPath)
void GalleryTheme::SetPreviewBitmapExAndStrings(sal_uInt32 nPos, const BitmapEx& rBitmapEx, const Size& rSize, const OUString& rTitle, const OUString& rPath)
{
GalleryObject* pGalleryObject = nPos < sal_Int32(aObjectList.size()) ? aObjectList[ nPos ] : nullptr;
GalleryObject* pGalleryObject = nPos < aObjectList.size() ? aObjectList[ nPos ] : nullptr;
if(pGalleryObject)
{
@@ -453,10 +453,10 @@ void GalleryTheme::ReleaseObject( SgaObject* pObject )
delete pObject;
}
bool GalleryTheme::RemoveObject( sal_Int32 nPos )
bool GalleryTheme::RemoveObject(sal_uInt32 nPos)
{
GalleryObject* pEntry = nullptr;
if ( nPos < sal_Int32(aObjectList.size()) )
if ( nPos < aObjectList.size() )
{
GalleryObjectList::iterator it = aObjectList.begin();
::std::advance( it, nPos );
@@ -484,9 +484,9 @@ bool GalleryTheme::RemoveObject( sal_Int32 nPos )
return( pEntry != nullptr );
}
bool GalleryTheme::ChangeObjectPos( sal_Int32 nOldPos, sal_Int32 nNewPos )
bool GalleryTheme::ChangeObjectPos(sal_uInt32 nOldPos, sal_uInt32 nNewPos)
{
if (nOldPos == nNewPos || nOldPos >= sal_Int32(aObjectList.size()))
if (nOldPos == nNewPos || nOldPos >= aObjectList.size())
return false;
GalleryObject* pEntry = aObjectList[nOldPos];
@@ -516,16 +516,16 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize
Graphic aGraphic;
OUString aFormat;
GalleryObject* pEntry;
const size_t nCount = aObjectList.size();
const sal_uInt32 nCount = aObjectList.size();
LockBroadcaster();
bAbortActualize = false;
// reset delete flag
for (size_t i = 0; i < nCount; i++)
for (sal_uInt32 i = 0; i < nCount; i++)
aObjectList[ i ]->mbDelete = false;
for(size_t i = 0; ( i < nCount ) && !bAbortActualize; i++)
for (sal_uInt32 i = 0; ( i < nCount ) && !bAbortActualize; i++)
{
if( pProgress )
pProgress->Update( i, nCount - 1 );
@@ -753,7 +753,7 @@ GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, bo
return pRet;
}
bool GalleryTheme::GetThumb( sal_Int32 nPos, BitmapEx& rBmp )
bool GalleryTheme::GetThumb(sal_uInt32 nPos, BitmapEx& rBmp)
{
SgaObject* pObj = AcquireObject( nPos );
bool bRet = false;
@@ -768,7 +768,7 @@ bool GalleryTheme::GetThumb( sal_Int32 nPos, BitmapEx& rBmp )
return bRet;
}
bool GalleryTheme::GetGraphic( sal_Int32 nPos, Graphic& rGraphic, bool bProgress )
bool GalleryTheme::GetGraphic(sal_uInt32 nPos, Graphic& rGraphic, bool bProgress)
{
const GalleryObject* pObject = ImplGetGalleryObject( nPos );
bool bRet = false;
@@ -841,7 +841,7 @@ bool GalleryTheme::GetGraphic( sal_Int32 nPos, Graphic& rGraphic, bool bProgress
return bRet;
}
bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_Int32 nInsertPos )
bool GalleryTheme::InsertGraphic(const Graphic& rGraphic, sal_uInt32 nInsertPos)
{
bool bRet = false;
@@ -923,7 +923,7 @@ bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_Int32 nInsertPos
return bRet;
}
bool GalleryTheme::GetModel( sal_Int32 nPos, SdrModel& rModel )
bool GalleryTheme::GetModel(sal_uInt32 nPos, SdrModel& rModel)
{
const GalleryObject* pObject = ImplGetGalleryObject( nPos );
bool bRet = false;
@@ -950,7 +950,7 @@ bool GalleryTheme::GetModel( sal_Int32 nPos, SdrModel& rModel )
return bRet;
}
bool GalleryTheme::InsertModel( const FmFormModel& rModel, sal_Int32 nInsertPos )
bool GalleryTheme::InsertModel(const FmFormModel& rModel, sal_uInt32 nInsertPos)
{
INetURLObject aURL( ImplCreateUniqueURL( SgaObjKind::SvDraw ) );
tools::SvRef<SotStorage> xStor( GetSvDrawStorage() );
@@ -995,7 +995,7 @@ bool GalleryTheme::InsertModel( const FmFormModel& rModel, sal_Int32 nInsertPos
return bRet;
}
bool GalleryTheme::GetModelStream( sal_Int32 nPos, tools::SvRef<SotStorageStream> const & rxModelStream )
bool GalleryTheme::GetModelStream(sal_uInt32 nPos, tools::SvRef<SotStorageStream> const & rxModelStream)
{
const GalleryObject* pObject = ImplGetGalleryObject( nPos );
bool bRet = false;
@@ -1046,7 +1046,7 @@ bool GalleryTheme::GetModelStream( sal_Int32 nPos, tools::SvRef<SotStorageStream
return bRet;
}
bool GalleryTheme::InsertModelStream( const tools::SvRef<SotStorageStream>& rxModelStream, sal_Int32 nInsertPos )
bool GalleryTheme::InsertModelStream(const tools::SvRef<SotStorageStream>& rxModelStream, sal_uInt32 nInsertPos)
{
INetURLObject aURL( ImplCreateUniqueURL( SgaObjKind::SvDraw ) );
tools::SvRef<SotStorage> xStor( GetSvDrawStorage() );
@@ -1080,7 +1080,7 @@ bool GalleryTheme::InsertModelStream( const tools::SvRef<SotStorageStream>& rxMo
return bRet;
}
bool GalleryTheme::GetURL( sal_Int32 nPos, INetURLObject& rURL )
bool GalleryTheme::GetURL(sal_uInt32 nPos, INetURLObject& rURL)
{
const GalleryObject* pObject = ImplGetGalleryObject( nPos );
bool bRet = false;
@@ -1094,7 +1094,7 @@ bool GalleryTheme::GetURL( sal_Int32 nPos, INetURLObject& rURL )
return bRet;
}
bool GalleryTheme::InsertURL( const INetURLObject& rURL, sal_Int32 nInsertPos )
bool GalleryTheme::InsertURL(const INetURLObject& rURL, sal_uInt32 nInsertPos)
{
Graphic aGraphic;
OUString aFormat;
@@ -1119,7 +1119,7 @@ bool GalleryTheme::InsertURL( const INetURLObject& rURL, sal_Int32 nInsertPos )
return bRet;
}
bool GalleryTheme::InsertFileOrDirURL( const INetURLObject& rFileOrDirURL, sal_Int32 nInsertPos )
bool GalleryTheme::InsertFileOrDirURL(const INetURLObject& rFileOrDirURL, sal_uInt32 nInsertPos)
{
INetURLObject aURL;
::std::vector< INetURLObject > aURLVector;
@@ -1167,7 +1167,7 @@ bool GalleryTheme::InsertFileOrDirURL( const INetURLObject& rFileOrDirURL, sal_I
return bRet;
}
bool GalleryTheme::InsertTransferable( const uno::Reference< datatransfer::XTransferable >& rxTransferable, sal_Int32 nInsertPos )
bool GalleryTheme::InsertTransferable(const uno::Reference< datatransfer::XTransferable >& rxTransferable, sal_uInt32 nInsertPos)
{
bool bRet = false;
@@ -1264,13 +1264,13 @@ bool GalleryTheme::InsertTransferable( const uno::Reference< datatransfer::XTran
return bRet;
}
void GalleryTheme::CopyToClipboard( vcl::Window* pWindow, sal_Int32 nPos )
void GalleryTheme::CopyToClipboard(vcl::Window* pWindow, sal_uInt32 nPos)
{
GalleryTransferable* pTransferable = new GalleryTransferable( this, nPos, false );
pTransferable->CopyToClipboard( pWindow );
}
void GalleryTheme::StartDrag( vcl::Window* pWindow, sal_Int32 nPos )
void GalleryTheme::StartDrag(vcl::Window* pWindow, sal_uInt32 nPos)
{
GalleryTransferable* pTransferable = new GalleryTransferable( this, nPos, true );
pTransferable->StartDrag( pWindow, DND_ACTION_COPY | DND_ACTION_LINK );
@@ -1341,7 +1341,7 @@ SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const
}
// more recently, a 512-byte reserve buffer is written,
// to recognize them two sal_uIntPtr-Ids will be written.
// to recognize them two sal_uInt32-Ids will be written.
rOStm.WriteUInt32( COMPAT_FORMAT( 'G', 'A', 'L', 'R' ) ).WriteUInt32( COMPAT_FORMAT( 'E', 'S', 'R', 'V' ) );
const long nReservePos = rOStm.Tell();
diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx
index 430899e..fc8568b 100644
--- a/svx/source/gengal/gengal.cxx
+++ b/svx/source/gengal/gengal.cxx
@@ -122,7 +122,7 @@ static void createTheme( const OUString& aThemeName, const OUString& aGalleryURL
fprintf( stderr, "Failed to import '%s'\n",
OUStringToOString( aIter->GetMainURL(INetURLObject::DecodeMechanism::NONE), RTL_TEXTENCODING_UTF8 ).getStr() );
else
fprintf( stderr, "Imported file '%s' (%" SAL_PRIdINT32 "u)\n",
fprintf( stderr, "Imported file '%s' (%u)\n",
OUStringToOString( aIter->GetMainURL(INetURLObject::DecodeMechanism::NONE), RTL_TEXTENCODING_UTF8 ).getStr(),
pGalTheme->GetObjectCount() );
}