convert help bookmarks tabpage to .ui

Change-Id: I2bfbb2aa53729be1c12ccc3ca3dd8644aa4d5410
This commit is contained in:
Caolán McNamara 2014-03-05 09:51:43 +00:00
parent 76ccdee026
commit 8c766085a0
8 changed files with 123 additions and 108 deletions

View File

@ -15,6 +15,9 @@
--> -->
<glade-catalog name="LibreOffice" domain="glade-3" depends="gtk+" version="1.0"> <glade-catalog name="LibreOffice" domain="glade-3" depends="gtk+" version="1.0">
<glade-widget-classes> <glade-widget-classes>
<glade-widget-class title="Bookmarks Box" name="sfxlo-BookmarksBox"
generic-name="BookmarksBox" parent="GtkComboBoxText"
icon-name="widget-gtk-comboboxtext"/>
<glade-widget-class title="Font PickListBox" name="smlo-SmFontPickListBox" <glade-widget-class title="Font PickListBox" name="smlo-SmFontPickListBox"
generic-name="SmFontPickListBox" parent="GtkComboBoxText" generic-name="SmFontPickListBox" parent="GtkComboBoxText"
icon-name="widget-gtk-comboboxtext"/> icon-name="widget-gtk-comboboxtext"/>

View File

@ -22,6 +22,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
sfx2/uiconfig/ui/documentpropertiesdialog \ sfx2/uiconfig/ui/documentpropertiesdialog \
sfx2/uiconfig/ui/editdurationdialog \ sfx2/uiconfig/ui/editdurationdialog \
sfx2/uiconfig/ui/errorfindemaildialog \ sfx2/uiconfig/ui/errorfindemaildialog \
sfx2/uiconfig/ui/helpbookmarkpage \
sfx2/uiconfig/ui/inputdialog \ sfx2/uiconfig/ui/inputdialog \
sfx2/uiconfig/ui/licensedialog \ sfx2/uiconfig/ui/licensedialog \
sfx2/uiconfig/ui/managestylepage \ sfx2/uiconfig/ui/managestylepage \

View File

@ -45,7 +45,6 @@
#define TP_HELP_CONTENT (RID_SFX_APP_START+100) #define TP_HELP_CONTENT (RID_SFX_APP_START+100)
#define TP_HELP_INDEX (RID_SFX_APP_START+101) #define TP_HELP_INDEX (RID_SFX_APP_START+101)
#define TP_HELP_SEARCH (RID_SFX_APP_START+102) #define TP_HELP_SEARCH (RID_SFX_APP_START+102)
#define TP_HELP_BOOKMARKS (RID_SFX_APP_START+103)
#define MENU_HELP_BOOKMARKS (RID_SFX_APP_START+105) #define MENU_HELP_BOOKMARKS (RID_SFX_APP_START+105)
#define RID_INFO_NOSEARCHRESULTS (RID_SFX_APP_START+106) #define RID_INFO_NOSEARCHRESULTS (RID_SFX_APP_START+106)

View File

@ -92,6 +92,7 @@
#include <svtools/imagemgr.hxx> #include <svtools/imagemgr.hxx>
#include <svtools/miscopt.hxx> #include <svtools/miscopt.hxx>
#include <svtools/imgdef.hxx> #include <svtools/imgdef.hxx>
#include <vcl/builder.hxx>
#include <vcl/unohelp.hxx> #include <vcl/unohelp.hxx>
#include <vcl/i18nhelp.hxx> #include <vcl/i18nhelp.hxx>
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
@ -414,13 +415,17 @@ OUString ContentListBox_Impl::GetSelectEntry() const
// class HelpTabPage_Impl ------------------------------------------------ // class HelpTabPage_Impl ------------------------------------------------
HelpTabPage_Impl::HelpTabPage_Impl( HelpTabPage_Impl::HelpTabPage_Impl(Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin,
Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin, const ResId& rResId ) : const ResId& rResId )
: TabPage( pParent, rResId )
TabPage( pParent, rResId ), , m_pIdxWin( _pIdxWin )
{
m_pIdxWin( _pIdxWin ) }
HelpTabPage_Impl::HelpTabPage_Impl(Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin,
const OString& rID, const OUString& rUIXMLDescription)
: TabPage( pParent, rID, rUIXMLDescription)
, m_pIdxWin( _pIdxWin )
{ {
} }
@ -1229,16 +1234,22 @@ void GetBookmarkEntry_Impl
} }
} }
BookmarksBox_Impl::BookmarksBox_Impl(Window* pParent, WinBits nStyle)
: ListBox(pParent, nStyle)
BookmarksBox_Impl::BookmarksBox_Impl( Window* pParent, const ResId& rResId ) :
ListBox( pParent, rResId )
{ {
} }
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeBookmarksBox(Window *pParent,
VclBuilder::stringmap &rMap)
{
WinBits nWinBits = WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE;
OString sBorder = VclBuilder::extractCustomProperty(rMap);
if (!sBorder.isEmpty())
nWinBits |= WB_BORDER;
BookmarksBox_Impl* pListBox = new BookmarksBox_Impl(pParent, nWinBits);
pListBox->EnableAutoSize(true);
return pListBox;
}
BookmarksBox_Impl::~BookmarksBox_Impl() BookmarksBox_Impl::~BookmarksBox_Impl()
{ {
@ -1345,20 +1356,17 @@ bool BookmarksBox_Impl::Notify( NotifyEvent& rNEvt )
// class BookmarksTabPage_Impl ------------------------------------------- // class BookmarksTabPage_Impl -------------------------------------------
BookmarksTabPage_Impl::BookmarksTabPage_Impl( Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin ) : BookmarksTabPage_Impl::BookmarksTabPage_Impl(Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin)
: HelpTabPage_Impl(pParent, _pIdxWin, "HelpBookmarkPage",
HelpTabPage_Impl( pParent, _pIdxWin, SfxResId( TP_HELP_BOOKMARKS ) ), "sfx/ui/helpbookmarkpage.ui")
aBookmarksFT ( this, SfxResId( FT_BOOKMARKS ) ),
aBookmarksBox ( this, SfxResId( LB_BOOKMARKS ) ),
aBookmarksPB ( this, SfxResId( PB_BOOKMARKS ) )
{ {
FreeResource(); get(m_pBookmarksPB, "display");
get(m_pBookmarksBox, "bookmarks");
Size aSize(LogicToPixel(Size(120 , 200), MAP_APPFONT));
m_pBookmarksBox->set_width_request(aSize.Width());
m_pBookmarksBox->set_height_request(aSize.Height());
nMinWidth = aBookmarksPB.GetSizePixel().Width(); m_pBookmarksPB->SetClickHdl( LINK( this, BookmarksTabPage_Impl, OpenHdl ) );
aBookmarksPB.SetClickHdl( LINK( this, BookmarksTabPage_Impl, OpenHdl ) );
// load bookmarks from configuration // load bookmarks from configuration
Sequence< Sequence< PropertyValue > > aBookmarkSeq; Sequence< Sequence< PropertyValue > > aBookmarkSeq;
@ -1379,68 +1387,30 @@ BookmarksTabPage_Impl::BookmarksTabPage_Impl( Window* pParent, SfxHelpIndexWindo
IMPL_LINK_NOARG(BookmarksTabPage_Impl, OpenHdl) IMPL_LINK_NOARG(BookmarksTabPage_Impl, OpenHdl)
{ {
aBookmarksBox.GetDoubleClickHdl().Call( &aBookmarksBox ); m_pBookmarksBox->GetDoubleClickHdl().Call(m_pBookmarksBox);
return 0; return 0;
} }
void BookmarksTabPage_Impl::Resize()
{
Size aSize = GetSizePixel();
if ( aSize.Width() < nMinWidth )
aSize.Width() = nMinWidth;
Point aPnt = aBookmarksFT.GetPosPixel();
Size aNewSize = aBookmarksFT.GetSizePixel();
aNewSize.Width() = aSize.Width() - ( aPnt.X() * 2 );
aBookmarksFT.SetSizePixel( aNewSize );
Size a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT );
Size aBtnSize = aBookmarksPB.GetSizePixel();
aPnt = aBookmarksBox.GetPosPixel();
aNewSize = aBookmarksBox.GetSizePixel();
aNewSize.Width() = aSize.Width() - ( aPnt.X() * 2 );
aNewSize.Height() = aSize.Height() - aPnt.Y();
aNewSize.Height() -= ( aBtnSize.Height() + ( a6Size.Height() * 3 / 2 ) );
aBookmarksBox.SetSizePixel( aNewSize );
aPnt.X() += ( aNewSize.Width() - aBtnSize.Width() );
aPnt.Y() += aNewSize.Height() + ( a6Size.Height() / 2 );
long nMinX = aBookmarksBox.GetPosPixel().X();
if ( aPnt.X() < nMinX )
aPnt.X() = nMinX;
aBookmarksPB.SetPosPixel( aPnt );
}
void BookmarksTabPage_Impl::ActivatePage() void BookmarksTabPage_Impl::ActivatePage()
{ {
if ( !m_pIdxWin->WasCursorLeftOrRight() ) if ( !m_pIdxWin->WasCursorLeftOrRight() )
SetFocusOnBox(); SetFocusOnBox();
} }
Control* BookmarksTabPage_Impl::GetLastFocusControl() Control* BookmarksTabPage_Impl::GetLastFocusControl()
{ {
return &aBookmarksPB; return m_pBookmarksPB;
} }
void BookmarksTabPage_Impl::SetDoubleClickHdl( const Link& rLink ) void BookmarksTabPage_Impl::SetDoubleClickHdl( const Link& rLink )
{ {
aBookmarksBox.SetDoubleClickHdl( rLink ); m_pBookmarksBox->SetDoubleClickHdl(rLink);
} }
OUString BookmarksTabPage_Impl::GetSelectEntry() const OUString BookmarksTabPage_Impl::GetSelectEntry() const
{ {
OUString aRet; OUString aRet;
OUString* pData = (OUString*)(sal_uIntPtr)aBookmarksBox.GetEntryData( aBookmarksBox.GetSelectEntryPos() ); OUString* pData = (OUString*)(sal_uIntPtr)m_pBookmarksBox->GetEntryData(m_pBookmarksBox->GetSelectEntryPos());
if ( pData ) if ( pData )
aRet = *pData; aRet = *pData;
return aRet; return aRet;
@ -1452,8 +1422,8 @@ void BookmarksTabPage_Impl::AddBookmarks( const OUString& rTitle, const OUString
{ {
OUString aImageURL = IMAGE_URL; OUString aImageURL = IMAGE_URL;
aImageURL += INetURLObject( rURL ).GetHost(); aImageURL += INetURLObject( rURL ).GetHost();
sal_uInt16 nPos = aBookmarksBox.InsertEntry( rTitle, SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) ); sal_uInt16 nPos = m_pBookmarksBox->InsertEntry( rTitle, SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) );
aBookmarksBox.SetEntryData( nPos, new OUString( rURL ) ); m_pBookmarksBox->SetEntryData( nPos, new OUString( rURL ) );
} }
OUString SfxHelpWindow_Impl::buildHelpURL(const OUString& sFactory , OUString SfxHelpWindow_Impl::buildHelpURL(const OUString& sFactory ,

View File

@ -79,6 +79,8 @@ protected:
public: public:
HelpTabPage_Impl( Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin, const ResId& rResId ); HelpTabPage_Impl( Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin, const ResId& rResId );
HelpTabPage_Impl(Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin,
const OString& rID, const OUString& rUIXMLDescription);
virtual Control* GetLastFocusControl() = 0; virtual Control* GetLastFocusControl() = 0;
}; };
@ -238,7 +240,7 @@ private:
void DoAction( sal_uInt16 nAction ); void DoAction( sal_uInt16 nAction );
public: public:
BookmarksBox_Impl( Window* pParent, const ResId& rResId ); BookmarksBox_Impl(Window* pParent, WinBits nStyle);
~BookmarksBox_Impl(); ~BookmarksBox_Impl();
virtual bool Notify( NotifyEvent& rNEvt ); virtual bool Notify( NotifyEvent& rNEvt );
@ -247,25 +249,21 @@ public:
class BookmarksTabPage_Impl : public HelpTabPage_Impl class BookmarksTabPage_Impl : public HelpTabPage_Impl
{ {
private: private:
FixedText aBookmarksFT; BookmarksBox_Impl* m_pBookmarksBox;
BookmarksBox_Impl aBookmarksBox; PushButton* m_pBookmarksPB;
PushButton aBookmarksPB;
long nMinWidth;
DECL_LINK(OpenHdl, void *); DECL_LINK(OpenHdl, void *);
public: public:
BookmarksTabPage_Impl( Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin ); BookmarksTabPage_Impl( Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin );
virtual void Resize();
virtual void ActivatePage(); virtual void ActivatePage();
virtual Control* GetLastFocusControl(); virtual Control* GetLastFocusControl();
void SetDoubleClickHdl( const Link& rLink ); void SetDoubleClickHdl( const Link& rLink );
OUString GetSelectEntry() const; OUString GetSelectEntry() const;
void AddBookmarks( const OUString& rTitle, const OUString& rURL ); void AddBookmarks( const OUString& rTitle, const OUString& rURL );
inline void SetFocusOnBox() { aBookmarksBox.GrabFocus(); } void SetFocusOnBox() { m_pBookmarksBox->GrabFocus(); }
}; };
// class SfxHelpIndexWindow_Impl ----------------------------------------- // class SfxHelpIndexWindow_Impl -----------------------------------------

View File

@ -156,35 +156,6 @@ TabPage TP_HELP_SEARCH
}; };
}; };
TabPage TP_HELP_BOOKMARKS
{
HelpId = HID_HELP_TABPAGE_BOOKMARKS;
Hide = TRUE ;
DialogControl = TRUE;
Size = MAP_APPFONT ( 120 , 200 ) ;
FixedText FT_BOOKMARKS
{
Pos = MAP_APPFONT ( 6 , 6 ) ;
Size = MAP_APPFONT ( 108 , 10 ) ;
Text [ en-US ] = "~Bookmarks" ;
};
ListBox LB_BOOKMARKS
{
HelpID = "sfx2:ListBox:TP_HELP_BOOKMARKS:LB_BOOKMARKS";
Border = TRUE ;
Sort = TRUE;
Pos = MAP_APPFONT ( 6 , 19 ) ;
Size = MAP_APPFONT ( 108 , 97 ) ;
};
PushButton PB_BOOKMARKS
{
HelpID = "sfx2:PushButton:TP_HELP_BOOKMARKS:PB_BOOKMARKS";
Pos = MAP_APPFONT ( 64 , 119 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "~Display" ;
};
};
TabPage TP_HELP_CONTENT TabPage TP_HELP_CONTENT
{ {
HelpId = HID_HELP_TABPAGE_CONTENTS; HelpId = HID_HELP_TABPAGE_CONTENTS;

View File

@ -107,7 +107,6 @@
#define HID_HELP_TABPAGE_CONTENTS "SFX2_HID_HELP_TABPAGE_CONTENTS" #define HID_HELP_TABPAGE_CONTENTS "SFX2_HID_HELP_TABPAGE_CONTENTS"
#define HID_HELP_TABPAGE_INDEX "SFX2_HID_HELP_TABPAGE_INDEX" #define HID_HELP_TABPAGE_INDEX "SFX2_HID_HELP_TABPAGE_INDEX"
#define HID_HELP_TABPAGE_SEARCH "SFX2_HID_HELP_TABPAGE_SEARCH" #define HID_HELP_TABPAGE_SEARCH "SFX2_HID_HELP_TABPAGE_SEARCH"
#define HID_HELP_TABPAGE_BOOKMARKS "SFX2_HID_HELP_TABPAGE_BOOKMARKS"
#define HID_TBXCONTROL_FILENEW "SFX2_HID_TBXCONTROL_FILENEW" #define HID_TBXCONTROL_FILENEW "SFX2_HID_TBXCONTROL_FILENEW"
#define HID_HELP_TOOLBOXITEM_SEARCHDIALOG "SFX2_HID_HELP_TOOLBOXITEM_SEARCHDIALOG" #define HID_HELP_TOOLBOXITEM_SEARCHDIALOG "SFX2_HID_HELP_TOOLBOXITEM_SEARCHDIALOG"
#define HID_HELP_BOOKMARKS_OPEN "SFX2_HID_HELP_BOOKMARKS_OPEN" #define HID_HELP_BOOKMARKS_OPEN "SFX2_HID_HELP_BOOKMARKS_OPEN"

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<interface>
<!-- interface-requires LibreOffice 1.0 -->
<requires lib="gtk+" version="3.0"/>
<object class="GtkBox" id="HelpBookmarkPage">
<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">6</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkButton" id="display">
<property name="label" translatable="yes">_Display</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Bookmarks</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">bookmarks:border</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="sfxlo-BookmarksBox" id="bookmarks:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">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>