[Libreoffice-commits] core.git: dbaccess/inc dbaccess/source include/dbaccess reportdesign/source

Gabor Kelemen kelemeng at ubuntu.com
Fri Apr 7 08:43:14 UTC 2017


 dbaccess/inc/dbaccess_helpid.hrc                   |    1 
 dbaccess/source/ui/browser/genericcontroller.cxx   |  154 ---------------------
 dbaccess/source/ui/browser/unodatbr.cxx            |    1 
 dbaccess/source/ui/inc/UITools.hxx                 |    8 -
 dbaccess/source/ui/misc/UITools.cxx                |   54 -------
 include/dbaccess/genericcontroller.hxx             |   20 --
 reportdesign/source/ui/inc/ReportController.hxx    |    1 
 reportdesign/source/ui/report/ReportController.cxx |   20 --
 8 files changed, 259 deletions(-)

New commits:
commit bc4176fa43dc8047774a11dfb5b913e6adce2252
Author: Gabor Kelemen <kelemeng at ubuntu.com>
Date:   Thu Apr 6 00:45:08 2017 +0200

    tdf#95386 More Help Agent cleanup
    
    These methods were creating and passing URLs for the
    long dead Help Agent
    
    Change-Id: I5e3eafc2ca3bf5c1ca0032b9cb19ed30c8f06e66
    Reviewed-on: https://gerrit.libreoffice.org/36172
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc
index 899e2d9497fd..db5b68a5776f 100644
--- a/dbaccess/inc/dbaccess_helpid.hrc
+++ b/dbaccess/inc/dbaccess_helpid.hrc
@@ -80,7 +80,6 @@
 #define HID_BROWSER_COLUMNINFO                            "DBACCESS_HID_BROWSER_COLUMNINFO"
 #define HID_CONFIRM_DROP_BUTTON_ALL                       "DBACCESS_HID_CONFIRM_DROP_BUTTON_ALL"
 #define HID_DSADMIN_LDAP_HOSTNAME                         "DBACCESS_HID_DSADMIN_LDAP_HOSTNAME"
-#define HID_DSBROWSER_DISCONNECTING                       "DBACCESS_HID_DSBROWSER_DISCONNECTING"
 #define HID_DSADMIN_MOZILLA_PROFILE_NAME                  "DBACCESS_HID_DSADMIN_MOZILLA_PROFILE_NAME"
 #define HID_DSADMIN_THUNDERBIRD_PROFILE_NAME              "DBACCESS_HID_DSADMIN_THUNDERBIRD_PROFILE_NAME"
 
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index a942fba97ffc..a5ec0802a2c1 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -1100,160 +1100,6 @@ void OGenericUnoController::executeChecked(const util::URL& _rCommand, const Seq
     }
 }
 
-namespace
-{
-    OUString lcl_getModuleHelpModuleName( const Reference< XFrame >& _rxFrame )
-    {
-        const sal_Char* pReturn = nullptr;
-
-        try
-        {
-            // get the model of the document in the given frame
-            Reference< XController > xController;
-            if ( _rxFrame.is() )
-                xController = _rxFrame->getController();
-            Reference< XModel > xModel;
-            if ( xController.is() )
-                xModel = xController->getModel();
-            Reference< XServiceInfo > xSI( xModel, UNO_QUERY );
-
-            if ( !xSI.is() )
-            {   // try to go up the frame hierarchy
-
-                Reference< XFrame > xParentFrame;
-                if ( _rxFrame.is() )
-                    xParentFrame.set(_rxFrame->getCreator(), css::uno::UNO_QUERY);
-                // did we find a parent frame? Which is no top-level frame?
-                if ( xParentFrame.is() && !_rxFrame->isTop() )
-                    // TODO: to prevent framework assertions, re-insert this "isTop" once 98303 is fixed
-                    return lcl_getModuleHelpModuleName( xParentFrame );
-            }
-            else
-            {
-#if OSL_DEBUG_LEVEL > 0
-                Sequence< OUString > sServiceNames = xSI->getSupportedServiceNames();
-                const OUString* pLoop = sServiceNames.getConstArray();
-                for ( sal_Int32 i=0; i<sServiceNames.getLength(); ++i, ++pLoop )
-                {
-                    sal_Int32 nDummy = 0;
-                    (void)nDummy;
-                }
-#endif
-
-                // check which service we know ....
-                static const sal_Char* pTransTable[] = {
-                    "com.sun.star.sdb.OfficeDatabaseDocument","sdatabase",
-                    "com.sun.star.report.ReportDefinition","sdatabase",
-                    "com.sun.star.text.TextDocument",   "swriter",
-                    "com.sun.star.sheet.SpreadsheetDocument", "scalc",
-                    "com.sun.star.presentation.PresentationDocument", "simpress",
-                    "com.sun.star.drawing.DrawingDocument", "sdraw",
-                    "com.sun.star.formula.FormulaProperties", "smath",
-                    "com.sun.star.chart.ChartDocument", "schart"
-                };
-                OSL_ENSURE( SAL_N_ELEMENTS( pTransTable ) % 2 == 0,
-                    "lcl_getModuleHelpModuleName: odd size of translation table!" );
-
-                // loop through the table
-                sal_Int32 nTableEntries = SAL_N_ELEMENTS( pTransTable ) / 2;
-                const sal_Char** pDocumentService = pTransTable;
-                const sal_Char** pHelpModuleName = pTransTable + 1;
-                for ( sal_Int32 j=0; j<nTableEntries; ++j )
-                {
-                    if ( xSI->supportsService( OUString::createFromAscii( *pDocumentService ) ) )
-                    {   // found a table entry which matches the model's services
-                        pReturn = *pHelpModuleName;
-                        break;
-                    }
-
-                    ++pDocumentService; ++pDocumentService;
-                    ++pHelpModuleName; ++pHelpModuleName;
-                }
-            }
-
-            if ( !pReturn )
-            {
-                // could not determine the document type we're living in
-                // ->fallback
-                SvtModuleOptions aModOpt;
-                if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ) )
-                    pReturn = "swriter";
-                else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) )
-                    pReturn = "sdatabase";
-                else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) )
-                    pReturn = "scalc";
-                else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) )
-                    pReturn = "simpress";
-                else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) )
-                    pReturn = "sdraw";
-                else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ) )
-                    pReturn = "smath";
-                else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::CHART ) )
-                    pReturn = "schart";
-                else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::EModule::BASIC ) )
-                    pReturn = "sbasic";
-                else
-                {
-                    SAL_WARN("dbaccess.ui", "lcl_getModuleHelpModuleName: no installed module found" );
-                }
-            }
-        }
-        catch( const Exception& )
-        {
-            DBG_UNHANDLED_EXCEPTION();
-        }
-
-        if ( !pReturn )
-            pReturn = "swriter";
-
-        return OUString::createFromAscii( pReturn );
-    }
-}
-
-void OGenericUnoController::openHelpAgent(OUString const& _suHelpStringURL )
-{
-    OUString suURL(_suHelpStringURL);
-    OUString sLanguage( "Language=" );
-    if (suURL.indexOf(sLanguage) == -1)
-    {
-        AppendConfigToken(suURL, false /* sal_False := add '&' */ );
-    }
-    URL aURL;
-    aURL.Complete = suURL;
-
-    openHelpAgent( aURL );
-}
-
-void OGenericUnoController::openHelpAgent(const OString& _sHelpId)
-{
-    openHelpAgent( createHelpAgentURL( lcl_getModuleHelpModuleName( getFrame() ), _sHelpId ) );
-}
-
-void OGenericUnoController::openHelpAgent( const URL& _rURL )
-{
-    try
-    {
-        URL aURL( _rURL );
-
-        if ( m_xUrlTransformer.is() )
-            m_xUrlTransformer->parseStrict(aURL);
-
-        Reference< XDispatchProvider > xDispProv( m_aCurrentFrame.getFrame(), UNO_QUERY );
-        Reference< XDispatch > xHelpDispatch;
-        if ( xDispProv.is() )
-            xHelpDispatch = xDispProv->queryDispatch(aURL, "_helpagent", FrameSearchFlag::PARENT | FrameSearchFlag::SELF);
-        OSL_ENSURE(xHelpDispatch.is(), "SbaTableQueryBrowser::openHelpAgent: could not get a dispatcher!");
-        if (xHelpDispatch.is())
-        {
-            xHelpDispatch->dispatch(aURL, Sequence< PropertyValue >());
-        }
-    }
-    catch( const Exception& )
-    {
-        DBG_UNHANDLED_EXCEPTION();
-    }
-}
-
 Reference< awt::XWindow> OGenericUnoController::getTopMostContainerWindow() const
 {
     Reference< css::awt::XWindow> xWindow;
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 2375a1a9123c..ec132f2eb4df 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -1844,7 +1844,6 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
             break;
 
         case ID_TREE_CLOSE_CONN:
-            openHelpAgent( OString( HID_DSBROWSER_DISCONNECTING ));
             closeConnection( m_pTreeView->getListBox().GetRootLevelParent( m_pTreeView->getListBox().GetCurEntry() ) );
             break;
 
diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx
index e16e8de0c0c0..c7dfd15ca7f1 100644
--- a/dbaccess/source/ui/inc/UITools.hxx
+++ b/dbaccess/source/ui/inc/UITools.hxx
@@ -278,14 +278,6 @@ namespace dbaui
                                 ,bool& _rAutoIncrementValueEnabled
                                 ,OUString& _rsAutoIncrementValue);
 
-    /** creates the URL or the help agent
-        @param  _sModuleName
-        @param  _nHelpId
-        @return
-            The URL for the help agent to dispatch.
-    */
-    css::util::URL createHelpAgentURL(const OUString& _sModuleName,const OString& _rHelpId);
-
     /** set the evaluation flag at the number formatter
         @param  _rxFormatter
     */
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 51e8f1a756b6..cbdf38c950e0 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -1100,60 +1100,6 @@ void AppendConfigToken( OUString& _rURL, bool _bQuestionMark )
     _rURL += SvtHelpOptions().GetSystem();
 }
 
-namespace
-{
-
-    bool GetHelpAnchor_Impl( const OUString& _rURL, OUString& _rAnchor )
-    {
-        bool bRet = false;
-        OUString sAnchor;
-
-        try
-        {
-            ::ucbhelper::Content aCnt( INetURLObject( _rURL ).GetMainURL( INetURLObject::DecodeMechanism::NONE ),
-                                 Reference< css::ucb::XCommandEnvironment >(),
-                                 comphelper::getProcessComponentContext() );
-            if ( ( aCnt.getPropertyValue("AnchorName") >>= sAnchor ) )
-            {
-
-                if ( !sAnchor.isEmpty() )
-                {
-                    _rAnchor = sAnchor;
-                    bRet = true;
-                }
-            }
-            else
-            {
-                SAL_WARN( "dbaccess.ui", "Property 'AnchorName' is missing" );
-            }
-        }
-        catch( Exception& )
-        {
-        }
-
-        return bRet;
-    }
-} // anonymous
-
-css::util::URL createHelpAgentURL(const OUString& _sModuleName, const OString& sHelpId)
-{
-    css::util::URL aURL;
-    aURL.Complete = "vnd.sun.star.help://" +
-        _sModuleName + "/" + OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8);
-
-    OUString sAnchor;
-    OUString sTempURL = aURL.Complete;
-    AppendConfigToken( sTempURL, true );
-    bool bHasAnchor = GetHelpAnchor_Impl( sTempURL, sAnchor );
-    AppendConfigToken(aURL.Complete,true);
-    if ( bHasAnchor )
-    {
-        aURL.Complete += "#";
-        aURL.Complete += sAnchor;
-    }
-    return aURL;
-}
-
 void setEvalDateFormatForFormatter(Reference< css::util::XNumberFormatter >& _rxFormatter)
 {
     OSL_ENSURE( _rxFormatter.is(),"setEvalDateFormatForFormatter: Formatter is NULL!");
diff --git a/include/dbaccess/genericcontroller.hxx b/include/dbaccess/genericcontroller.hxx
index 2a0514d85b6c..a23dfa8d4f70 100644
--- a/include/dbaccess/genericcontroller.hxx
+++ b/include/dbaccess/genericcontroller.hxx
@@ -291,26 +291,6 @@ namespace dbaui
         const ::comphelper::NamedValueCollection&
                                     getInitParams() const   { return m_aInitParameters; }
 
-
-        /** open the help agent for the given help id.
-            @param  _nHelpId
-                The help id to dispatch.
-        */
-        void openHelpAgent( const OString& _sHelpId );
-
-        /** open the help agent for the given help url.
-            @param  _pHelpStringURL
-                The help url to dispatch.
-        */
-        void openHelpAgent( const OUString& _suHelpStringURL );
-
-        /** opens the given Help URL in the help agent
-
-            The URL does not need to be parsed already, it is passed through
-            XURLTransformer::parseStrict before it is used.
-        */
-        void openHelpAgent( const css::util::URL& _rURL );
-
         // closes the task when possible
         void closeTask();
 
diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx
index fbe24c668cc4..46d9194fb099 100644
--- a/reportdesign/source/ui/inc/ReportController.hxx
+++ b/reportdesign/source/ui/inc/ReportController.hxx
@@ -309,7 +309,6 @@ namespace rptui
         void OnInvalidateClipboard();
         DECL_LINK( OnClipboardChanged, TransferableDataHelper*, void );
         DECL_LINK( OnExecuteReport, void*, void );
-        DECL_LINK( OnOpenHelpAgent, void*, void );
         // all the features which should be handled by this class
         virtual void            describeSupportedFeatures() override;
         // state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot.
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 138d4791b499..4ce1c6cec14c 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -1718,10 +1718,6 @@ void OReportController::impl_initialize( )
         }
 
         setModified(false);     // and we are not modified yet
-
-        // open the global help agent
-        // we need a Frame but at this time there is no frame, therefore we send a UserEvent
-        getView()->PostUserEvent(LINK(this, OReportController, OnOpenHelpAgent));
     }
     catch(const SQLException&)
     {
@@ -1740,22 +1736,6 @@ IMPL_LINK( OReportController, OnCreateHdl, OAddFieldWindow& ,_rAddFieldDlg, void
     }
 }
 
-
-IMPL_LINK_NOARG( OReportController, OnOpenHelpAgent, void*, void )
-{
-    // open the help agent of report designer at start time
-    if (getFrame().is())
-    {
-        OUString suURL("vnd.sun.star.help://shared/text/shared/explorer/database/rep_main.xhp?UseDB=no&DbPAR=swriter");
-        openHelpAgent(suURL);
-    }
-    else
-    {
-        // as long as we don't get a Frame, we send the user event again.
-        getView()->PostUserEvent(LINK(this, OReportController, OnOpenHelpAgent));
-    }
-}
-
 bool OReportController::Construct(vcl::Window* pParent)
 {
     VclPtrInstance<ODesignView> pMyOwnView( pParent, m_xContext, *this );


More information about the Libreoffice-commits mailing list