[Libreoffice-commits] core.git: 3 commits - framework/dtd framework/inc framework/source

Maxim Monastirsky momonasmon at gmail.com
Sun Feb 5 16:31:43 UTC 2017


 framework/dtd/toolbar.dtd                           |    2 
 framework/inc/xml/toolboxconfigurationdefines.hxx   |    1 
 framework/inc/xml/toolboxdocumenthandler.hxx        |    5 --
 framework/source/fwe/xml/toolboxdocumenthandler.cxx |   48 ++++----------------
 framework/source/uielement/toolbarmanager.cxx       |   13 ++---
 5 files changed, 19 insertions(+), 50 deletions(-)

New commits:
commit 1f9b7ccd6e988b330e5d16305c27c7d6844c938b
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Fri Feb 3 13:34:44 2017 +0200

    Restore custom tooltip support
    
    This reverts the toolbarmanager.cxx part of
    38839ae10cb565ff1977b1839de1c8278eac657b ("Remove the
    ability to set tooltips in the toolbar xml files").
    
    It is true that tooltips can't be set in xml files,
    but toolbars can also be created/modified via the
    UIConfigurationManager and LayoutManager APIs,
    e.g. the test doc of i#105626 .
    
    Change-Id: Ida1559e61e7fd9bd6dcdd7b7159bc5efe070c721

diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 9542b49..2ddc5f8 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -984,6 +984,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
         Sequence< PropertyValue >   aProp;
         OUString                    aCommandURL;
         OUString                    aLabel;
+        OUString                    aTooltip;
         sal_uInt16                  nType( css::ui::ItemType::DEFAULT );
         sal_uInt32                  nStyle( 0 );
 
@@ -1035,6 +1036,8 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
                     }
                     else if ( aProp[i].Name == "Label" )
                         aProp[i].Value >>= aLabel;
+                    else if ( aProp[i].Name == "Tooltip" )
+                        aProp[i].Value >>= aTooltip;
                     else if ( aProp[i].Name == "Type" )
                         aProp[i].Value >>= nType;
                     else if ( aProp[i].Name == ITEM_DESCRIPTOR_VISIBLE )
@@ -1061,9 +1064,10 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
                     }
                     m_pToolBar->InsertItem( nId, aString, nItemBits );
                     m_pToolBar->SetItemCommand( nId, aCommandURL );
-                    OUString sTooltip = vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommandURL, m_xFrame);
-                    if (!sTooltip.isEmpty())
-                        m_pToolBar->SetQuickHelpText( nId, sTooltip );
+                    if ( !aTooltip.isEmpty() )
+                        m_pToolBar->SetQuickHelpText( nId, aTooltip );
+                    else
+                        m_pToolBar->SetQuickHelpText( nId, vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommandURL, m_xFrame) );
 
                     if ( !aLabel.isEmpty() )
                     {
commit 47e84338e47c5a9c4cea6962b084aab6b2be94a4
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Fri Feb 3 13:15:30 2017 +0200

    Revert "Remove unused toolbar:text define"
    
    This reverts commit 8ce70a7e267bf45aa5eaae203ee26ad3826e91a8.
    
    It is true that toolbar:text shouldn't be used during LO
    development, but it's still used by toolbar customization,
    and such customized XMLs should still validate against the
    dtd.
    
    Change-Id: I95227a22ecc00a27f39591163ee09a78adde3168

diff --git a/framework/dtd/toolbar.dtd b/framework/dtd/toolbar.dtd
index 3da313c..6f2c382 100644
--- a/framework/dtd/toolbar.dtd
+++ b/framework/dtd/toolbar.dtd
@@ -29,6 +29,7 @@
 <!ATTLIST toolbar:toolbaritem
 	xlink:href CDATA #REQUIRED
 	toolbar:visible %boolean; "true"
+	toolbar:text CDATA #IMPLIED
 	toolbar:style CDATA #IMPLIED
 >
 <!ELEMENT toolbar:toolbarspace EMPTY>
commit 6296abc143d322294f021feb4b578c66b238fb5e
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Fri Feb 3 13:14:52 2017 +0200

    HelpURL toolbar property is unused
    
    Change-Id: I74b22509f59899b7c15aa791a01c60c8d982221f

diff --git a/framework/dtd/toolbar.dtd b/framework/dtd/toolbar.dtd
index e8114bf..3da313c 100644
--- a/framework/dtd/toolbar.dtd
+++ b/framework/dtd/toolbar.dtd
@@ -30,7 +30,6 @@
 	xlink:href CDATA #REQUIRED
 	toolbar:visible %boolean; "true"
 	toolbar:style CDATA #IMPLIED
-	toolbar:helpid CDATA #IMPLIED
 >
 <!ELEMENT toolbar:toolbarspace EMPTY>
 <!ELEMENT toolbar:toolbarbreak EMPTY>
diff --git a/framework/inc/xml/toolboxconfigurationdefines.hxx b/framework/inc/xml/toolboxconfigurationdefines.hxx
index eb37651..505133b 100644
--- a/framework/inc/xml/toolboxconfigurationdefines.hxx
+++ b/framework/inc/xml/toolboxconfigurationdefines.hxx
@@ -37,7 +37,6 @@
 #define ATTRIBUTE_TEXT              "text"
 #define ATTRIBUTE_URL               "href"
 #define ATTRIBUTE_VISIBLE           "visible"
-#define ATTRIBUTE_HELPID            "helpid"
 #define ATTRIBUTE_ITEMSTYLE         "style"
 
 #define ELEMENT_NS_TOOLBAR          "toolbar:toolbar"
diff --git a/framework/inc/xml/toolboxdocumenthandler.hxx b/framework/inc/xml/toolboxdocumenthandler.hxx
index 4b6a468..a6e64294 100644
--- a/framework/inc/xml/toolboxdocumenthandler.hxx
+++ b/framework/inc/xml/toolboxdocumenthandler.hxx
@@ -48,7 +48,6 @@ class FWE_DLLPUBLIC OReadToolBoxDocumentHandler :
             TB_ATTRIBUTE_TEXT,
             TB_ATTRIBUTE_URL,
             TB_ATTRIBUTE_VISIBLE,
-            TB_ATTRIBUTE_HELPID,
             TB_ATTRIBUTE_STYLE,
             TB_ATTRIBUTE_UINAME,
             TB_XML_ENTRY_COUNT
@@ -114,7 +113,6 @@ class FWE_DLLPUBLIC OReadToolBoxDocumentHandler :
         OUString                                                  m_aType;
         OUString                                                  m_aLabel;
         OUString                                                  m_aStyle;
-        OUString                                                  m_aHelpURL;
         OUString                                                  m_aIsVisible;
         OUString                                                  m_aCommandURL;
 };
@@ -134,8 +132,7 @@ class FWE_DLLPUBLIC OWriteToolBoxDocumentHandler final
     private:
         /// @throws css::xml::sax::SAXException
         /// @throws css::uno::RuntimeException
-        void WriteToolBoxItem( const OUString& aCommandURL, const OUString& aLabel, const OUString& aHelpURL,
-                               sal_Int16 nStyle, bool bVisible );
+        void WriteToolBoxItem( const OUString& aCommandURL, const OUString& aLabel, sal_Int16 nStyle, bool bVisible );
 
         /// @throws css::xml::sax::SAXException
         /// @throws css::uno::RuntimeException
diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
index fad320b..c9d95f3 100644
--- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
@@ -35,6 +35,7 @@
 #include <rtl/ustrbuf.hxx>
 
 #include <comphelper/attributelist.hxx>
+#include <comphelper/propertysequence.hxx>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
@@ -48,7 +49,6 @@ namespace framework
 
 // Property names of a menu/menu item ItemDescriptor
 static const char ITEM_DESCRIPTOR_COMMANDURL[]  = "CommandURL";
-static const char ITEM_DESCRIPTOR_HELPURL[]     = "HelpURL";
 static const char ITEM_DESCRIPTOR_LABEL[]       = "Label";
 static const char ITEM_DESCRIPTOR_TYPE[]        = "Type";
 static const char ITEM_DESCRIPTOR_STYLE[]       = "Style";
@@ -57,7 +57,6 @@ static const char ITEM_DESCRIPTOR_VISIBLE[]     = "IsVisible";
 static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp,
                                       OUString&                        rCommandURL,
                                       OUString&                        rLabel,
-                                      OUString&                        rHelpURL,
                                       sal_Int16&                       rStyle,
                                       bool&                            rVisible,
                                       sal_Int16&                       rType )
@@ -69,8 +68,6 @@ static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp,
             rProp[i].Value >>= rCommandURL;
             rCommandURL = rCommandURL.intern();
         }
-        else if ( rProp[i].Name == ITEM_DESCRIPTOR_HELPURL )
-            rProp[i].Value >>= rHelpURL;
         else if ( rProp[i].Name == ITEM_DESCRIPTOR_LABEL )
             rProp[i].Value >>= rLabel;
         else if ( rProp[i].Name == ITEM_DESCRIPTOR_TYPE )
@@ -117,7 +114,6 @@ ToolBarEntryProperty const ToolBoxEntries[OReadToolBoxDocumentHandler::TB_XML_EN
     { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR,   ATTRIBUTE_TEXT              },
     { OReadToolBoxDocumentHandler::TB_NS_XLINK,     ATTRIBUTE_URL               },
     { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR,   ATTRIBUTE_VISIBLE           },
-    { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR,   ATTRIBUTE_HELPID            },
     { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR,   ATTRIBUTE_ITEMSTYLE         },
     { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR,   ATTRIBUTE_UINAME            },
 };
@@ -127,7 +123,6 @@ OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XInde
     m_aType( ITEM_DESCRIPTOR_TYPE ),
     m_aLabel( ITEM_DESCRIPTOR_LABEL ),
     m_aStyle( ITEM_DESCRIPTOR_STYLE ),
-    m_aHelpURL( ITEM_DESCRIPTOR_HELPURL ),
     m_aIsVisible( ITEM_DESCRIPTOR_VISIBLE ),
     m_aCommandURL( ITEM_DESCRIPTOR_COMMANDURL )
  {
@@ -275,7 +270,6 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
                 m_bToolBarItemStartFound = true;
                 OUString        aLabel;
                 OUString        aCommandURL;
-                OUString        aHelpURL;
                 sal_uInt16      nItemBits( 0 );
                 bool            bVisible( true );
 
@@ -314,12 +308,6 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
                             }
                             break;
 
-                            case TB_ATTRIBUTE_HELPID:
-                            {
-                                aHelpURL = xAttribs->getValueByIndex( n );
-                            }
-                            break;
-
                             case TB_ATTRIBUTE_STYLE:
                             {
                                 // read space separated item style list
@@ -369,14 +357,6 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
 
                 if ( !aCommandURL.isEmpty() )
                 {
-                    Sequence< PropertyValue > aToolbarItemProp( 6 );
-                    aToolbarItemProp[0].Name = m_aCommandURL;
-                    aToolbarItemProp[1].Name = m_aHelpURL;
-                    aToolbarItemProp[2].Name = m_aLabel;
-                    aToolbarItemProp[3].Name = m_aType;
-                    aToolbarItemProp[4].Name = m_aStyle;
-                    aToolbarItemProp[5].Name = m_aIsVisible;
-
                     //fix for fdo#39370
                     /// check whether RTL interface or not
                     if(AllSettings::GetLayoutRTL()){
@@ -394,12 +374,13 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
                             aCommandURL = ".uno:AlignLeft";
                     }
 
-                    aToolbarItemProp[0].Value <<= aCommandURL;
-                    aToolbarItemProp[1].Value <<= aHelpURL;
-                    aToolbarItemProp[2].Value <<= aLabel;
-                    aToolbarItemProp[3].Value = makeAny( css::ui::ItemType::DEFAULT );
-                    aToolbarItemProp[4].Value <<= nItemBits;
-                    aToolbarItemProp[5].Value <<= bVisible;
+                    auto aToolbarItemProp( comphelper::InitPropertySequence( {
+                        { m_aCommandURL, css::uno::makeAny( aCommandURL ) },
+                        { m_aLabel, css::uno::makeAny( aLabel ) },
+                        { m_aType, css::uno::makeAny( css::ui::ItemType::DEFAULT ) },
+                        { m_aStyle, css::uno::makeAny( nItemBits ) },
+                        { m_aIsVisible, css::uno::makeAny( bVisible ) },
+                    } ) );
 
                     m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
                 }
@@ -678,14 +659,13 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxDocument()
         {
             OUString    aCommandURL;
             OUString    aLabel;
-            OUString    aHelpURL;
             bool    bVisible( true );
             sal_Int16   nType( css::ui::ItemType::DEFAULT );
             sal_Int16   nStyle( 0 );
 
-            ExtractToolbarParameters( aProps, aCommandURL, aLabel, aHelpURL, nStyle, bVisible, nType );
+            ExtractToolbarParameters( aProps, aCommandURL, aLabel, nStyle, bVisible, nType );
             if ( nType == css::ui::ItemType::DEFAULT )
-                WriteToolBoxItem( aCommandURL, aLabel, aHelpURL, nStyle, bVisible );
+                WriteToolBoxItem( aCommandURL, aLabel, nStyle, bVisible );
             else if ( nType == css::ui::ItemType::SEPARATOR_SPACE )
                 WriteToolBoxSpace();
             else if ( nType == css::ui::ItemType::SEPARATOR_LINE )
@@ -706,7 +686,6 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxDocument()
 void OWriteToolBoxDocumentHandler::WriteToolBoxItem(
     const OUString& rCommandURL,
     const OUString& rLabel,
-    const OUString& rHelpURL,
     sal_Int16       nStyle,
     bool        bVisible )
 {
@@ -735,13 +714,6 @@ void OWriteToolBoxDocumentHandler::WriteToolBoxItem(
                              ATTRIBUTE_BOOLEAN_FALSE );
     }
 
-    if ( !rHelpURL.isEmpty() )
-    {
-        pList->AddAttribute( m_aXMLToolbarNS + ATTRIBUTE_HELPID,
-                             m_aAttributeType,
-                             rHelpURL );
-    }
-
     if ( nStyle > 0 )
     {
         OUString aValue;
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 1dec71d..9542b49 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -984,7 +984,6 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
         Sequence< PropertyValue >   aProp;
         OUString                    aCommandURL;
         OUString                    aLabel;
-        OUString                    aHelpURL;
         sal_uInt16                  nType( css::ui::ItemType::DEFAULT );
         sal_uInt32                  nStyle( 0 );
 
@@ -1034,8 +1033,6 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
                             }
                         }
                     }
-                    else if ( aProp[i].Name == "HelpURL" )
-                        aProp[i].Value >>= aHelpURL;
                     else if ( aProp[i].Name == "Label" )
                         aProp[i].Value >>= aLabel;
                     else if ( aProp[i].Name == "Type" )


More information about the Libreoffice-commits mailing list