loplugin:reducevarscope in framework
Change-Id: I79237d68d815f9b46277a496a05b596f58b4028b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103813 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
4c5ffaf2ae
commit
eac4526f07
@ -119,7 +119,6 @@ SAL_CALL PopupMenuDispatcher::queryDispatch(
|
||||
try
|
||||
{
|
||||
// Just use the main part of the URL for popup menu controllers
|
||||
sal_Int32 nQueryPart( 0 );
|
||||
sal_Int32 nSchemePart( 0 );
|
||||
OUString aBaseURL( "vnd.sun.star.popup:" );
|
||||
OUString aURL( rURL.Complete );
|
||||
@ -128,7 +127,7 @@ SAL_CALL PopupMenuDispatcher::queryDispatch(
|
||||
if (( nSchemePart > 0 ) &&
|
||||
( aURL.getLength() > ( nSchemePart+1 )))
|
||||
{
|
||||
nQueryPart = aURL.indexOf( '?', nSchemePart );
|
||||
sal_Int32 nQueryPart = aURL.indexOf( '?', nSchemePart );
|
||||
if ( nQueryPart > 0 )
|
||||
aBaseURL += aURL.copy( nSchemePart+1, nQueryPart-(nSchemePart+1) );
|
||||
else if ( nQueryPart == -1 )
|
||||
|
@ -45,11 +45,11 @@ VclPtr<PopupMenu> AddonMenuManager::CreateAddonMenu( const Reference< XFrame >&
|
||||
{
|
||||
AddonsOptions aOptions;
|
||||
VclPtr<PopupMenu> pAddonMenu;
|
||||
sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START;
|
||||
|
||||
const Sequence< Sequence< PropertyValue > >& rAddonMenuEntries = aOptions.GetAddonsMenu();
|
||||
if ( rAddonMenuEntries.hasElements() )
|
||||
{
|
||||
sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START;
|
||||
pAddonMenu = VclPtr<PopupMenu>::Create();
|
||||
OUString aModuleIdentifier = vcl::CommandInfoProvider::GetModuleIdentifier( rFrame );
|
||||
AddonMenuManager::BuildMenu( pAddonMenu, MENU_APPEND, nUniqueMenuId, rAddonMenuEntries, rFrame, aModuleIdentifier );
|
||||
|
@ -1420,7 +1420,6 @@ void AddonsOptions_Impl::AppendPopupMenu( Sequence< PropertyValue >& rTargetPopu
|
||||
bool AddonsOptions_Impl::ReadToolBarItem( const OUString& aToolBarItemNodeName, Sequence< PropertyValue >& aToolBarItem )
|
||||
{
|
||||
bool bResult = false;
|
||||
OUString aTitle;
|
||||
OUString aURL;
|
||||
OUString aAddonToolBarItemTreeNode( aToolBarItemNodeName + m_aPathDelimiter );
|
||||
|
||||
@ -1429,6 +1428,7 @@ bool AddonsOptions_Impl::ReadToolBarItem( const OUString& aToolBarItemNodeName,
|
||||
// A toolbar item must have a command URL
|
||||
if (( aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_URL ] >>= aURL ) && !aURL.isEmpty() )
|
||||
{
|
||||
OUString aTitle;
|
||||
if ( aURL == SEPARATOR_URL )
|
||||
{
|
||||
// A separator toolbar item only needs a URL
|
||||
@ -1473,7 +1473,6 @@ bool AddonsOptions_Impl::ReadToolBarItem( const OUString& aToolBarItemNodeName,
|
||||
bool AddonsOptions_Impl::ReadNotebookBarItem( const OUString& aNotebookBarItemNodeName, Sequence< PropertyValue >& aNotebookBarItem )
|
||||
{
|
||||
bool bResult = false;
|
||||
OUString aTitle;
|
||||
OUString aURL;
|
||||
OUString aAddonNotebookBarItemTreeNode( aNotebookBarItemNodeName + m_aPathDelimiter );
|
||||
|
||||
@ -1482,6 +1481,7 @@ bool AddonsOptions_Impl::ReadNotebookBarItem( const OUString& aNotebookBarItemNo
|
||||
// A toolbar item must have a command URL
|
||||
if (( aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_URL ] >>= aURL ) && !aURL.isEmpty() )
|
||||
{
|
||||
OUString aTitle;
|
||||
if ( aURL == SEPARATOR_URL )
|
||||
{
|
||||
// A separator toolbar item only needs a URL
|
||||
|
@ -241,8 +241,8 @@ void SAL_CALL JobExecutor::trigger( const OUString& sEvent )
|
||||
|
||||
void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent )
|
||||
{
|
||||
OUString EVENT_ON_DOCUMENT_OPENED("onDocumentOpened"); // Job UI event : OnNew or OnLoad
|
||||
OUString EVENT_ON_DOCUMENT_ADDED("onDocumentAdded"); // Job API event : OnCreate or OnLoadFinished
|
||||
static const OUStringLiteral EVENT_ON_DOCUMENT_OPENED(u"onDocumentOpened"); // Job UI event : OnNew or OnLoad
|
||||
static const OUStringLiteral EVENT_ON_DOCUMENT_ADDED(u"onDocumentAdded"); // Job API event : OnCreate or OnLoadFinished
|
||||
|
||||
OUString aModuleIdentifier;
|
||||
::std::vector< JobData::TJob2DocEventBinding > lJobs;
|
||||
|
@ -1475,7 +1475,6 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno
|
||||
else
|
||||
{
|
||||
bool bSetSize( false );
|
||||
awt::Point aDockPos;
|
||||
::Point aPixelPos;
|
||||
::Size aSize;
|
||||
|
||||
@ -1492,6 +1491,7 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno
|
||||
|
||||
if ( isDefaultPos( rElement.m_aDockedData.m_aPos ))
|
||||
{
|
||||
awt::Point aDockPos;
|
||||
implts_findNextDockingPos( rElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos );
|
||||
rElement.m_aDockedData.m_aPos = aDockPos;
|
||||
}
|
||||
@ -2390,8 +2390,6 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn(
|
||||
{
|
||||
sal_Int32 nDiff(0);
|
||||
sal_Int32 nRCSpace( rRowColumnWindowData.nSpace );
|
||||
sal_Int32 nTopDockingAreaSize(0);
|
||||
sal_Int32 nBottomDockingAreaSize(0);
|
||||
sal_Int32 nContainerClientSize(0);
|
||||
|
||||
if ( rRowColumnWindowData.aRowColumnWindows.empty() )
|
||||
@ -2404,8 +2402,8 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn(
|
||||
}
|
||||
else
|
||||
{
|
||||
nTopDockingAreaSize = implts_getTopBottomDockingAreaSizes().Width();
|
||||
nBottomDockingAreaSize = implts_getTopBottomDockingAreaSizes().Height();
|
||||
sal_Int32 nTopDockingAreaSize = implts_getTopBottomDockingAreaSizes().Width();
|
||||
sal_Int32 nBottomDockingAreaSize = implts_getTopBottomDockingAreaSizes().Height();
|
||||
nContainerClientSize = ( rContainerSize.Height() - nTopDockingAreaSize - nBottomDockingAreaSize );
|
||||
nDiff = nContainerClientSize - rRowColumnWindowData.nVarSize;
|
||||
}
|
||||
@ -2608,7 +2606,6 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
|
||||
}
|
||||
|
||||
vcl::Window* pDockingAreaWindow( nullptr );
|
||||
ToolBox* pToolBox( nullptr );
|
||||
uno::Reference< awt::XWindow > xWindow( rUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
|
||||
uno::Reference< awt::XWindow > xDockingAreaWindow;
|
||||
::tools::Rectangle aTrackingRect( rTrackingRect );
|
||||
@ -2632,6 +2629,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
|
||||
SolarMutexGuard aGuard;
|
||||
pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ).get();
|
||||
VclPtr<vcl::Window> pDockWindow = VCLUnoHelper::GetWindow( xWindow );
|
||||
ToolBox* pToolBox( nullptr );
|
||||
if ( pDockWindow && pDockWindow->GetType() == WindowType::TOOLBOX )
|
||||
pToolBox = static_cast<ToolBox *>(pDockWindow.get());
|
||||
|
||||
@ -2966,8 +2964,8 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d
|
||||
const ::tools::Rectangle& rRowColRect,
|
||||
const Point& rMousePos )
|
||||
{
|
||||
const sal_Int32 nHorzVerticalRegionSize = 6;
|
||||
const sal_Int32 nHorzVerticalMoveRegion = 4;
|
||||
constexpr sal_Int32 nHorzVerticalRegionSize = 6;
|
||||
constexpr sal_Int32 nHorzVerticalMoveRegion = 4;
|
||||
|
||||
if ( rRowColRect.IsInside( rMousePos ))
|
||||
{
|
||||
@ -3064,10 +3062,9 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d
|
||||
aReadGuard.clear();
|
||||
|
||||
sal_Int32 nDockPosY( 0 );
|
||||
vcl::Window* pDockingAreaWindow( nullptr );
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ).get();
|
||||
vcl::Window* pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ).get();
|
||||
VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
|
||||
nDockPosY = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( ::Point( 0, nPosY ))).Y();
|
||||
}
|
||||
@ -3254,14 +3251,6 @@ void SAL_CALL ToolbarLayoutManager::startDocking( const awt::DockingEvent& e )
|
||||
uno::Reference< awt::XWindow2 > xWindow( e.Source, uno::UNO_QUERY );
|
||||
aReadGuard.clear();
|
||||
|
||||
vcl::Window* pContainerWindow( nullptr );
|
||||
::Point aMousePos;
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ).get();
|
||||
aMousePos = pContainerWindow->ScreenToOutputPixel( ::Point( e.MousePos.X, e.MousePos.Y ));
|
||||
}
|
||||
|
||||
UIElement aUIElement = implts_findToolbar( e.Source );
|
||||
|
||||
if ( aUIElement.m_xUIElement.is() && xWindow.is() )
|
||||
@ -3296,8 +3285,8 @@ void SAL_CALL ToolbarLayoutManager::startDocking( const awt::DockingEvent& e )
|
||||
|
||||
awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent& e )
|
||||
{
|
||||
const sal_Int32 MAGNETIC_DISTANCE_UNDOCK = 25;
|
||||
const sal_Int32 MAGNETIC_DISTANCE_DOCK = 20;
|
||||
constexpr sal_Int32 MAGNETIC_DISTANCE_UNDOCK = 25;
|
||||
constexpr sal_Int32 MAGNETIC_DISTANCE_DOCK = 20;
|
||||
|
||||
SolarMutexClearableGuard aReadLock;
|
||||
awt::DockingData aDockingData;
|
||||
@ -3310,7 +3299,6 @@ awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent
|
||||
uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
|
||||
UIElement aUIDockingElement( m_aDockUIElement );
|
||||
|
||||
DockingOperation eDockingOperation( DOCKOP_ON_COLROW );
|
||||
bool bDockingInProgress( m_bDockingInProgress );
|
||||
aReadLock.clear();
|
||||
|
||||
@ -3323,9 +3311,9 @@ awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
|
||||
DockingOperation eDockingOperation( DOCKOP_ON_COLROW );
|
||||
ui::DockingArea eDockingArea( ui::DockingArea(-1) ); // none
|
||||
sal_Int32 nMagneticZone( aUIDockingElement.m_bFloating ? MAGNETIC_DISTANCE_DOCK : MAGNETIC_DISTANCE_UNDOCK );
|
||||
awt::Rectangle aNewTrackingRect;
|
||||
::tools::Rectangle aTrackingRect( e.TrackingRectangle.X, e.TrackingRectangle.Y,
|
||||
( e.TrackingRectangle.X + e.TrackingRectangle.Width ),
|
||||
( e.TrackingRectangle.Y + e.TrackingRectangle.Height ));
|
||||
@ -3405,9 +3393,8 @@ awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent
|
||||
implts_calcDockingPosSize( aUIDockingElement, eDockingOperation, aNewDockingRect, aMousePos );
|
||||
|
||||
::Point aScreenPos = pContainerWindow->OutputToScreenPixel( aNewDockingRect.TopLeft() );
|
||||
aNewTrackingRect = awt::Rectangle( aScreenPos.X(), aScreenPos.Y(),
|
||||
aDockingData.TrackingRectangle = awt::Rectangle( aScreenPos.X(), aScreenPos.Y(),
|
||||
aNewDockingRect.getWidth(), aNewDockingRect.getHeight() );
|
||||
aDockingData.TrackingRectangle = aNewTrackingRect;
|
||||
}
|
||||
else if (pToolBox)
|
||||
{
|
||||
|
@ -117,10 +117,9 @@ sal_Bool SAL_CALL URLTransformer::parseStrict( css::util::URL& aURL )
|
||||
}
|
||||
// Try to extract the protocol
|
||||
sal_Int32 nURLIndex = aURL.Complete.indexOf( ':' );
|
||||
OUString aProtocol;
|
||||
if ( nURLIndex > 1 )
|
||||
{
|
||||
aProtocol = aURL.Complete.copy( 0, nURLIndex+1 );
|
||||
OUString aProtocol = aURL.Complete.copy( 0, nURLIndex+1 );
|
||||
|
||||
// If INetURLObject knows this protocol let it parse
|
||||
if ( INetURLObject::CompareProtocolScheme( aProtocol ) != INetProtocol::NotValid )
|
||||
@ -187,10 +186,9 @@ sal_Bool SAL_CALL URLTransformer::parseSmart( css::util::URL& aURL,
|
||||
{
|
||||
// Try to extract the protocol
|
||||
sal_Int32 nIndex = aURL.Complete.indexOf( ':' );
|
||||
OUString aProtocol;
|
||||
if ( nIndex > 1 )
|
||||
{
|
||||
aProtocol = aURL.Complete.copy( 0, nIndex+1 );
|
||||
OUString aProtocol = aURL.Complete.copy( 0, nIndex+1 );
|
||||
|
||||
// If INetURLObject knows this protocol something is wrong as detected before =>
|
||||
// give up and return false!
|
||||
|
@ -1495,16 +1495,15 @@ void MenuBarManager::GetPopupController( PopupControllerCache& rPopupController
|
||||
aPopupControllerEntry.m_xDispatchProvider = xDispatchProvider;
|
||||
|
||||
// Just use the main part of the URL for popup menu controllers
|
||||
sal_Int32 nQueryPart( 0 );
|
||||
sal_Int32 nSchemePart( 0 );
|
||||
OUString aMainURL( "vnd.sun.star.popup:" );
|
||||
OUString aMenuURL( menuItemHandler->aMenuItemURL );
|
||||
|
||||
nSchemePart = aMenuURL.indexOf( ':' );
|
||||
if (( nSchemePart > 0 ) &&
|
||||
( aMenuURL.getLength() > ( nSchemePart+1 )))
|
||||
{
|
||||
nQueryPart = aMenuURL.indexOf( '?', nSchemePart );
|
||||
OUString aMainURL( "vnd.sun.star.popup:" );
|
||||
sal_Int32 nQueryPart = aMenuURL.indexOf( '?', nSchemePart );
|
||||
if ( nQueryPart > 0 )
|
||||
aMainURL += aMenuURL.copy( nSchemePart, nQueryPart-nSchemePart );
|
||||
else if ( nQueryPart == -1 )
|
||||
|
@ -350,13 +350,12 @@ bool MenuBarMerger::ProcessFallbackOperation(
|
||||
{
|
||||
const OUString aCmd( rReferencePath[nLevel] );
|
||||
|
||||
sal_uInt16 nInsPos( MENU_APPEND );
|
||||
VclPtr<PopupMenu> pPopupMenu = VclPtr<PopupMenu>::Create();
|
||||
|
||||
if ( bFirstLevel && ( aRefPathInfo.eResult == RP_MENUITEM_INSTEAD_OF_POPUPMENU_FOUND ))
|
||||
{
|
||||
// special case: menu item without popup
|
||||
nInsPos = aRefPathInfo.nPos;
|
||||
sal_uInt16 nInsPos = aRefPathInfo.nPos;
|
||||
sal_uInt16 nSetItemId = pCurrMenu->GetItemId( nInsPos );
|
||||
pCurrMenu->SetItemCommand( nSetItemId, aCmd );
|
||||
pCurrMenu->SetPopupMenu( nSetItemId, pPopupMenu );
|
||||
|
@ -457,7 +457,7 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc
|
||||
}
|
||||
|
||||
// Statusbar Merging
|
||||
const sal_uInt16 STATUSBAR_ITEM_STARTID = 1000;
|
||||
constexpr sal_uInt16 STATUSBAR_ITEM_STARTID = 1000;
|
||||
MergeStatusbarInstructionContainer aMergeInstructions = AddonsOptions().GetMergeStatusbarInstructions();
|
||||
if ( !aMergeInstructions.empty() )
|
||||
{
|
||||
|
@ -364,12 +364,12 @@ void SubToolBarController::endPopupMode( const css::awt::EndPopupModeEvent& e )
|
||||
if ( !(xSubToolBar.is() && xProp.is()) )
|
||||
return;
|
||||
|
||||
OUString aPersistentString( "Persistent" );
|
||||
try
|
||||
{
|
||||
VclPtr<vcl::Window> pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar );
|
||||
if ( pTbxWindow && pTbxWindow->GetType() == WindowType::TOOLBOX )
|
||||
{
|
||||
OUString aPersistentString( "Persistent" );
|
||||
css::uno::Any a = xProp->getPropertyValue( aPersistentString );
|
||||
xProp->setPropertyValue( aPersistentString, css::uno::makeAny( false ) );
|
||||
|
||||
|
@ -1075,7 +1075,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
|
||||
|
||||
// Support add-on toolbar merging here. Working directly on the toolbar object is much
|
||||
// simpler and faster.
|
||||
const sal_uInt16 TOOLBAR_ITEM_STARTID = 1000;
|
||||
constexpr sal_uInt16 TOOLBAR_ITEM_STARTID = 1000;
|
||||
|
||||
MergeToolbarInstructionContainer aMergeInstructionContainer;
|
||||
|
||||
|
@ -768,10 +768,9 @@ void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArgume
|
||||
Reference< XNameAccess > xPersistentWindowStateSupplier = css::ui::theWindowStateConfiguration::get( m_xContext );
|
||||
|
||||
// Retrieve persistent window state reference for our module
|
||||
OUString aModuleIdentifier;
|
||||
try
|
||||
{
|
||||
aModuleIdentifier = xModuleManager->identify( m_xFrame );
|
||||
OUString aModuleIdentifier = xModuleManager->identify( m_xFrame );
|
||||
xPersistentWindowStateSupplier->getByName( aModuleIdentifier ) >>= m_xPersistentWindowState;
|
||||
|
||||
Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier =
|
||||
|
Loading…
x
Reference in New Issue
Block a user