[Libreoffice-commits] core.git: 2 commits - include/vcl sfx2/source vcl/source
Herbert Dürr
hdu at apache.org
Wed Jul 24 00:55:51 PDT 2013
include/vcl/menu.hxx | 4 ++--
include/vcl/status.hxx | 4 ++--
include/vcl/toolbox.hxx | 4 ++--
sfx2/source/menu/virtmenu.cxx | 9 +++++----
vcl/source/gdi/salmisc.cxx | 12 ++++++------
vcl/source/window/menu.cxx | 10 +++++-----
vcl/source/window/status.cxx | 6 +++---
vcl/source/window/toolbox2.cxx | 12 ++++++------
8 files changed, 31 insertions(+), 30 deletions(-)
New commits:
commit 794a1f8e685216d6bbf5f753b04138a2711ce62d
Author: Herbert Dürr <hdu at apache.org>
Date: Mon Jul 22 09:50:08 2013 +0000
Resolves: #i122796# fix half-pixel offset in StretchAndConvert...
image scaling
(cherry picked from commit ec3d48418f1cbad40153b3e4fdc2497ebf0e7d59)
Change-Id: Idc4bf7acc30c24a788be79c3686155e924afb28c
diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx
index 9720c64..3cbb4f4 100644
--- a/vcl/source/gdi/salmisc.cxx
+++ b/vcl/source/gdi/salmisc.cxx
@@ -391,12 +391,12 @@ BitmapBuffer* StretchAndConvert(
}
// horizontal mapping table
- if( nDstDX != nSrcDX )
+ if( (nDstDX != nSrcDX) && (nDstDX != 0) )
{
- const double fFactorX = ( nDstDX > 1 ) ? (double) ( nSrcDX - 1 ) / ( nDstDX - 1 ) : 0.0;
+ const double fFactorX = (double)nSrcDX / nDstDX;
for( i = 0L; i < nDstDX; i++ )
- pMapX[ i ] = nSrcX + FRound( i * fFactorX );
+ pMapX[ i ] = nSrcX + static_cast<int>( i * fFactorX );
}
else
{
@@ -405,12 +405,12 @@ BitmapBuffer* StretchAndConvert(
}
// vertical mapping table
- if( nDstDY != nSrcDY )
+ if( (nDstDY != nSrcDY) && (nDstDY != 0) )
{
- const double fFactorY = ( nDstDY > 1 ) ? (double) ( nSrcDY - 1 ) / ( nDstDY - 1 ) : 0.0;
+ const double fFactorY = (double)nSrcDY / nDstDY;
for( i = 0L; i < nDstDY; i++ )
- pMapY[ i ] = nSrcY + FRound( i * fFactorY );
+ pMapY[ i ] = nSrcY + static_cast<int>( i * fFactorY );
}
else
{
commit fc67191ba272607655a9167b23054a7821cdd808
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jul 23 20:45:48 2013 +0100
XubString->OUString
Change-Id: Ie6b44d1f4abe1826254ab5bb178d73606bd1283c
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 38f301d..f05ee5d 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -277,8 +277,8 @@ public:
void SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror );
sal_Bool GetItemImageMirrorMode( sal_uInt16 ) const;
- void SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand );
- const XubString& GetItemCommand( sal_uInt16 nItemId ) const;
+ void SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand );
+ const OUString GetItemCommand( sal_uInt16 nItemId ) const;
void SetHelpText( sal_uInt16 nItemId, const XubString& rString );
const XubString& GetHelpText( sal_uInt16 nItemId ) const;
diff --git a/include/vcl/status.hxx b/include/vcl/status.hxx
index 12bfc19..2363cd1 100644
--- a/include/vcl/status.hxx
+++ b/include/vcl/status.hxx
@@ -164,8 +164,8 @@ public:
void SetItemData( sal_uInt16 nItemId, void* pNewData );
void* GetItemData( sal_uInt16 nItemId ) const;
- void SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand );
- const XubString& GetItemCommand( sal_uInt16 nItemId );
+ void SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand );
+ const OUString GetItemCommand( sal_uInt16 nItemId );
void SetHelpText( sal_uInt16 nItemId, const XubString& rText );
const XubString& GetHelpText( sal_uInt16 nItemId ) const;
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index ace9ea7..eee1485 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -448,8 +448,8 @@ public:
sal_Bool IsItemVisible( sal_uInt16 nItemId ) const;
sal_Bool IsItemReallyVisible( sal_uInt16 nItemId ) const;
- void SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand );
- const XubString& GetItemCommand( sal_uInt16 nItemId ) const;
+ void SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand );
+ const OUString GetItemCommand( sal_uInt16 nItemId ) const;
using Window::SetQuickHelpText;
void SetQuickHelpText( sal_uInt16 nItemId, const XubString& rText );
diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx
index 454ab93..005a140 100644
--- a/sfx2/source/menu/virtmenu.cxx
+++ b/sfx2/source/menu/virtmenu.cxx
@@ -724,7 +724,7 @@ void SfxVirtualMenu::BindControllers()
i != rCtrlArr.end(); ++i)
{
sal_uInt16 nSlotId = i->GetId();
- if ( !pSVMenu->GetItemCommand(nSlotId).Len() )
+ if (pSVMenu->GetItemCommand(nSlotId).isEmpty())
{
i->ReBind();
}
@@ -995,10 +995,11 @@ IMPL_LINK( SfxVirtualMenu, Select, Menu *, pMenu )
return sal_True;
}
- if ( pMenu->GetItemCommand( nSlotId ).Len() )
- pBindings->ExecuteCommand_Impl( pMenu->GetItemCommand( nSlotId ) );
+ OUString sCommand = pMenu->GetItemCommand(nSlotId);
+ if (!sCommand.isEmpty())
+ pBindings->ExecuteCommand_Impl(sCommand);
else
- pBindings->Execute( nSlotId );
+ pBindings->Execute(nSlotId);
return sal_True;
}
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index dfbbd93..ae45891 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1978,7 +1978,7 @@ sal_Bool Menu::GetItemImageMirrorMode( sal_uInt16 nItemId ) const
return sal_False;
}
-void Menu::SetItemCommand( sal_uInt16 nItemId, const String& rCommand )
+void Menu::SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand )
{
size_t nPos;
MenuItemData* pData = pItemList->GetData( nItemId, nPos );
@@ -1987,14 +1987,14 @@ void Menu::SetItemCommand( sal_uInt16 nItemId, const String& rCommand )
pData->aCommandStr = rCommand;
}
-const XubString& Menu::GetItemCommand( sal_uInt16 nItemId ) const
+const OUString Menu::GetItemCommand( sal_uInt16 nItemId ) const
{
MenuItemData* pData = pItemList->GetData( nItemId );
- if ( pData )
+ if (pData)
return pData->aCommandStr;
- else
- return ImplGetSVEmptyStr();
+
+ return OUString();
}
void Menu::SetHelpCommand( sal_uInt16 nItemId, const XubString& rStr )
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 1d08e84..2336cc3 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -1308,7 +1308,7 @@ const XubString& StatusBar::GetItemText( sal_uInt16 nItemId ) const
// -----------------------------------------------------------------------
-void StatusBar::SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand )
+void StatusBar::SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand )
{
sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1323,14 +1323,14 @@ void StatusBar::SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand )
// -----------------------------------------------------------------------
-const XubString& StatusBar::GetItemCommand( sal_uInt16 nItemId )
+const OUString StatusBar::GetItemCommand( sal_uInt16 nItemId )
{
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
return (*mpItemList)[ nPos ]->maCommand;
- return ImplGetSVEmptyStr();
+ return OUString();
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 05afd1a..1da3f82 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1795,24 +1795,24 @@ sal_Bool ToolBox::IsItemReallyVisible( sal_uInt16 nItemId ) const
// -----------------------------------------------------------------------
-void ToolBox::SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand )
+void ToolBox::SetItemCommand(sal_uInt16 nItemId, const OUString& rCommand)
{
ImplToolItem* pItem = ImplGetItem( nItemId );
- if ( pItem )
+ if (pItem)
pItem->maCommandStr = rCommand;
}
// -----------------------------------------------------------------------
-const XubString& ToolBox::GetItemCommand( sal_uInt16 nItemId ) const
+const OUString ToolBox::GetItemCommand( sal_uInt16 nItemId ) const
{
ImplToolItem* pItem = ImplGetItem( nItemId );
- if ( pItem )
+ if (pItem)
return pItem->maCommandStr;
- else
- return ImplGetSVEmptyStr();
+
+ return OUString();
}
// -----------------------------------------------------------------------
More information about the Libreoffice-commits
mailing list