[Libreoffice-commits] core.git: compilerplugins/clang framework/inc framework/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Feb 6 07:58:07 UTC 2017
compilerplugins/clang/unusedenumconstants.py | 1
framework/inc/protocols.h | 53 +-
framework/inc/uielement/togglebuttontoolbarcontroller.hxx | 8
framework/source/classes/taskcreator.cxx | 4
framework/source/inc/loadenv/targethelper.hxx | 17
framework/source/loadenv/loadenv.cxx | 36 -
framework/source/loadenv/targethelper.cxx | 18
framework/source/uielement/togglebuttontoolbarcontroller.cxx | 210 +++++------
framework/source/uielement/toolbarmerger.cxx | 4
9 files changed, 169 insertions(+), 182 deletions(-)
New commits:
commit bac9a5d634b333fdc2345bfd3fa852ccc5f0d73b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Feb 6 09:15:51 2017 +0200
loplugin:unusedenumconstants in framework
Convert EProtocol to scoped enum and drop E_UNKNOWN_PROTOCOL.
Convert ToggleButtonToolbarController::Style to scoped enum and drop
STYLE_TOGGLEBUTTON.
Convert TargetHelper::ESpecialTarget to scoped enum and drop
E_NOT_SPECIAL.
Change-Id: I412adacac15192cf6563ce4d5e5b74bfffff4737
Reviewed-on: https://gerrit.libreoffice.org/33949
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py
index f2876b5..89c35db 100755
--- a/compilerplugins/clang/unusedenumconstants.py
+++ b/compilerplugins/clang/unusedenumconstants.py
@@ -95,6 +95,7 @@ for d in definitionSet:
# general weird nonsense going on
"framework/inc/helper/mischelper.hxx"
"include/sfx2/shell.hxx",
+ "framework/inc/helper/mischelper.hxx",
# Windows or OSX only
"include/canvas/rendering/icolorbuffer.hxx",
"include/vcl/commandevent.hxx",
diff --git a/framework/inc/protocols.h b/framework/inc/protocols.h
index b93f292..4e7f1cb 100644
--- a/framework/inc/protocols.h
+++ b/framework/inc/protocols.h
@@ -53,29 +53,26 @@ namespace framework{
// for sending news
#define SPECIALPROTOCOL_NEWS "news:"
+/** well known protocols */
+enum class EProtocol
+{
+ Private,
+ PrivateObject,
+ PrivateStream,
+ PrivateFactory,
+ Slot,
+ Uno,
+ Macro,
+ Service,
+ MailTo,
+ News
+};
+
class ProtocolCheck
{
public:
/**
- enums for well known protocols
- */
- enum EProtocol
- {
- E_UNKNOWN_PROTOCOL ,
- E_PRIVATE ,
- E_PRIVATE_OBJECT ,
- E_PRIVATE_STREAM ,
- E_PRIVATE_FACTORY ,
- E_SLOT ,
- E_UNO ,
- E_MACRO ,
- E_SERVICE ,
- E_MAILTO ,
- E_NEWS
- };
-
- /**
it checks if given URL match the required protocol only
It should be used instead of specifyProtocol() if only this question
is interesting to perform the code. We must not check for all possible protocols here...
@@ -85,34 +82,34 @@ class ProtocolCheck
bool bRet = false;
switch(eRequired)
{
- case E_PRIVATE:
+ case EProtocol::Private:
bRet = sURL.startsWith(SPECIALPROTOCOL_PRIVATE);
break;
- case E_PRIVATE_OBJECT:
+ case EProtocol::PrivateObject:
bRet = sURL.startsWith(SPECIALPROTOCOL_PRIVATE_OBJECT);
break;
- case E_PRIVATE_STREAM:
+ case EProtocol::PrivateStream:
bRet = sURL.startsWith(SPECIALPROTOCOL_PRIVATE_STREAM);
break;
- case E_PRIVATE_FACTORY:
+ case EProtocol::PrivateFactory:
bRet = sURL.startsWith(SPECIALPROTOCOL_PRIVATE_FACTORY);
break;
- case E_SLOT:
+ case EProtocol::Slot:
bRet = sURL.startsWith(SPECIALPROTOCOL_SLOT);
break;
- case E_UNO:
+ case EProtocol::Uno:
bRet = sURL.startsWith(SPECIALPROTOCOL_UNO);
break;
- case E_MACRO:
+ case EProtocol::Macro:
bRet = sURL.startsWith(SPECIALPROTOCOL_MACRO);
break;
- case E_SERVICE:
+ case EProtocol::Service:
bRet = sURL.startsWith(SPECIALPROTOCOL_SERVICE);
break;
- case E_MAILTO:
+ case EProtocol::MailTo:
bRet = sURL.startsWith(SPECIALPROTOCOL_MAILTO);
break;
- case E_NEWS:
+ case EProtocol::News:
bRet = sURL.startsWith(SPECIALPROTOCOL_NEWS);
break;
default:
diff --git a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx
index e057b0c..7d9532e 100644
--- a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx
+++ b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx
@@ -37,11 +37,10 @@ class ToggleButtonToolbarController : public ComplexToolbarController
{
public:
- enum Style
+ enum class Style
{
- STYLE_TOGGLEBUTTON,
- STYLE_DROPDOWNBUTTON,
- STYLE_TOGGLE_DROPDOWNBUTTON
+ DropDownButton,
+ ToggleDropDownButton
};
ToggleButtonToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
@@ -65,7 +64,6 @@ class ToggleButtonToolbarController : public ComplexToolbarController
private:
DECL_LINK( MenuSelectHdl, Menu *, bool);
- Style m_eStyle;
OUString m_aCurrentSelection;
std::vector< OUString > m_aDropdownMenuList;
};
diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx
index 3bc3b1e..9994fa9 100644
--- a/framework/source/classes/taskcreator.cxx
+++ b/framework/source/classes/taskcreator.cxx
@@ -65,8 +65,8 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUStrin
try
{
if (
- ( TargetHelper::matchSpecialTarget(sName, TargetHelper::E_BLANK ) ) ||
- ( TargetHelper::matchSpecialTarget(sName, TargetHelper::E_DEFAULT) )
+ ( TargetHelper::matchSpecialTarget(sName, TargetHelper::ESpecialTarget::Blank ) ) ||
+ ( TargetHelper::matchSpecialTarget(sName, TargetHelper::ESpecialTarget::Default) )
)
{
diff --git a/framework/source/inc/loadenv/targethelper.hxx b/framework/source/inc/loadenv/targethelper.hxx
index 40c5de1..5743400 100644
--- a/framework/source/inc/loadenv/targethelper.hxx
+++ b/framework/source/inc/loadenv/targethelper.hxx
@@ -39,16 +39,15 @@ class TargetHelper
/** @short its used at the following interfaces to classify
target names.
*/
- enum ESpecialTarget
+ enum class ESpecialTarget
{
- E_NOT_SPECIAL ,
- E_SELF ,
- E_PARENT ,
- E_TOP ,
- E_BLANK ,
- E_DEFAULT ,
- E_BEAMER ,
- E_HELPTASK
+ Self,
+ Parent,
+ Top,
+ Blank,
+ Default,
+ Beamer,
+ HelpTask
};
// interface
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index b5af8ee..4369702 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -512,12 +512,12 @@ LoadEnv::EContentType LoadEnv::classifyContent(const OUString&
if(
(sURL.isEmpty() ) ||
- (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_UNO )) ||
- (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_SLOT )) ||
- (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_MACRO )) ||
- (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_SERVICE)) ||
- (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_MAILTO )) ||
- (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_NEWS ))
+ (ProtocolCheck::isProtocol(sURL,EProtocol::Uno )) ||
+ (ProtocolCheck::isProtocol(sURL,EProtocol::Slot )) ||
+ (ProtocolCheck::isProtocol(sURL,EProtocol::Macro )) ||
+ (ProtocolCheck::isProtocol(sURL,EProtocol::Service)) ||
+ (ProtocolCheck::isProtocol(sURL,EProtocol::MailTo )) ||
+ (ProtocolCheck::isProtocol(sURL,EProtocol::News ))
)
{
return E_UNSUPPORTED_CONTENT;
@@ -539,13 +539,13 @@ LoadEnv::EContentType LoadEnv::classifyContent(const OUString&
*/
// creation of new documents
- if (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_PRIVATE_FACTORY))
+ if (ProtocolCheck::isProtocol(sURL,EProtocol::PrivateFactory))
return E_CAN_BE_LOADED;
// using of an existing input stream
utl::MediaDescriptor stlMediaDescriptor(lMediaDescriptor);
utl::MediaDescriptor::const_iterator pIt;
- if (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_PRIVATE_STREAM))
+ if (ProtocolCheck::isProtocol(sURL,EProtocol::PrivateStream))
{
pIt = stlMediaDescriptor.find(utl::MediaDescriptor::PROP_INPUTSTREAM());
css::uno::Reference< css::io::XInputStream > xStream;
@@ -558,7 +558,7 @@ LoadEnv::EContentType LoadEnv::classifyContent(const OUString&
}
// using of a full featured document
- if (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_PRIVATE_OBJECT))
+ if (ProtocolCheck::isProtocol(sURL,EProtocol::PrivateObject))
{
pIt = stlMediaDescriptor.find(utl::MediaDescriptor::PROP_MODEL());
css::uno::Reference< css::frame::XModel > xModel;
@@ -964,7 +964,7 @@ bool LoadEnv::impl_loadContent()
// search or create right target frame
OUString sTarget = m_sTarget;
- if (TargetHelper::matchSpecialTarget(sTarget, TargetHelper::E_DEFAULT))
+ if (TargetHelper::matchSpecialTarget(sTarget, TargetHelper::ESpecialTarget::Default))
{
m_xTargetFrame = impl_searchAlreadyLoaded();
if (m_xTargetFrame.is())
@@ -978,8 +978,8 @@ bool LoadEnv::impl_loadContent()
if (! m_xTargetFrame.is())
{
if (
- (TargetHelper::matchSpecialTarget(sTarget, TargetHelper::E_BLANK )) ||
- (TargetHelper::matchSpecialTarget(sTarget, TargetHelper::E_DEFAULT))
+ (TargetHelper::matchSpecialTarget(sTarget, TargetHelper::ESpecialTarget::Blank )) ||
+ (TargetHelper::matchSpecialTarget(sTarget, TargetHelper::ESpecialTarget::Default))
)
{
if (! impl_furtherDocsAllowed())
@@ -1192,7 +1192,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded()
// such search is allowed for special requests only ...
// or better it's not allowed for some requests in general :-)
if (
- ( ! TargetHelper::matchSpecialTarget(m_sTarget, TargetHelper::E_DEFAULT) ) ||
+ ( ! TargetHelper::matchSpecialTarget(m_sTarget, TargetHelper::ESpecialTarget::Default) ) ||
m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_ASTEMPLATE() , false) ||
// (m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN() , false) == sal_True) ||
m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_OPENNEWVIEW(), false)
@@ -1205,8 +1205,8 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded()
// May it's not useful to start expensive document search, if it
// can fail only .. because we load from a stream or model directly!
if (
- (ProtocolCheck::isProtocol(m_aURL.Complete, ProtocolCheck::E_PRIVATE_STREAM )) ||
- (ProtocolCheck::isProtocol(m_aURL.Complete, ProtocolCheck::E_PRIVATE_OBJECT ))
+ (ProtocolCheck::isProtocol(m_aURL.Complete, EProtocol::PrivateStream )) ||
+ (ProtocolCheck::isProtocol(m_aURL.Complete, EProtocol::PrivateObject ))
/*TODO should be private:factory here tested too? */
)
{
@@ -1375,9 +1375,9 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget()
// On the other side some special URLs will open a new frame every time (expecting
// they can use the backing-mode frame!)
if (
- (ProtocolCheck::isProtocol(m_aURL.Complete, ProtocolCheck::E_PRIVATE_FACTORY )) ||
- (ProtocolCheck::isProtocol(m_aURL.Complete, ProtocolCheck::E_PRIVATE_STREAM )) ||
- (ProtocolCheck::isProtocol(m_aURL.Complete, ProtocolCheck::E_PRIVATE_OBJECT ))
+ (ProtocolCheck::isProtocol(m_aURL.Complete, EProtocol::PrivateFactory )) ||
+ (ProtocolCheck::isProtocol(m_aURL.Complete, EProtocol::PrivateStream )) ||
+ (ProtocolCheck::isProtocol(m_aURL.Complete, EProtocol::PrivateObject ))
)
{
return css::uno::Reference< css::frame::XFrame >();
diff --git a/framework/source/loadenv/targethelper.cxx b/framework/source/loadenv/targethelper.cxx
index 488b052..4010355 100644
--- a/framework/source/loadenv/targethelper.cxx
+++ b/framework/source/loadenv/targethelper.cxx
@@ -26,28 +26,28 @@ bool TargetHelper::matchSpecialTarget(const OUString& sCheckTarget ,
{
switch(eSpecialTarget)
{
- case E_SELF :
+ case ESpecialTarget::Self :
return (
(sCheckTarget.isEmpty() ) ||
sCheckTarget == SPECIALTARGET_SELF
);
- case E_PARENT :
+ case ESpecialTarget::Parent :
return sCheckTarget == SPECIALTARGET_PARENT;
- case E_TOP :
+ case ESpecialTarget::Top :
return sCheckTarget == SPECIALTARGET_TOP;
- case E_BLANK :
+ case ESpecialTarget::Blank :
return sCheckTarget == SPECIALTARGET_BLANK;
- case E_DEFAULT :
+ case ESpecialTarget::Default :
return sCheckTarget == SPECIALTARGET_DEFAULT;
- case E_BEAMER :
+ case ESpecialTarget::Beamer :
return sCheckTarget == SPECIALTARGET_BEAMER;
- case E_HELPTASK :
+ case ESpecialTarget::HelpTask :
return sCheckTarget == SPECIALTARGET_HELPTASK;
default:
return false;
@@ -60,8 +60,8 @@ bool TargetHelper::isValidNameForFrame(const OUString& sName)
// E.g. the are really used to locate one frame inside the frame tree.
if (
(sName.isEmpty() ) ||
- (TargetHelper::matchSpecialTarget(sName, E_HELPTASK)) ||
- (TargetHelper::matchSpecialTarget(sName, E_BEAMER) )
+ (TargetHelper::matchSpecialTarget(sName, ESpecialTarget::HelpTask)) ||
+ (TargetHelper::matchSpecialTarget(sName, ESpecialTarget::Beamer) )
)
return true;
diff --git a/framework/source/uielement/togglebuttontoolbarcontroller.cxx b/framework/source/uielement/togglebuttontoolbarcontroller.cxx
index 4f82219..f1341f5 100644
--- a/framework/source/uielement/togglebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/togglebuttontoolbarcontroller.cxx
@@ -60,12 +60,11 @@ ToggleButtonToolbarController::ToggleButtonToolbarController(
sal_uInt16 nID,
Style eStyle,
const OUString& aCommand ) :
- ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand ),
- m_eStyle( eStyle )
+ ComplexToolbarController( rxContext, rFrame, pToolbar, nID, aCommand )
{
- if ( eStyle == STYLE_DROPDOWNBUTTON )
+ if ( eStyle == Style::DropDownButton )
m_pToolbar->SetItemBits( m_nID, ToolBoxItemBits::DROPDOWNONLY | m_pToolbar->GetItemBits( m_nID ) );
- else if ( eStyle == STYLE_TOGGLE_DROPDOWNBUTTON )
+ else // Style::ToggleDropDownButton
m_pToolbar->SetItemBits( m_nID, ToolBoxItemBits::DROPDOWN | m_pToolbar->GetItemBits( m_nID ) );
}
@@ -96,28 +95,25 @@ uno::Reference< awt::XWindow > SAL_CALL ToggleButtonToolbarController::createPop
uno::Reference< awt::XWindow > xWindow;
SolarMutexGuard aSolarMutexGuard;
- if (( m_eStyle == STYLE_DROPDOWNBUTTON ) ||
- ( m_eStyle == STYLE_TOGGLE_DROPDOWNBUTTON ))
- {
- // create popup menu
- ScopedVclPtrInstance<::PopupMenu> aPopup;
- const sal_uInt32 nCount = m_aDropdownMenuList.size();
- for ( sal_uInt32 i = 0; i < nCount; i++ )
- {
- OUString aLabel( m_aDropdownMenuList[i] );
- aPopup->InsertItem( sal_uInt16( i+1 ), aLabel );
- if ( aLabel == m_aCurrentSelection )
- aPopup->CheckItem( sal_uInt16( i+1 ) );
- else
- aPopup->CheckItem( sal_uInt16( i+1 ), false );
- }
- m_pToolbar->SetItemDown( m_nID, true );
- aPopup->SetSelectHdl( LINK( this, ToggleButtonToolbarController, MenuSelectHdl ));
- aPopup->Execute( m_pToolbar, m_pToolbar->GetItemRect( m_nID ));
- m_pToolbar->SetItemDown( m_nID, false );
+ // create popup menu
+ ScopedVclPtrInstance<::PopupMenu> aPopup;
+ const sal_uInt32 nCount = m_aDropdownMenuList.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ OUString aLabel( m_aDropdownMenuList[i] );
+ aPopup->InsertItem( sal_uInt16( i+1 ), aLabel );
+ if ( aLabel == m_aCurrentSelection )
+ aPopup->CheckItem( sal_uInt16( i+1 ) );
+ else
+ aPopup->CheckItem( sal_uInt16( i+1 ), false );
}
+ m_pToolbar->SetItemDown( m_nID, true );
+ aPopup->SetSelectHdl( LINK( this, ToggleButtonToolbarController, MenuSelectHdl ));
+ aPopup->Execute( m_pToolbar, m_pToolbar->GetItemRect( m_nID ));
+ m_pToolbar->SetItemDown( m_nID, false );
+
return xWindow;
}
@@ -125,133 +121,129 @@ void ToggleButtonToolbarController::executeControlCommand( const css::frame::Con
{
SolarMutexGuard aSolarMutexGuard;
- if (( m_eStyle == STYLE_DROPDOWNBUTTON ) ||
- ( m_eStyle == STYLE_TOGGLE_DROPDOWNBUTTON ))
+ if ( rControlCommand.Command == "SetList" )
{
- if ( rControlCommand.Command == "SetList" )
+ for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
{
- for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+ if ( rControlCommand.Arguments[i].Name == "List" )
{
- if ( rControlCommand.Arguments[i].Name == "List" )
- {
- Sequence< OUString > aList;
- m_aDropdownMenuList.clear();
+ Sequence< OUString > aList;
+ m_aDropdownMenuList.clear();
- rControlCommand.Arguments[i].Value >>= aList;
- for ( sal_Int32 j = 0; j < aList.getLength(); j++ )
- m_aDropdownMenuList.push_back( aList[j] );
+ rControlCommand.Arguments[i].Value >>= aList;
+ for ( sal_Int32 j = 0; j < aList.getLength(); j++ )
+ m_aDropdownMenuList.push_back( aList[j] );
- // send notification
- uno::Sequence< beans::NamedValue > aInfo { { "List", css::uno::makeAny(aList) } };
- addNotifyInfo( "ListChanged",
- getDispatchFromCommand( m_aCommandURL ),
- aInfo );
+ // send notification
+ uno::Sequence< beans::NamedValue > aInfo { { "List", css::uno::makeAny(aList) } };
+ addNotifyInfo( "ListChanged",
+ getDispatchFromCommand( m_aCommandURL ),
+ aInfo );
- break;
- }
+ break;
}
}
- else if ( rControlCommand.Command == "CheckItemPos" )
+ }
+ else if ( rControlCommand.Command == "CheckItemPos" )
+ {
+ for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
{
- for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+ if ( rControlCommand.Arguments[i].Name == "Pos" )
{
- if ( rControlCommand.Arguments[i].Name == "Pos" )
- {
- sal_Int32 nPos( -1 );
+ sal_Int32 nPos( -1 );
- rControlCommand.Arguments[i].Value >>= nPos;
- if ( nPos >= 0 &&
- ( sal::static_int_cast< sal_uInt32 >(nPos)
- < m_aDropdownMenuList.size() ) )
- {
- m_aCurrentSelection = m_aDropdownMenuList[nPos];
+ rControlCommand.Arguments[i].Value >>= nPos;
+ if ( nPos >= 0 &&
+ ( sal::static_int_cast< sal_uInt32 >(nPos)
+ < m_aDropdownMenuList.size() ) )
+ {
+ m_aCurrentSelection = m_aDropdownMenuList[nPos];
- // send notification
- uno::Sequence< beans::NamedValue > aInfo { { "ItemChecked", css::uno::makeAny(nPos) } };
- addNotifyInfo( "Pos",
- getDispatchFromCommand( m_aCommandURL ),
- aInfo );
- }
- break;
+ // send notification
+ uno::Sequence< beans::NamedValue > aInfo { { "ItemChecked", css::uno::makeAny(nPos) } };
+ addNotifyInfo( "Pos",
+ getDispatchFromCommand( m_aCommandURL ),
+ aInfo );
}
+ break;
}
}
- else if ( rControlCommand.Command == "AddEntry" )
+ }
+ else if ( rControlCommand.Command == "AddEntry" )
+ {
+ OUString aText;
+ for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
{
- OUString aText;
- for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+ if ( rControlCommand.Arguments[i].Name == "Text" )
{
- if ( rControlCommand.Arguments[i].Name == "Text" )
- {
- if ( rControlCommand.Arguments[i].Value >>= aText )
- m_aDropdownMenuList.push_back( aText );
- break;
- }
+ if ( rControlCommand.Arguments[i].Value >>= aText )
+ m_aDropdownMenuList.push_back( aText );
+ break;
}
}
- else if ( rControlCommand.Command == "InsertEntry" )
+ }
+ else if ( rControlCommand.Command == "InsertEntry" )
+ {
+ sal_Int32 nPos( COMBOBOX_APPEND );
+ sal_Int32 nSize = sal_Int32( m_aDropdownMenuList.size() );
+ OUString aText;
+ for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
{
- sal_Int32 nPos( COMBOBOX_APPEND );
- sal_Int32 nSize = sal_Int32( m_aDropdownMenuList.size() );
- OUString aText;
- for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+ if ( rControlCommand.Arguments[i].Name == "Pos" )
{
- if ( rControlCommand.Arguments[i].Name == "Pos" )
+ sal_Int32 nTmpPos = 0;
+ if ( rControlCommand.Arguments[i].Value >>= nTmpPos )
{
- sal_Int32 nTmpPos = 0;
- if ( rControlCommand.Arguments[i].Value >>= nTmpPos )
- {
- if (( nTmpPos >= 0 ) && ( nTmpPos < sal_Int32( nSize )))
- nPos = nTmpPos;
- }
+ if (( nTmpPos >= 0 ) && ( nTmpPos < sal_Int32( nSize )))
+ nPos = nTmpPos;
}
- else if ( rControlCommand.Arguments[i].Name == "Text" )
- rControlCommand.Arguments[i].Value >>= aText;
}
-
- std::vector< OUString >::iterator aIter = m_aDropdownMenuList.begin();
- aIter += nPos;
- m_aDropdownMenuList.insert( aIter, aText );
+ else if ( rControlCommand.Arguments[i].Name == "Text" )
+ rControlCommand.Arguments[i].Value >>= aText;
}
- else if ( rControlCommand.Command == "RemoveEntryPos" )
+
+ std::vector< OUString >::iterator aIter = m_aDropdownMenuList.begin();
+ aIter += nPos;
+ m_aDropdownMenuList.insert( aIter, aText );
+ }
+ else if ( rControlCommand.Command == "RemoveEntryPos" )
+ {
+ for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
{
- for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+ if ( rControlCommand.Arguments[i].Name == "Pos" )
{
- if ( rControlCommand.Arguments[i].Name == "Pos" )
+ sal_Int32 nPos( -1 );
+ if ( rControlCommand.Arguments[i].Value >>= nPos )
{
- sal_Int32 nPos( -1 );
- if ( rControlCommand.Arguments[i].Value >>= nPos )
+ if ( nPos < sal_Int32( m_aDropdownMenuList.size() ))
{
- if ( nPos < sal_Int32( m_aDropdownMenuList.size() ))
- {
- m_aDropdownMenuList.erase(m_aDropdownMenuList.begin() + nPos);
- }
+ m_aDropdownMenuList.erase(m_aDropdownMenuList.begin() + nPos);
}
- break;
}
+ break;
}
}
- else if ( rControlCommand.Command == "RemoveEntryText" )
+ }
+ else if ( rControlCommand.Command == "RemoveEntryText" )
+ {
+ for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
{
- for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+ if ( rControlCommand.Arguments[i].Name == "Text" )
{
- if ( rControlCommand.Arguments[i].Name == "Text" )
+ OUString aText;
+ if ( rControlCommand.Arguments[i].Value >>= aText )
{
- OUString aText;
- if ( rControlCommand.Arguments[i].Value >>= aText )
+ sal_Int32 nSize = sal_Int32( m_aDropdownMenuList.size() );
+ for ( sal_Int32 j = 0; j < nSize; j++ )
{
- sal_Int32 nSize = sal_Int32( m_aDropdownMenuList.size() );
- for ( sal_Int32 j = 0; j < nSize; j++ )
+ if ( m_aDropdownMenuList[j] == aText )
{
- if ( m_aDropdownMenuList[j] == aText )
- {
- m_aDropdownMenuList.erase(m_aDropdownMenuList.begin() + j);
- break;
- }
+ m_aDropdownMenuList.erase(m_aDropdownMenuList.begin() + j);
+ break;
}
}
- break;
}
+ break;
}
}
}
diff --git a/framework/source/uielement/toolbarmerger.cxx b/framework/source/uielement/toolbarmerger.cxx
index db77987..5c89dfa 100644
--- a/framework/source/uielement/toolbarmerger.cxx
+++ b/framework/source/uielement/toolbarmerger.cxx
@@ -623,10 +623,10 @@ bool ToolBarMerger::RemoveItems(
pResult = new DropdownToolbarController( rxContext, xFrame, pToolbar, nId, nWidth, rCommandURL );
else if ( rControlType == TOOLBARCONTROLLER_DROPDOWNBTN )
pResult = new ToggleButtonToolbarController( rxContext, xFrame, pToolbar, nId,
- ToggleButtonToolbarController::STYLE_DROPDOWNBUTTON, rCommandURL );
+ ToggleButtonToolbarController::Style::DropDownButton, rCommandURL );
else if ( rControlType == TOOLBARCONTROLLER_TOGGLEDDBTN )
pResult = new ToggleButtonToolbarController( rxContext, xFrame, pToolbar, nId,
- ToggleButtonToolbarController::STYLE_TOGGLE_DROPDOWNBUTTON, rCommandURL );
+ ToggleButtonToolbarController::Style::ToggleDropDownButton, rCommandURL );
else
pResult = new GenericToolbarController( rxContext, xFrame, pToolbar, nId, rCommandURL );
More information about the Libreoffice-commits
mailing list