[Libreoffice-commits] core.git: 2 commits - include/sfx2 sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk

Caolán McNamara caolanm at redhat.com
Fri Aug 15 05:53:30 PDT 2014


 include/sfx2/tabdlg.hxx         |    6 
 sfx2/UIConfig_sfx.mk            |    1 
 sfx2/source/appl/app.hrc        |    2 
 sfx2/source/appl/newhelp.cxx    |  284 ++++++++++++++++------------------------
 sfx2/source/appl/newhelp.hrc    |   15 --
 sfx2/source/appl/newhelp.hxx    |   20 +-
 sfx2/source/appl/newhelp.src    |   50 -------
 sfx2/source/dialog/tabdlg.cxx   |   69 +--------
 sfx2/source/inc/helpid.hrc      |    2 
 sfx2/uiconfig/ui/helpcontrol.ui |  106 ++++++++++++++
 10 files changed, 249 insertions(+), 306 deletions(-)

New commits:
commit 9fbb4c6cf42857e80090e0b81ecde7ea2913e427
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 15 12:02:37 2014 +0100

    convert WIN_HELPINDEX sport to .ui
    
    Change-Id: I80d1f3f3cb4e062bc19489205e325bc4ff17b3c6

diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index 0713047..5142f92 100644
--- a/sfx2/UIConfig_sfx.mk
+++ b/sfx2/UIConfig_sfx.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
 	sfx2/uiconfig/ui/editdurationdialog \
 	sfx2/uiconfig/ui/errorfindemaildialog \
 	sfx2/uiconfig/ui/helpbookmarkpage \
+	sfx2/uiconfig/ui/helpcontrol \
 	sfx2/uiconfig/ui/helpcontentpage \
 	sfx2/uiconfig/ui/helpindexpage \
 	sfx2/uiconfig/ui/helpsearchpage \
diff --git a/sfx2/source/appl/app.hrc b/sfx2/source/appl/app.hrc
index d0fff73..1e7ea05 100644
--- a/sfx2/source/appl/app.hrc
+++ b/sfx2/source/appl/app.hrc
@@ -41,8 +41,6 @@
 
 #define CONFIG_PATH_START               (RID_SFX_APP_START+98)
 
-#define WIN_HELPINDEX                           (RID_SFX_APP_START+99)
-
 #define MENU_HELP_BOOKMARKS                     (RID_SFX_APP_START+105)
 #define RID_INFO_NOSEARCHRESULTS                (RID_SFX_APP_START+106)
 #define RID_INFO_NOSEARCHTEXTFOUND              (RID_SFX_APP_START+107)
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 37b1a46..b3dcc26 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -93,6 +93,7 @@
 #include <svtools/miscopt.hxx>
 #include <svtools/imgdef.hxx>
 #include <vcl/builder.hxx>
+#include <vcl/layout.hxx>
 #include <vcl/unohelp.hxx>
 #include <vcl/i18nhelp.hxx>
 #include <vcl/settings.hxx>
@@ -418,7 +419,6 @@ OUString ContentListBox_Impl::GetSelectEntry() const
 }
 
 // class HelpTabPage_Impl ------------------------------------------------
-
 HelpTabPage_Impl::HelpTabPage_Impl(Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin,
     const OString& rID, const OUString& rUIXMLDescription)
     : TabPage( pParent, rID, rUIXMLDescription)
@@ -427,7 +427,6 @@ HelpTabPage_Impl::HelpTabPage_Impl(Window* pParent, SfxHelpIndexWindow_Impl* _pI
 }
 
 // class ContentTabPage_Impl ---------------------------------------------
-
 ContentTabPage_Impl::ContentTabPage_Impl(Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin)
     : HelpTabPage_Impl(pParent, _pIdxWin, "HelpContentPage",
         "sfx/ui/helpcontentpage.ui")
@@ -917,11 +916,7 @@ bool SearchResultsBox_Impl::Notify( NotifyEvent& rNEvt )
 SearchTabPage_Impl::SearchTabPage_Impl(Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin)
     : HelpTabPage_Impl(pParent, _pIdxWin, "HelpSearchPage",
         "sfx/ui/helpsearchpage.ui")
-
-    ,
-
-    xBreakIterator  ( vcl::unohelper::CreateBreakIterator() )
-
+    , xBreakIterator(vcl::unohelper::CreateBreakIterator())
 {
     get(m_pSearchED, "search");
     get(m_pSearchBtn, "find");
@@ -1397,45 +1392,39 @@ void SfxHelpWindow_Impl::loadHelpContent(const OUString& sHelpURL, bool bAddToHi
         LeaveWait();
 }
 
-SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl( SfxHelpWindow_Impl* _pParent ) :
-
-    Window( _pParent, SfxResId( WIN_HELPINDEX ) ),
-
-    aActiveLB           ( this, SfxResId( LB_ACTIVE ) ),
-    aActiveLine         ( this, SfxResId( FL_ACTIVE ) ),
-    aTabCtrl            ( this, SfxResId( TC_INDEX ) ),
-
-    aIndexKeywordLink   ( LINK( this, SfxHelpIndexWindow_Impl, KeywordHdl ) ),
-    pParentWin          ( _pParent ),
-
-    pCPage              ( NULL ),
-    pIPage              ( NULL ),
-    pSPage              ( NULL ),
-    pBPage              ( NULL ),
-
-    bWasCursorLeftOrRight( false ),
-    bIsInitDone          ( false )
-
+SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent)
+    : Window(_pParent, 0)
+    , aIndexKeywordLink(LINK(this, SfxHelpIndexWindow_Impl, KeywordHdl))
+    , pParentWin(_pParent)
+    , pCPage(NULL)
+    , pIPage(NULL)
+    , pSPage(NULL)
+    , pBPage(NULL)
+    , bWasCursorLeftOrRight(false)
+    , bIsInitDone(false)
 {
-    FreeResource();
+    m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "sfx/ui/helpcontrol.ui", "HelpControl");
+    get(m_pActiveLB, "active");
+    get(m_pTabCtrl, "tabcontrol");
 
     sfx2::AddToTaskPaneList( this );
 
-    aTabCtrl.SetActivatePageHdl( LINK( this, SfxHelpIndexWindow_Impl, ActivatePageHdl ) );
-    aTabCtrl.Show();
+    m_pTabCtrl->SetActivatePageHdl( LINK( this, SfxHelpIndexWindow_Impl, ActivatePageHdl ) );
 
-    sal_Int32 nPageId = HELP_INDEX_PAGE_INDEX;
+    sal_Int32 nPageId = m_pTabCtrl->GetPageId("index");
     SvtViewOptions aViewOpt( E_TABDIALOG, CONFIGNAME_INDEXWIN );
     if ( aViewOpt.Exists() )
         nPageId = aViewOpt.GetPageID();
-    aTabCtrl.SetCurPageId( (sal_uInt16)nPageId );
-    ActivatePageHdl( &aTabCtrl );
-    aActiveLB.SetSelectHdl( LINK( this, SfxHelpIndexWindow_Impl, SelectHdl ) );
-    nMinWidth = ( aActiveLB.GetSizePixel().Width() / 2 );
+    m_pTabCtrl->SetCurPageId( (sal_uInt16)nPageId );
+    ActivatePageHdl( m_pTabCtrl );
+    m_pActiveLB->SetSelectHdl( LINK( this, SfxHelpIndexWindow_Impl, SelectHdl ) );
+    nMinWidth = ( m_pActiveLB->GetSizePixel().Width() / 2 );
 
     aTimer.SetTimeoutHdl( LINK( this, SfxHelpIndexWindow_Impl, InitHdl ) );
     aTimer.SetTimeout( 200 );
     aTimer.Start();
+
+    Show();
 }
 
 
@@ -1449,11 +1438,11 @@ SfxHelpIndexWindow_Impl::~SfxHelpIndexWindow_Impl()
     DELETEZ( pSPage );
     DELETEZ( pBPage );
 
-    for ( sal_uInt16 i = 0; i < aActiveLB.GetEntryCount(); ++i )
-        delete (OUString*)(sal_uIntPtr)aActiveLB.GetEntryData(i);
+    for ( sal_uInt16 i = 0; i < m_pActiveLB->GetEntryCount(); ++i )
+        delete (OUString*)(sal_uIntPtr)m_pActiveLB->GetEntryData(i);
 
     SvtViewOptions aViewOpt( E_TABDIALOG, CONFIGNAME_INDEXWIN );
-    aViewOpt.SetPageID( (sal_Int32)aTabCtrl.GetCurPageId() );
+    aViewOpt.SetPageID( (sal_Int32)m_pTabCtrl->GetCurPageId() );
 }
 
 
@@ -1471,12 +1460,12 @@ void SfxHelpIndexWindow_Impl::Initialize()
         nIdx = 0;
         OUString aURL = rRow.getToken( 2, '\t', nIdx );
         OUString* pFactory = new OUString( INetURLObject( aURL ).GetHost() );
-        sal_uInt16 nPos = aActiveLB.InsertEntry( aTitle );
-        aActiveLB.SetEntryData( nPos, pFactory );
+        sal_uInt16 nPos = m_pActiveLB->InsertEntry( aTitle );
+        m_pActiveLB->SetEntryData( nPos, pFactory );
     }
 
-    aActiveLB.SetDropDownLineCount( (sal_uInt16)aFactories.size() );
-    if ( aActiveLB.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
+    m_pActiveLB->SetDropDownLineCount( (sal_uInt16)aFactories.size() );
+    if ( m_pActiveLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
         SetActiveFactory();
 }
 
@@ -1485,21 +1474,21 @@ void SfxHelpIndexWindow_Impl::Initialize()
 void SfxHelpIndexWindow_Impl::SetActiveFactory()
 {
     DBG_ASSERT( pIPage, "index page not initialized" );
-    if ( !bIsInitDone && !aActiveLB.GetEntryCount() )
+    if ( !bIsInitDone && !m_pActiveLB->GetEntryCount() )
     {
         aTimer.Stop();
         InitHdl( NULL );
     }
 
-    for ( sal_uInt16 i = 0; i < aActiveLB.GetEntryCount(); ++i )
+    for ( sal_uInt16 i = 0; i < m_pActiveLB->GetEntryCount(); ++i )
     {
-        OUString* pFactory = (OUString*)(sal_uIntPtr)aActiveLB.GetEntryData(i);
+        OUString* pFactory = (OUString*)(sal_uIntPtr)m_pActiveLB->GetEntryData(i);
         *pFactory = pFactory->toAsciiLowerCase();
         if ( *pFactory == pIPage->GetFactory() )
         {
-            if ( aActiveLB.GetSelectEntryPos() != i )
+            if ( m_pActiveLB->GetSelectEntryPos() != i )
             {
-                aActiveLB.SelectEntryPos(i);
+                m_pActiveLB->SelectEntryPos(i);
                 aSelectFactoryLink.Call( NULL );
             }
             break;
@@ -1511,42 +1500,32 @@ void SfxHelpIndexWindow_Impl::SetActiveFactory()
 
 HelpTabPage_Impl* SfxHelpIndexWindow_Impl::GetCurrentPage( sal_uInt16& rCurId )
 {
-    rCurId = aTabCtrl.GetCurPageId();
+    rCurId = m_pTabCtrl->GetCurPageId();
     HelpTabPage_Impl* pPage = NULL;
 
-    switch ( rCurId )
-    {
-        case HELP_INDEX_PAGE_CONTENTS:
-        {
-            pPage = GetContentPage();
-            break;
-        }
-
-        case HELP_INDEX_PAGE_INDEX:
-        {
-            pPage = GetIndexPage();
-            break;
-        }
-
-        case HELP_INDEX_PAGE_SEARCH:
-        {
-            pPage = GetSearchPage();
-            break;
-        }
+    OString sName(m_pTabCtrl->GetPageName(rCurId));
 
-        case HELP_INDEX_PAGE_BOOKMARKS:
-        {
-            pPage = GetBookmarksPage();
-            break;
-        }
+    if (sName == "contents")
+    {
+        pPage = GetContentPage();
+    }
+    else if (sName == "index")
+    {
+        pPage = GetIndexPage();
+    }
+    else if (sName == "find")
+    {
+        pPage = GetSearchPage();
+    }
+    else if (sName == "bookmarks")
+    {
+        pPage = GetBookmarksPage();
     }
 
     DBG_ASSERT( pPage, "SfxHelpIndexWindow_Impl::GetCurrentPage(): no current page" );
     return pPage;
 }
 
-
-
 IMPL_LINK( SfxHelpIndexWindow_Impl, ActivatePageHdl, TabControl *, pTabCtrl )
 {
     sal_uInt16 nId = 0;
@@ -1555,8 +1534,6 @@ IMPL_LINK( SfxHelpIndexWindow_Impl, ActivatePageHdl, TabControl *, pTabCtrl )
     return 0;
 }
 
-
-
 IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, SelectHdl)
 {
     aTimer.Start();
@@ -1564,8 +1541,6 @@ IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, SelectHdl)
     return 0;
 }
 
-
-
 IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, InitHdl)
 {
     bIsInitDone = true;
@@ -1578,11 +1553,9 @@ IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, InitHdl)
     return 0;
 }
 
-
-
 IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, SelectFactoryHdl)
 {
-    OUString* pFactory = (OUString*)(sal_uIntPtr)aActiveLB.GetEntryData( aActiveLB.GetSelectEntryPos() );
+    OUString* pFactory = (OUString*)(sal_uIntPtr)m_pActiveLB->GetEntryData( m_pActiveLB->GetSelectEntryPos() );
     if ( pFactory )
     {
         SetFactory( OUString( *pFactory ).toAsciiLowerCase(), false );
@@ -1592,8 +1565,6 @@ IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, SelectFactoryHdl)
     return 0;
 }
 
-
-
 IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, KeywordHdl)
 {
     // keyword found on index?
@@ -1602,11 +1573,11 @@ IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, KeywordHdl)
     if( !bIndex)
         bIndex = pIPage->HasKeywordIgnoreCase();
     // then set index or search page as current.
-    sal_uInt16 nPageId = ( bIndex ) ? HELP_INDEX_PAGE_INDEX :  HELP_INDEX_PAGE_SEARCH;
-    if ( nPageId != aTabCtrl.GetCurPageId() )
+    sal_uInt16 nPageId = ( bIndex ) ? m_pTabCtrl->GetPageId("index") : m_pTabCtrl->GetPageId("find");
+    if ( nPageId != m_pTabCtrl->GetCurPageId() )
     {
-        aTabCtrl.SetCurPageId( nPageId );
-        ActivatePageHdl( &aTabCtrl );
+        m_pTabCtrl->SetCurPageId( nPageId );
+        ActivatePageHdl( m_pTabCtrl );
     }
 
     // at last we open the keyword
@@ -1618,32 +1589,23 @@ IMPL_LINK_NOARG(SfxHelpIndexWindow_Impl, KeywordHdl)
     return 0;
 }
 
-
-
 void SfxHelpIndexWindow_Impl::Resize()
 {
-    Size aSize = GetOutputSizePixel();
-    if ( aSize.Width() < nMinWidth )
-        aSize.Width() = nMinWidth;
-
-    Point aPnt = aActiveLB.GetPosPixel();
-    Size aNewSize = aActiveLB.GetSizePixel();
-    aNewSize.Width() = aSize.Width() - ( aPnt.X() * 2 );
-    aActiveLB.SetSizePixel( aNewSize );
-    aPnt = aActiveLine.GetPosPixel();
-    aNewSize = aActiveLine.GetSizePixel();
-    aNewSize.Width() = aSize.Width() - ( aPnt.X() * 2 );
-    aActiveLine.SetSizePixel( aNewSize );
-    aPnt = aTabCtrl.GetPosPixel();
-    aNewSize = aSize;
-    aSize.Width() -= aPnt.X();
-    aSize.Height() -= aPnt.Y();
-    aTabCtrl.SetSizePixel( aSize );
+    Window *pChild = GetWindow(WINDOW_FIRSTCHILD);
+    if (!pChild)
+        return;
+    VclContainer::setLayoutAllocation(*pChild, Point(0,0), GetSizePixel());
 }
 
+Size SfxHelpIndexWindow_Impl::GetOptimalSize() const
+{
+    const Window *pChild = GetWindow(WINDOW_FIRSTCHILD);
+    if (!pChild)
+        return Window::GetOptimalSize();
+    return VclContainer::getLayoutRequisition(*pChild);
+}
 
-
-bool SfxHelpIndexWindow_Impl::PreNotify( NotifyEvent& rNEvt )
+bool SfxHelpIndexWindow_Impl::PreNotify(NotifyEvent& rNEvt)
 {
     bool nDone = false;
     sal_uInt16 nType = rNEvt.GetType();
@@ -1660,29 +1622,32 @@ bool SfxHelpIndexWindow_Impl::PreNotify( NotifyEvent& rNEvt )
             Control* pControl = pCurPage->GetLastFocusControl();
             bool bShift = rKeyCode.IsShift();
             bool bCtrl = rKeyCode.IsMod1();
-            if ( !bCtrl && bShift && aActiveLB.HasChildPathFocus() )
+            if ( !bCtrl && bShift && m_pActiveLB->HasChildPathFocus() )
             {
                 pControl->GrabFocus();
                 nDone = true;
             }
             else if ( !bCtrl && !bShift && pControl->HasChildPathFocus() )
             {
-                aActiveLB.GrabFocus();
+                m_pActiveLB->GrabFocus();
                 nDone = true;
             }
             else if ( bCtrl )
             {
+                sal_uInt16 nPagePos = m_pTabCtrl->GetPagePos(nPageId);
+                sal_uInt16 nPageCount = m_pTabCtrl->GetPageCount();
+
+                ++nPageId;
                 // <CTRL><TAB> moves through the pages
-                if ( nPageId < HELP_INDEX_PAGE_LAST )
-                    nPageId++;
-                else
-                    nPageId = HELP_INDEX_PAGE_FIRST;
-                aTabCtrl.SetCurPageId( (sal_uInt16)nPageId );
-                ActivatePageHdl( &aTabCtrl );
+                if (nPagePos >= nPageCount)
+                    nPagePos = 0;
+
+                m_pTabCtrl->SetCurPageId(m_pTabCtrl->GetPageId(nPagePos));
+                ActivatePageHdl( m_pTabCtrl );
                 nDone = true;
             }
          }
-        else if ( aTabCtrl.HasFocus() && ( KEY_LEFT == nCode || KEY_RIGHT == nCode ) )
+        else if ( m_pTabCtrl->HasFocus() && ( KEY_LEFT == nCode || KEY_RIGHT == nCode ) )
         {
             bWasCursorLeftOrRight = true;
         }
@@ -1735,36 +1700,32 @@ void SfxHelpIndexWindow_Impl::SetFactory( const OUString& rFactory, bool bActive
     }
 }
 
-
-
 OUString SfxHelpIndexWindow_Impl::GetSelectEntry() const
 {
     OUString sRet;
 
-    switch ( aTabCtrl.GetCurPageId() )
-    {
-        case HELP_INDEX_PAGE_CONTENTS:
-            sRet = pCPage->GetSelectEntry();
-            break;
-
-        case HELP_INDEX_PAGE_INDEX:
-            sRet = pIPage->GetSelectEntry();
-            break;
+    OString sName(m_pTabCtrl->GetPageName(m_pTabCtrl->GetCurPageId()));
 
-        case HELP_INDEX_PAGE_SEARCH:
-            sRet = pSPage->GetSelectEntry();
-            break;
-
-        case HELP_INDEX_PAGE_BOOKMARKS:
-            sRet = pBPage->GetSelectEntry();
-            break;
+    if (sName == "contents")
+    {
+        sRet = pCPage->GetSelectEntry();
+    }
+    else if (sName == "index")
+    {
+        sRet = pIPage->GetSelectEntry();
+    }
+    else if (sName == "find")
+    {
+        sRet = pSPage->GetSelectEntry();
+    }
+    else if (sName == "bookmarks")
+    {
+        sRet = pBPage->GetSelectEntry();
     }
 
     return sRet;
 }
 
-
-
 void SfxHelpIndexWindow_Impl::AddBookmarks( const OUString& rTitle, const OUString& rURL )
 {
     GetBookmarksPage()->AddBookmarks( rTitle, rURL );
@@ -1775,9 +1736,9 @@ void SfxHelpIndexWindow_Impl::AddBookmarks( const OUString& rTitle, const OUStri
 bool SfxHelpIndexWindow_Impl::IsValidFactory( const OUString& _rFactory )
 {
     bool bValid = false;
-    for ( sal_uInt16 i = 0; i < aActiveLB.GetEntryCount(); ++i )
+    for ( sal_uInt16 i = 0; i < m_pActiveLB->GetEntryCount(); ++i )
     {
-        OUString* pFactory = (OUString*)(sal_uIntPtr)aActiveLB.GetEntryData(i);
+        OUString* pFactory = (OUString*)(sal_uIntPtr)m_pActiveLB->GetEntryData(i);
         if ( *pFactory == _rFactory )
         {
             bValid = true;
@@ -1795,54 +1756,50 @@ void SfxHelpIndexWindow_Impl::ClearSearchPage()
         pSPage->ClearPage();
 }
 
-
-
 void SfxHelpIndexWindow_Impl::GrabFocusBack()
 {
-    if ( aTabCtrl.GetCurPageId() == HELP_INDEX_PAGE_CONTENTS && pCPage )
+    OString sName(m_pTabCtrl->GetPageName(m_pTabCtrl->GetCurPageId()));
+
+    if (sName == "contents" && pCPage)
         pCPage->SetFocusOnBox();
-    else if ( aTabCtrl.GetCurPageId() == HELP_INDEX_PAGE_INDEX && pIPage )
+    else if (sName == "index" && pIPage)
         pIPage->SetFocusOnBox();
-    else if ( aTabCtrl.GetCurPageId() == HELP_INDEX_PAGE_SEARCH && pSPage )
+    else if (sName == "find" && pSPage)
         pSPage->SetFocusOnBox();
-    else if ( aTabCtrl.GetCurPageId() == HELP_INDEX_PAGE_BOOKMARKS && pBPage )
+    else if (sName == "bookmarks" && pBPage)
         pBPage->SetFocusOnBox();
 }
 
-
-
 bool SfxHelpIndexWindow_Impl::HasFocusOnEdit() const
 {
     bool bRet = false;
-    if ( aTabCtrl.GetCurPageId() == HELP_INDEX_PAGE_INDEX && pIPage )
+    OString sName(m_pTabCtrl->GetPageName(m_pTabCtrl->GetCurPageId()));
+    if (sName == "index" && pIPage)
         bRet = pIPage->HasFocusOnEdit();
-    else if ( aTabCtrl.GetCurPageId() == HELP_INDEX_PAGE_SEARCH && pSPage )
+    else if (sName == "find" && pSPage)
         bRet = pSPage->HasFocusOnEdit();
     return bRet;
 }
 
 
-
 OUString SfxHelpIndexWindow_Impl::GetSearchText() const
 {
     OUString sRet;
-    if ( aTabCtrl.GetCurPageId() == HELP_INDEX_PAGE_SEARCH && pSPage )
+    OString sName(m_pTabCtrl->GetPageName(m_pTabCtrl->GetCurPageId()));
+    if (sName == "find" && pSPage)
         sRet = pSPage->GetSearchText();
     return sRet;
 }
 
-
-
 bool SfxHelpIndexWindow_Impl::IsFullWordSearch() const
 {
     bool bRet = false;
-    if ( aTabCtrl.GetCurPageId() == HELP_INDEX_PAGE_SEARCH && pSPage )
+    OString sName(m_pTabCtrl->GetPageName(m_pTabCtrl->GetCurPageId()));
+    if (sName == "find" && pSPage)
         bRet = pSPage->IsFullWordSearch();
     return bRet;
 }
 
-
-
 void SfxHelpIndexWindow_Impl::OpenKeyword( const OUString& rKeyword )
 {
     sKeyword = rKeyword;
@@ -1850,11 +1807,10 @@ void SfxHelpIndexWindow_Impl::OpenKeyword( const OUString& rKeyword )
     pIPage->SetKeyword( sKeyword );
 }
 
-
-
 void SfxHelpIndexWindow_Impl::SelectExecutableEntry()
 {
-    if ( aTabCtrl.GetCurPageId() == HELP_INDEX_PAGE_INDEX && pIPage )
+    OString sName(m_pTabCtrl->GetPageName(m_pTabCtrl->GetCurPageId()));
+    if (sName == "index" && pIPage )
         pIPage->SelectExecutableEntry();
 }
 
@@ -2722,17 +2678,16 @@ void SfxHelpWindow_Impl::MakeLayout()
 {
     if ( nHeight > 0 && xWindow.is() )
     {
-           Window* pScreenWin = VCLUnoHelper::GetWindow( xWindow );
+        Window* pScreenWin = VCLUnoHelper::GetWindow(xWindow);
 
         /* #i55528#
-            Hide() / Show() will produce starnge effects.
+            Hide() / Show() will produce strange effects.
             The returned size (used later to be written back into the configuration)
             isnt the right after a resize during the window is hidden.
             If this resize is done if the window is visible evyrthing works as aspected.
             Some VCL-patches could not solve this problem so I've established the
             workaround: resize the help window if it's visible .-)
         */
-
         ::com::sun::star::awt::Rectangle aRect = xWindow->getPosSize();
         sal_Int32 nOldWidth = bIndex ? nCollapseWidth : nExpandWidth;
         sal_Int32 nWidth = bIndex ? nExpandWidth : nCollapseWidth;
@@ -3037,6 +2992,7 @@ SfxHelpWindow_Impl::SfxHelpWindow_Impl(
     pIndexWin = new SfxHelpIndexWindow_Impl( this );
     pIndexWin->SetDoubleClickHdl( LINK( this, SfxHelpWindow_Impl, OpenHdl ) );
     pIndexWin->SetSelectFactoryHdl( LINK( this, SfxHelpWindow_Impl, SelectFactoryHdl ) );
+    pIndexWin->SetSizePixel(LogicToPixel(Size(120, 200), MAP_APPFONT));
     pIndexWin->Show();
     pTextWin = new SfxHelpTextWindow_Impl( this );
     Reference < XFrames > xFrames = rFrame->getFrames();
@@ -3061,8 +3017,6 @@ SfxHelpWindow_Impl::~SfxHelpWindow_Impl()
     delete pTextWin;
 }
 
-
-
 bool SfxHelpWindow_Impl::PreNotify( NotifyEvent& rNEvt )
 {
     bool bHandled = false;
@@ -3087,16 +3041,12 @@ bool SfxHelpWindow_Impl::PreNotify( NotifyEvent& rNEvt )
     return bHandled || Window::PreNotify( rNEvt );
 }
 
-
-
 void SfxHelpWindow_Impl::setContainerWindow( Reference < ::com::sun::star::awt::XWindow > xWin )
 {
     xWindow = xWin;
     MakeLayout();
 }
 
-
-
 void SfxHelpWindow_Impl::SetFactory( const OUString& rFactory )
 {
     pIndexWin->SetFactory( rFactory, true );
diff --git a/sfx2/source/appl/newhelp.hrc b/sfx2/source/appl/newhelp.hrc
index 6b3ab14..6cafd49 100644
--- a/sfx2/source/appl/newhelp.hrc
+++ b/sfx2/source/appl/newhelp.hrc
@@ -19,21 +19,6 @@
 #ifndef _SFX_NEWHELP_HRC
 #define _SFX_NEWHELP_HRC
 
-// #defines *****************************************************************
-
-// Index Window
-#define LB_ACTIVE                               10
-#define FL_ACTIVE                               11
-#define TC_INDEX                                12
-
-// Index Window: Id's of the tabpages
-#define HELP_INDEX_PAGE_FIRST                   1
-#define HELP_INDEX_PAGE_CONTENTS                HELP_INDEX_PAGE_FIRST
-#define HELP_INDEX_PAGE_INDEX                   2
-#define HELP_INDEX_PAGE_SEARCH                  3
-#define HELP_INDEX_PAGE_BOOKMARKS               4
-#define HELP_INDEX_PAGE_LAST                    HELP_INDEX_PAGE_BOOKMARKS
-
 // context menu ids
 #define MID_OPEN                                1
 #define MID_RENAME                              2
diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx
index 4766522..53bb10c 100644
--- a/sfx2/source/appl/newhelp.hxx
+++ b/sfx2/source/appl/newhelp.hxx
@@ -268,13 +268,12 @@ public:
 
 class SfxHelpWindow_Impl;
 
-class SfxHelpIndexWindow_Impl : public Window
+class SfxHelpIndexWindow_Impl : public Window, public VclBuilderContainer
 {
 private:
-    ListBox             aActiveLB;
-    FixedLine           aActiveLine;
+    ListBox*            m_pActiveLB;
+    TabControl*         m_pTabCtrl;
 
-    TabControl          aTabCtrl;
     Timer               aTimer;
 
     Link                aSelectFactoryLink;
@@ -313,6 +312,7 @@ public:
     virtual ~SfxHelpIndexWindow_Impl();
 
     virtual void        Resize() SAL_OVERRIDE;
+    virtual Size        GetOptimalSize() const SAL_OVERRIDE;
     virtual bool        PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     virtual void        DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
 
@@ -323,8 +323,8 @@ public:
     OUString            GetSelectEntry() const;
     void                AddBookmarks( const OUString& rTitle, const OUString& rURL );
     bool                IsValidFactory( const OUString& _rFactory );
-    inline OUString     GetActiveFactoryTitle() const { return aActiveLB.GetSelectEntry(); }
-    inline void         UpdateTabControl() { aTabCtrl.Invalidate(); }
+    inline OUString     GetActiveFactoryTitle() const { return m_pActiveLB->GetSelectEntry(); }
+    inline void         UpdateTabControl() { m_pTabCtrl->Invalidate(); }
     void                ClearSearchPage();
     void                GrabFocusBack();
     bool            HasFocusOnEdit() const;
@@ -341,7 +341,7 @@ ContentTabPage_Impl* SfxHelpIndexWindow_Impl::GetContentPage()
 {
     if ( !pCPage )
     {
-        pCPage = new ContentTabPage_Impl( &aTabCtrl, this );
+        pCPage = new ContentTabPage_Impl( m_pTabCtrl, this );
         pCPage->SetOpenHdl( aPageDoubleClickLink );
     }
     return pCPage;
@@ -350,7 +350,7 @@ IndexTabPage_Impl* SfxHelpIndexWindow_Impl::GetIndexPage()
 {
     if ( !pIPage )
     {
-        pIPage = new IndexTabPage_Impl( &aTabCtrl, this );
+        pIPage = new IndexTabPage_Impl( m_pTabCtrl, this );
         pIPage->SetDoubleClickHdl( aPageDoubleClickLink );
         pIPage->SetKeywordHdl( aIndexKeywordLink );
     }
@@ -361,7 +361,7 @@ SearchTabPage_Impl* SfxHelpIndexWindow_Impl::GetSearchPage()
 {
     if ( !pSPage )
     {
-        pSPage = new SearchTabPage_Impl( &aTabCtrl, this );
+        pSPage = new SearchTabPage_Impl( m_pTabCtrl, this );
         pSPage->SetDoubleClickHdl( aPageDoubleClickLink );
     }
     return pSPage;
@@ -371,7 +371,7 @@ BookmarksTabPage_Impl* SfxHelpIndexWindow_Impl::GetBookmarksPage()
 {
     if ( !pBPage )
     {
-        pBPage = new BookmarksTabPage_Impl( &aTabCtrl, this );
+        pBPage = new BookmarksTabPage_Impl( m_pTabCtrl, this );
         pBPage->SetDoubleClickHdl( aPageDoubleClickLink );
     }
     return pBPage;
diff --git a/sfx2/source/appl/newhelp.src b/sfx2/source/appl/newhelp.src
index 00d86ef..96b8d41 100644
--- a/sfx2/source/appl/newhelp.src
+++ b/sfx2/source/appl/newhelp.src
@@ -21,56 +21,6 @@
 #include "newhelp.hrc"
 #include "helpid.hrc"
 
-Window WIN_HELPINDEX
-{
-    Hide = TRUE ;
-    Size = MAP_APPFONT ( 120 , 200 ) ;
-    DialogControl = TRUE;
-    ListBox LB_ACTIVE
-    {
-        HelpId = HID_HELP_LISTBOX;
-        Border = TRUE ;
-        DropDown = TRUE;
-        Pos = MAP_APPFONT ( 3 , 3 ) ;
-        Size = MAP_APPFONT ( 114 , 40 ) ;
-    };
-    FixedLine FL_ACTIVE
-    {
-        Hide = True;
-        Pos = MAP_APPFONT ( 2, 19 ) ;
-        Size = MAP_APPFONT ( 118 , 1 ) ;
-    };
-    TabControl TC_INDEX
-    {
-        HelpId = HID_HELP_TABCONTROL;
-        Pos = MAP_APPFONT ( 3, 19 ) ;
-        TabStop = TRUE;
-        PageList =
-        {
-            PageItem
-            {
-                Identifier = HELP_INDEX_PAGE_CONTENTS ;
-                Text [ en-US ] = "Contents";
-            };
-            PageItem
-            {
-                Identifier = HELP_INDEX_PAGE_INDEX ;
-                Text [ en-US ] = "Index";
-            };
-            PageItem
-            {
-                Identifier = HELP_INDEX_PAGE_SEARCH ;
-                Text [ en-US ] = "Find";
-            };
-            PageItem
-            {
-                Identifier = HELP_INDEX_PAGE_BOOKMARKS ;
-                Text [ en-US ] = "Bookmarks";
-            };
-        };
-    };
-};
-
 #define MASKCOLOR_MAGENTA \
     MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
 
diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc
index d3d32fb..89d395e 100644
--- a/sfx2/source/inc/helpid.hrc
+++ b/sfx2/source/inc/helpid.hrc
@@ -39,8 +39,6 @@
 #define HID_STYLIST_EDIT                                      "SFX2_HID_STYLIST_EDIT"
 #define HID_STYLIST_DELETE                                    "SFX2_HID_STYLIST_DELETE"
 #define HID_HELP_WINDOW                                       "SFX2_HID_HELP_WINDOW"
-#define HID_HELP_LISTBOX                                      "SFX2_HID_HELP_LISTBOX"
-#define HID_HELP_TABCONTROL                                   "SFX2_HID_HELP_TABCONTROL"
 #define HID_HELP_TOOLBOX                                      "SFX2_HID_HELP_TOOLBOX"
 #define HID_HELP_TOOLBOXITEM_INDEX                            "SFX2_HID_HELP_TOOLBOXITEM_INDEX"
 #define HID_HELP_TOOLBOXITEM_START                            "SFX2_HID_HELP_TOOLBOXITEM_START"
diff --git a/sfx2/uiconfig/ui/helpcontrol.ui b/sfx2/uiconfig/ui/helpcontrol.ui
new file mode 100644
index 0000000..50a3818
--- /dev/null
+++ b/sfx2/uiconfig/ui/helpcontrol.ui
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface>
+  <requires lib="gtk+" version="3.0"/>
+  <object class="GtkBox" id="HelpControl">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <child>
+      <object class="GtkBox" id="box1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="border_width">0</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkComboBoxText" id="active">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkNotebook" id="tabcontrol">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="contents">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Contents</property>
+              </object>
+              <packing>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="index">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Index</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="find">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Find</property>
+              </object>
+              <packing>
+                <property name="position">2</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="bookmarks">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Bookmarks</property>
+              </object>
+              <packing>
+                <property name="position">3</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
commit 5df98e8bc54953fb69492ba46f880f174af4d04e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 15 12:21:19 2014 +0100

    last two args to Init_Impl are now always NULL
    
    so follow through on the logical consequnces of that
    
    Change-Id: I97981acecdcee03e4c1f32d1f4ec8ad623299042

diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index ffc9358..45acb9b 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -76,11 +76,7 @@ friend class SfxTabDialogController;
     PushButton* m_pResetBtn;
     PushButton* m_pBaseFmtBtn;
 
-    bool m_bOwnsVBox;
-    bool m_bOwnsTabCtrl;
-    bool m_bOwnsActionArea;
     bool m_bOwnsOKBtn;
-    bool m_bOwnsApplyBtn;
     bool m_bOwnsUserBtn;
     bool m_bOwnsCancelBtn;
     bool m_bOwnsHelpBtn;
@@ -102,7 +98,7 @@ friend class SfxTabDialogController;
     DECL_DLLPRIVATE_LINK(BaseFmtHdl, void *);
     DECL_DLLPRIVATE_LINK(UserHdl, void *);
     DECL_DLLPRIVATE_LINK(CancelHdl, void *);
-    SAL_DLLPRIVATE void Init_Impl(bool bFmtFlag, const OUString* pUserButtonText, const ResId* pResId);
+    SAL_DLLPRIVATE void Init_Impl(bool bFmtFlag);
 
 protected:
     virtual short               Ok();
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 5abd6f6..f44c425 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -359,7 +359,7 @@ SfxTabDialog::SfxTabDialog
     , bStandardPushed(false)
     , pExampleSet(0)
 {
-    Init_Impl(bEditFmt, NULL, NULL);
+    Init_Impl(bEditFmt);
 }
 
 
@@ -388,7 +388,7 @@ SfxTabDialog::SfxTabDialog
     , bStandardPushed(false)
     , pExampleSet(0)
 {
-    Init_Impl(bEditFmt, NULL, NULL);
+    Init_Impl(bEditFmt);
     DBG_WARNING( "Please use the Construtor with the ViewFrame" );
 }
 
@@ -442,90 +442,51 @@ SfxTabDialog::~SfxTabDialog()
         delete m_pHelpBtn;
     if (m_bOwnsCancelBtn)
         delete m_pCancelBtn;
-    if (m_bOwnsUserBtn)
-        delete m_pUserBtn;
-    if (m_bOwnsApplyBtn)
-        delete m_pApplyBtn;
     if (m_bOwnsOKBtn)
         delete m_pOKBtn;
-    if (m_bOwnsActionArea)
-        delete m_pActionArea;
-    if (m_bOwnsTabCtrl)
-        delete m_pTabCtrl;
-    if (m_bOwnsVBox)
-        delete m_pBox;
 }
 
-
-
-void SfxTabDialog::Init_Impl(bool bFmtFlag, const OUString* pUserButtonText, const ResId *pResId)
-
+void SfxTabDialog::Init_Impl(bool bFmtFlag)
 /*  [Description]
 
     internal initialization of the dialogue
 */
-
 {
     m_pBox = get_content_area();
-    m_bOwnsVBox = m_pBox == NULL;
-    if (m_bOwnsVBox)
-    {
-        m_pBox = new VclVBox(this, false, 7);
-        m_pBox->set_expand(true);
-        set_content_area(m_pBox);
-    }
-
-    m_pTabCtrl = m_pUIBuilder ? m_pUIBuilder->get<TabControl>("tabcontrol") : NULL;
-    m_bOwnsTabCtrl = m_pTabCtrl == NULL;
-    if (m_bOwnsTabCtrl)
-    {
-        m_pTabCtrl = new TabControl(m_pBox, ResId(ID_TABCONTROL, *pResId->GetResMgr()));
-        m_pTabCtrl->set_expand(true);
-    }
+    assert(m_pBox);
+    m_pUIBuilder->get(m_pTabCtrl, "tabcontrol");
+    assert(m_pTabCtrl);
 
     pImpl = new TabDlg_Impl(m_pTabCtrl->GetPageCount());
 
     m_pActionArea = get_action_area();
-    m_bOwnsActionArea = m_pActionArea == NULL;
-    if (m_bOwnsActionArea)
-    {
-        m_pActionArea = new VclHButtonBox(m_pBox);
-        set_action_area(m_pActionArea);
-    }
+    assert(m_pActionArea);
 
-    m_pOKBtn = m_pUIBuilder ? m_pUIBuilder->get<PushButton>("ok") : NULL;
+    m_pUIBuilder->get(m_pOKBtn, "ok");
     m_bOwnsOKBtn = m_pOKBtn == NULL;
     if (m_bOwnsOKBtn)
         m_pOKBtn = new OKButton(m_pActionArea);
 
-    m_pApplyBtn = m_pUIBuilder ? m_pUIBuilder->get<PushButton>("apply") : NULL;
-    m_bOwnsApplyBtn = m_pApplyBtn == NULL;
-    if (m_bOwnsApplyBtn)
-        m_pApplyBtn = NULL;
-
-    m_pUserBtn = m_pUIBuilder ? m_pUIBuilder->get<PushButton>("user") : NULL;
-    m_bOwnsUserBtn = m_pUserBtn == NULL;
-    if (m_bOwnsUserBtn)
-        m_pUserBtn = pUserButtonText ? new PushButton(m_pActionArea) : NULL;
-
-    m_pCancelBtn = m_pUIBuilder ? m_pUIBuilder->get<CancelButton>("cancel") : NULL;
+    m_pUIBuilder->get(m_pApplyBtn, "apply");
+    m_pUIBuilder->get(m_pUserBtn, "user");
+    m_pUIBuilder->get(m_pCancelBtn, "cancel");
     m_bOwnsCancelBtn = m_pCancelBtn == NULL;
     if (m_bOwnsCancelBtn)
         m_pCancelBtn = new CancelButton(m_pActionArea);
 
-    m_pHelpBtn = m_pUIBuilder ? m_pUIBuilder->get<HelpButton>("help") : NULL;
+    m_pUIBuilder->get(m_pHelpBtn, "help");
     m_bOwnsHelpBtn = m_pHelpBtn == NULL;
     if (m_bOwnsHelpBtn)
         m_pHelpBtn = new HelpButton(m_pActionArea);
 
-    m_pResetBtn = m_pUIBuilder ? m_pUIBuilder->get<PushButton>("reset") : NULL;
+    m_pUIBuilder->get(m_pResetBtn, "reset");
     m_bOwnsResetBtn = m_pResetBtn == NULL;
     if (m_bOwnsResetBtn)
         m_pResetBtn = new PushButton(m_pActionArea);
     else
         pImpl->bHideResetBtn = !m_pResetBtn->IsVisible();
 
-    m_pBaseFmtBtn = m_pUIBuilder ? m_pUIBuilder->get<PushButton>("standard") : NULL;
+    m_pUIBuilder->get(m_pBaseFmtBtn, "standard");
     m_bOwnsBaseFmtBtn = m_pBaseFmtBtn == NULL;
     if (m_bOwnsBaseFmtBtn)
         m_pBaseFmtBtn = new PushButton(m_pActionArea);
@@ -549,8 +510,6 @@ void SfxTabDialog::Init_Impl(bool bFmtFlag, const OUString* pUserButtonText, con
 
     if ( m_pUserBtn )
     {
-        if (pUserButtonText)
-            m_pUserBtn->SetText(*pUserButtonText);
         m_pUserBtn->SetClickHdl( LINK( this, SfxTabDialog, UserHdl ) );
         m_pUserBtn->Show();
     }


More information about the Libreoffice-commits mailing list