[Libreoffice-commits] core.git: 7 commits - framework/dtd framework/source include/vcl officecfg/registry vcl/source
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Thu Oct 13 19:58:48 UTC 2016
framework/dtd/toolbar.dtd | 1
framework/source/uielement/menubarmanager.cxx | 62 ++++++----
framework/source/uielement/toolbarmanager.cxx | 6
framework/source/uielement/uicommanddescription.cxx | 15 ++
include/vcl/commandinfoprovider.hxx | 5
officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 6
officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs | 5
vcl/source/helper/commandinfoprovider.cxx | 30 ++++
8 files changed, 106 insertions(+), 24 deletions(-)
New commits:
commit dad3e93a781165a124180d1f17c63a0e22f7a56e
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Thu Oct 13 21:50:16 2016 +0200
Improve formatting
Change-Id: I088997f51b6ed5131dec706f52b568671605d6e5
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 77e484d..9817197 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -764,7 +764,9 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
m_bActive = true;
OUString aMenuCommand( m_aMenuItemCommand );
- if ( m_aMenuItemCommand == aSpecialWindowMenu || m_aMenuItemCommand == aSlotSpecialWindowMenu || aMenuCommand == aSpecialWindowCommand )
+ if ( m_aMenuItemCommand == aSpecialWindowMenu ||
+ m_aMenuItemCommand == aSlotSpecialWindowMenu ||
+ aMenuCommand == aSpecialWindowCommand )
UpdateSpecialWindowMenu( pMenu, m_xContext );
// Check if some modes have changed so we have to update our menu images
@@ -1129,7 +1131,9 @@ bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHandle
return false;
}
-void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rFrame, const Reference< XDispatchProvider >& rDispatchProvider, const OUString& rModuleIdentifier, bool bDelete, bool bDeleteChildren )
+void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rFrame,
+ const Reference< XDispatchProvider >& rDispatchProvider,
+ const OUString& rModuleIdentifier, bool bDelete, bool bDeleteChildren )
{
m_xFrame = rFrame;
m_bActive = false;
@@ -1289,7 +1293,9 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
AddonMenu* pSubMenu = dynamic_cast< AddonMenu* >( pPopup.get() );
if ( pSubMenu )
{
- MenuBarManager* pSubMenuManager = new MenuBarManager( m_xContext, m_xFrame, m_xURLTransformer,pSubMenu, true, false, false );
+ MenuBarManager* pSubMenuManager = new MenuBarManager( m_xContext, m_xFrame,
+ m_xURLTransformer,pSubMenu, true,
+ false, false );
AddMenu(pSubMenuManager,aItemCommand,nItemId);
(pSubMenuManager->m_aMenuItemCommand).clear();
@@ -1304,7 +1310,10 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
}
else
{
- MenuBarManager* pSubMenuMgr = new MenuBarManager( m_xContext, rFrame, m_xURLTransformer,rDispatchProvider, aModuleIdentifier, pPopup, bDeleteChildren, bDeleteChildren, m_bHasMenuBar );
+ MenuBarManager* pSubMenuMgr = new MenuBarManager( m_xContext, rFrame, m_xURLTransformer,
+ rDispatchProvider, aModuleIdentifier,
+ pPopup, bDeleteChildren, bDeleteChildren,
+ m_bHasMenuBar );
AddMenu(pSubMenuMgr,aItemCommand,nItemId);
}
}
@@ -1603,23 +1612,23 @@ void MenuBarManager::FillMenuWithConfiguration(
}
void MenuBarManager::FillMenu(
- sal_uInt16& nId,
- Menu* pMenu,
- const OUString& rModuleIdentifier,
- const Reference< XIndexAccess >& rItemContainer,
+ sal_uInt16& nId,
+ Menu* pMenu,
+ const OUString& rModuleIdentifier,
+ const Reference< XIndexAccess >& rItemContainer,
const Reference< XDispatchProvider >& rDispatchProvider )
{
// Fill menu bar with container contents
- for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ )
+ for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ )
{
- Sequence< PropertyValue > aProp;
- OUString aCommandURL;
- OUString aLabel;
- OUString aHelpURL;
- OUString aModuleIdentifier( rModuleIdentifier );
- sal_uInt16 nType = 0;
- Reference< XIndexAccess > xIndexContainer;
- Reference< XDispatchProvider > xDispatchProvider( rDispatchProvider );
+ Sequence< PropertyValue > aProp;
+ OUString aCommandURL;
+ OUString aLabel;
+ OUString aHelpURL;
+ OUString aModuleIdentifier( rModuleIdentifier );
+ sal_uInt16 nType = 0;
+ Reference< XIndexAccess > xIndexContainer;
+ Reference< XDispatchProvider > xDispatchProvider( rDispatchProvider );
sal_Int16 nStyle = 0;
try
{
@@ -1902,7 +1911,8 @@ sal_uInt16 MenuBarManager::FillItemCommand(OUString& _rItemCommand, Menu* _pMenu
}
return nItemId;
}
-void MenuBarManager::Init(const Reference< XFrame >& rFrame,Menu* pAddonMenu,bool bDelete,bool bDeleteChildren,bool _bHandlePopUp)
+void MenuBarManager::Init(const Reference< XFrame >& rFrame, Menu* pAddonMenu, bool bDelete,
+ bool bDeleteChildren, bool _bHandlePopUp)
{
m_bActive = false;
m_bDeleteMenu = bDelete;
@@ -1929,7 +1939,10 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,Menu* pAddonMenu,boo
if ( pPopupMenu )
{
Reference< XDispatchProvider > xDispatchProvider;
- MenuBarManager* pSubMenuManager = new MenuBarManager( m_xContext, rFrame, m_xURLTransformer,xDispatchProvider, aModuleIdentifier, pPopupMenu, !_bHandlePopUp && bDeleteChildren, !_bHandlePopUp && bDeleteChildren );
+ MenuBarManager* pSubMenuManager = new MenuBarManager( m_xContext, rFrame, m_xURLTransformer,
+ xDispatchProvider, aModuleIdentifier, pPopupMenu,
+ !_bHandlePopUp && bDeleteChildren,
+ !_bHandlePopUp && bDeleteChildren );
Reference< XStatusListener > xSubMenuManager( static_cast< OWeakObject *>( pSubMenuManager ), UNO_QUERY );
@@ -1951,7 +1964,8 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,Menu* pAddonMenu,boo
if ( pAddonAttributes )
{
- // read additional attributes from attributes struct and AddonMenu implementation will delete all attributes itself!!
+ // read additional attributes from attributes struct and AddonMenu implementation
+ // will delete all attributes itself!!
pMenuItemHandler->aTargetFrame = pAddonAttributes->aTargetFrame;
}
@@ -2063,7 +2077,7 @@ void MenuBarManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XComp
void MenuBarManager::FillMenuImages(Reference< XFrame >& _xFrame, Menu* _pMenu,bool bShowMenuImages)
{
- AddonsOptions aAddonOptions;
+ AddonsOptions aAddonOptions;
for ( sal_uInt16 nPos = 0; nPos < _pMenu->GetItemCount(); nPos++ )
{
commit ac20f98e498439b188a69e590336fc7cd6866b38
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Thu Oct 13 21:45:26 2016 +0200
Don't add experimental commands to the Menu
Change-Id: I76b1c745d4c4d99f3a0a8d7573f1beae99503ef9
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index feb5e71..77e484d 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1653,6 +1653,12 @@ void MenuBarManager::FillMenu(
aProp[i].Value >>= bEnabled;
}
+ if (vcl::CommandInfoProvider::Instance().IsExperimental(aCommandURL, rModuleIdentifier) &&
+ !SvtMiscOptions().IsExperimentalMode())
+ {
+ continue;
+ }
+
if ( nType == css::ui::ItemType::DEFAULT )
{
pMenu->InsertItem( nId, aLabel );
commit 1a848fb9b55eb1748ef902c8ec71a6576294aed5
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Thu Oct 13 21:23:08 2016 +0200
Don't add experimental commands to the Toolbar
Change-Id: I1c1eb33f938bf8d6acac13dfe0a2119a4967e2a1
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 7942d94..76e4d15 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -1025,6 +1025,12 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
aProp[i].Value >>= nStyle;
}
+ if (vcl::CommandInfoProvider::Instance().IsExperimental(aCommandURL, m_aModuleIdentifier) &&
+ !SvtMiscOptions().IsExperimentalMode())
+ {
+ continue;
+ }
+
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
{
OUString aString(vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommandURL, m_xFrame));
commit 0cd2250b7c3e0cfed297590f0cb07dab4c8df1d4
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Thu Oct 13 21:20:36 2016 +0200
Add IsExperimental method to CommandInfoProvider
Change-Id: I827ae6db25a1df9f25b58ca122e39dc9cb4b0652
diff --git a/include/vcl/commandinfoprovider.hxx b/include/vcl/commandinfoprovider.hxx
index 4f76dbe..b15873f 100644
--- a/include/vcl/commandinfoprovider.hxx
+++ b/include/vcl/commandinfoprovider.hxx
@@ -101,6 +101,11 @@ public:
bool IsRotated(const OUString& rsCommandName);
bool IsMirrored(const OUString& rsCommandName);
+ /** Returns whether the command is experimental. */
+ bool IsExperimental(
+ const OUString& rsCommandName,
+ const OUString& rModuleName);
+
/** Do not call. Should be part of a local and hidden interface.
*/
void SetFrame (const css::uno::Reference<css::frame::XFrame>& rxFrame);
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index 3b0cc18..6cd7bb1 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -300,6 +300,36 @@ bool CommandInfoProvider::IsMirrored(const OUString& rsCommandName)
return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName);
}
+bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName,
+ const OUString& rModuleName)
+{
+ Sequence<beans::PropertyValue> aProperties;
+ try
+ {
+ if( rModuleName.getLength() > 0)
+ {
+ Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);
+ Reference<container::XNameAccess> xUICommandLabels;
+ if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels )
+ xUICommandLabels->getByName(rsCommandName) >>= aProperties;
+
+ for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
+ {
+ if (aProperties[nIndex].Name == "IsExperimental")
+ {
+ sal_Int32 nValue;
+ aProperties[nIndex].Value >>= nValue;
+ return nValue == 1;
+ }
+ }
+ }
+ }
+ catch (Exception&)
+ {
+ }
+ return false;
+}
+
void CommandInfoProvider::SetFrame (const Reference<frame::XFrame>& rxFrame)
{
if (rxFrame != mxCachedDataFrame)
commit 08d7ffcd442c5f02b4ceb068d308a26b04e41d29
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Thu Oct 13 21:08:07 2016 +0200
Mark Notebookbar and ToolbarMode as experimental
Change-Id: I5c1e440e754419bbebcd594b1d9fcfcf7712860e
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 17701c2..9f8a648 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -4134,6 +4134,9 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Notebookbar</value>
</prop>
+ <prop oor:name="IsExperimental" oor:type="xs:int">
+ <value xml:lang="en-US">1</value>
+ </prop>
</node>
<node oor:name=".uno:Sidebar" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
@@ -5884,6 +5887,9 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Toolbar Layout</value>
</prop>
+ <prop oor:name="IsExperimental" oor:type="xs:int">
+ <value>1</value>
+ </prop>
</node>
<node oor:name=".uno:AvailableToolbars" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
commit d9f8ea556cddfce334ce96046b93ab69d96e6c30
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Thu Oct 13 21:06:11 2016 +0200
Add experimental flag for Commands
Such marked commands should only be available when experimental features are active
Change-Id: I4ef922f0261adc193d46ba287073d67910222f51
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index 63fd3e9..d4244c9 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -56,6 +56,7 @@ static const char CONFIGURATION_PROPERTY_CONTEXT_LABEL[] = "ContextLabel";
static const char CONFIGURATION_PROPERTY_POPUP_LABEL[] = "PopupLabel";
static const char CONFIGURATION_PROPERTY_TOOLTIP_LABEL[] = "TooltipLabel";
static const char CONFIGURATION_PROPERTY_TARGET_URL[] = "TargetURL";
+static const char CONFIGURATION_PROPERTY_IS_EXPERIMENTAL[] = "IsExperimental";
// Property names of the resulting Property Set
static const char PROPSET_LABEL[] = "Label";
@@ -64,6 +65,7 @@ static const char PROPSET_POPUP[] = "Popup";
static const char PROPSET_POPUPLABEL[] = "PopupLabel";
static const char PROPSET_TOOLTIPLABEL[] = "TooltipLabel";
static const char PROPSET_TARGETURL[] = "TargetURL";
+static const char PROPSET_IS_EXPERIMENTAL[] = "IsExperimental";
static const char PROPSET_PROPERTIES[] = "Properties";
// Special resource URLs to retrieve additional information
@@ -118,7 +120,8 @@ class ConfigurationAccess_UICommand : // Order is necessary for right initializa
{
CmdToInfoMap() : bPopup( false ),
bCommandNameCreated( false ),
- nProperties( 0 ) {}
+ nProperties( 0 ),
+ nIsExperimental(0) {}
OUString aLabel;
OUString aContextLabel;
@@ -128,6 +131,7 @@ class ConfigurationAccess_UICommand : // Order is necessary for right initializa
OUString aTargetURL;
bool bPopup : 1,
bCommandNameCreated : 1;
+ sal_Int32 nIsExperimental;
sal_Int32 nProperties;
};
@@ -156,12 +160,14 @@ class ConfigurationAccess_UICommand : // Order is necessary for right initializa
OUString m_aPropUIPopupLabel;
OUString m_aPropUITooltipLabel;
OUString m_aPropUITargetURL;
+ OUString m_aPropUIIsExperimental;
OUString m_aPropLabel;
OUString m_aPropName;
OUString m_aPropPopup;
OUString m_aPropPopupLabel;
OUString m_aPropTooltipLabel;
OUString m_aPropTargetURL;
+ OUString m_aPropIsExperimental;
OUString m_aPropProperties;
OUString m_aPrivateResourceURL;
Reference< XNameAccess > m_xGenericUICommands;
@@ -189,12 +195,14 @@ ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const OUString& aM
m_aPropUIPopupLabel( CONFIGURATION_PROPERTY_POPUP_LABEL ),
m_aPropUITooltipLabel( CONFIGURATION_PROPERTY_TOOLTIP_LABEL ),
m_aPropUITargetURL( CONFIGURATION_PROPERTY_TARGET_URL ),
+ m_aPropUIIsExperimental( CONFIGURATION_PROPERTY_IS_EXPERIMENTAL ),
m_aPropLabel( PROPSET_LABEL ),
m_aPropName( PROPSET_NAME ),
m_aPropPopup( PROPSET_POPUP ),
m_aPropPopupLabel( PROPSET_POPUPLABEL ),
m_aPropTooltipLabel( PROPSET_TOOLTIPLABEL ),
m_aPropTargetURL( PROPSET_TARGETURL ),
+ m_aPropIsExperimental( PROPSET_IS_EXPERIMENTAL ),
m_aPropProperties( PROPSET_PROPERTIES ),
m_aPrivateResourceURL( PRIVATE_RESOURCE_URL ),
m_xGenericUICommands( rGenericUICommands ),
@@ -313,7 +321,7 @@ Any ConfigurationAccess_UICommand::getSequenceFromCache( const OUString& aComman
if ( !pIter->second.bCommandNameCreated )
fillInfoFromResult( pIter->second, pIter->second.aLabel );
- Sequence< PropertyValue > aPropSeq( 7 );
+ Sequence< PropertyValue > aPropSeq( 8 );
aPropSeq[0].Name = m_aPropLabel;
aPropSeq[0].Value = !pIter->second.aContextLabel.isEmpty() ?
makeAny( pIter->second.aContextLabel ): makeAny( pIter->second.aLabel );
@@ -329,6 +337,8 @@ Any ConfigurationAccess_UICommand::getSequenceFromCache( const OUString& aComman
aPropSeq[5].Value <<= pIter->second.aTooltipLabel;
aPropSeq[6].Name = m_aPropTargetURL;
aPropSeq[6].Value <<= pIter->second.aTargetURL;
+ aPropSeq[7].Name = m_aPropIsExperimental;
+ aPropSeq[7].Value <<= pIter->second.nIsExperimental;
return makeAny( aPropSeq );
}
@@ -358,6 +368,7 @@ void ConfigurationAccess_UICommand::impl_fill(const Reference< XNameAccess >& _x
xNameAccess->getByName( m_aPropUIPopupLabel ) >>= aCmdToInfo.aPopupLabel;
xNameAccess->getByName( m_aPropUITooltipLabel ) >>= aCmdToInfo.aTooltipLabel;
xNameAccess->getByName( m_aPropUITargetURL ) >>= aCmdToInfo.aTargetURL;
+ xNameAccess->getByName( m_aPropUIIsExperimental ) >>= aCmdToInfo.nIsExperimental;
xNameAccess->getByName( m_aPropProperties ) >>= aCmdToInfo.nProperties;
m_aCmdInfoCache.insert( CommandToInfoCache::value_type( aNameSeq[i], aCmdToInfo ));
diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs
index 678bea7..6ff9c43 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs
@@ -51,6 +51,11 @@
<desc>The actual command to use for everything except label/icon, typically when the main command doesn't map to a valid application slot.</desc>
</info>
</prop>
+ <prop oor:name="IsExperimental" oor:type="xs:int" oor:localized="false">
+ <info>
+ <desc>If set to '1', this command is available only when Experimental features are activated.</desc>
+ </info>
+ </prop>
<prop oor:name="Properties" oor:type="xs:int" oor:nillable="false">
<info>
<desc>
commit 8ce70a7e267bf45aa5eaae203ee26ad3826e91a8
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Thu Oct 13 13:41:04 2016 +0200
Remove unused toolbar:text define
Should not be used anyway since it's not translated
Change-Id: I1b571be013208e2fae679fc7c4978084067f9519
diff --git a/framework/dtd/toolbar.dtd b/framework/dtd/toolbar.dtd
index 3dbd02a..e8114bf 100644
--- a/framework/dtd/toolbar.dtd
+++ b/framework/dtd/toolbar.dtd
@@ -29,7 +29,6 @@
<!ATTLIST toolbar:toolbaritem
xlink:href CDATA #REQUIRED
toolbar:visible %boolean; "true"
- toolbar:text CDATA #IMPLIED
toolbar:style CDATA #IMPLIED
toolbar:helpid CDATA #IMPLIED
>
More information about the Libreoffice-commits
mailing list