diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-03-05 09:51:43 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-05 10:26:20 +0000 |
commit | 8c766085a045710a1fc761fe57026e60a6ccdba3 (patch) | |
tree | c46cf9628b77342a775a5b070cb0ca28296b7742 /sfx2 | |
parent | 76ccdee026b7166904f3f9ec04340c70e6132ae0 (diff) |
convert help bookmarks tabpage to .ui
Change-Id: I2bfbb2aa53729be1c12ccc3ca3dd8644aa4d5410
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/UIConfig_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/source/appl/app.hrc | 1 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.cxx | 108 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.hxx | 14 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.src | 29 | ||||
-rw-r--r-- | sfx2/source/inc/helpid.hrc | 1 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/helpbookmarkpage.ui | 74 |
7 files changed, 120 insertions, 108 deletions
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk index d3e53de2072e..614071b39619 100644 --- a/sfx2/UIConfig_sfx.mk +++ b/sfx2/UIConfig_sfx.mk @@ -22,6 +22,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\ sfx2/uiconfig/ui/documentpropertiesdialog \ sfx2/uiconfig/ui/editdurationdialog \ sfx2/uiconfig/ui/errorfindemaildialog \ + sfx2/uiconfig/ui/helpbookmarkpage \ sfx2/uiconfig/ui/inputdialog \ sfx2/uiconfig/ui/licensedialog \ sfx2/uiconfig/ui/managestylepage \ diff --git a/sfx2/source/appl/app.hrc b/sfx2/source/appl/app.hrc index 84050c0b832a..e6c1adca233d 100644 --- a/sfx2/source/appl/app.hrc +++ b/sfx2/source/appl/app.hrc @@ -45,7 +45,6 @@ #define TP_HELP_CONTENT (RID_SFX_APP_START+100) #define TP_HELP_INDEX (RID_SFX_APP_START+101) #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 RID_INFO_NOSEARCHRESULTS (RID_SFX_APP_START+106) diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 664302cbcdbc..0b1f653d1d26 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -92,6 +92,7 @@ #include <svtools/imagemgr.hxx> #include <svtools/miscopt.hxx> #include <svtools/imgdef.hxx> +#include <vcl/builder.hxx> #include <vcl/unohelp.hxx> #include <vcl/i18nhelp.hxx> #include <vcl/settings.hxx> @@ -414,13 +415,17 @@ OUString ContentListBox_Impl::GetSelectEntry() const // class HelpTabPage_Impl ------------------------------------------------ -HelpTabPage_Impl::HelpTabPage_Impl( - Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin, const ResId& rResId ) : - - TabPage( pParent, rResId ), - - m_pIdxWin( _pIdxWin ) +HelpTabPage_Impl::HelpTabPage_Impl(Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin, + const ResId& rResId ) + : TabPage( pParent, rResId ) + , 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, const ResId& rResId ) : - - ListBox( pParent, rResId ) - +BookmarksBox_Impl::BookmarksBox_Impl(Window* pParent, WinBits nStyle) + : ListBox(pParent, nStyle) { } - +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() { @@ -1345,20 +1356,17 @@ bool BookmarksBox_Impl::Notify( NotifyEvent& rNEvt ) // class BookmarksTabPage_Impl ------------------------------------------- -BookmarksTabPage_Impl::BookmarksTabPage_Impl( Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin ) : - - HelpTabPage_Impl( pParent, _pIdxWin, SfxResId( TP_HELP_BOOKMARKS ) ), - - aBookmarksFT ( this, SfxResId( FT_BOOKMARKS ) ), - aBookmarksBox ( this, SfxResId( LB_BOOKMARKS ) ), - aBookmarksPB ( this, SfxResId( PB_BOOKMARKS ) ) - +BookmarksTabPage_Impl::BookmarksTabPage_Impl(Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin) + : HelpTabPage_Impl(pParent, _pIdxWin, "HelpBookmarkPage", + "sfx/ui/helpbookmarkpage.ui") { - FreeResource(); - - nMinWidth = aBookmarksPB.GetSizePixel().Width(); + 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()); - aBookmarksPB.SetClickHdl( LINK( this, BookmarksTabPage_Impl, OpenHdl ) ); + m_pBookmarksPB->SetClickHdl( LINK( this, BookmarksTabPage_Impl, OpenHdl ) ); // load bookmarks from configuration Sequence< Sequence< PropertyValue > > aBookmarkSeq; @@ -1379,68 +1387,30 @@ BookmarksTabPage_Impl::BookmarksTabPage_Impl( Window* pParent, SfxHelpIndexWindo IMPL_LINK_NOARG(BookmarksTabPage_Impl, OpenHdl) { - aBookmarksBox.GetDoubleClickHdl().Call( &aBookmarksBox ); + m_pBookmarksBox->GetDoubleClickHdl().Call(m_pBookmarksBox); 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() { if ( !m_pIdxWin->WasCursorLeftOrRight() ) SetFocusOnBox(); } - - Control* BookmarksTabPage_Impl::GetLastFocusControl() { - return &aBookmarksPB; + return m_pBookmarksPB; } - - void BookmarksTabPage_Impl::SetDoubleClickHdl( const Link& rLink ) { - aBookmarksBox.SetDoubleClickHdl( rLink ); + m_pBookmarksBox->SetDoubleClickHdl(rLink); } - - OUString BookmarksTabPage_Impl::GetSelectEntry() const { OUString aRet; - OUString* pData = (OUString*)(sal_uIntPtr)aBookmarksBox.GetEntryData( aBookmarksBox.GetSelectEntryPos() ); + OUString* pData = (OUString*)(sal_uIntPtr)m_pBookmarksBox->GetEntryData(m_pBookmarksBox->GetSelectEntryPos()); if ( pData ) aRet = *pData; return aRet; @@ -1452,8 +1422,8 @@ void BookmarksTabPage_Impl::AddBookmarks( const OUString& rTitle, const OUString { OUString aImageURL = IMAGE_URL; aImageURL += INetURLObject( rURL ).GetHost(); - sal_uInt16 nPos = aBookmarksBox.InsertEntry( rTitle, SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) ); - aBookmarksBox.SetEntryData( nPos, new OUString( rURL ) ); + sal_uInt16 nPos = m_pBookmarksBox->InsertEntry( rTitle, SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) ); + m_pBookmarksBox->SetEntryData( nPos, new OUString( rURL ) ); } OUString SfxHelpWindow_Impl::buildHelpURL(const OUString& sFactory , diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx index 07866549247f..0feff967a084 100644 --- a/sfx2/source/appl/newhelp.hxx +++ b/sfx2/source/appl/newhelp.hxx @@ -79,6 +79,8 @@ protected: public: 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; }; @@ -238,7 +240,7 @@ private: void DoAction( sal_uInt16 nAction ); public: - BookmarksBox_Impl( Window* pParent, const ResId& rResId ); + BookmarksBox_Impl(Window* pParent, WinBits nStyle); ~BookmarksBox_Impl(); virtual bool Notify( NotifyEvent& rNEvt ); @@ -247,25 +249,21 @@ public: class BookmarksTabPage_Impl : public HelpTabPage_Impl { private: - FixedText aBookmarksFT; - BookmarksBox_Impl aBookmarksBox; - PushButton aBookmarksPB; - - long nMinWidth; + BookmarksBox_Impl* m_pBookmarksBox; + PushButton* m_pBookmarksPB; DECL_LINK(OpenHdl, void *); public: BookmarksTabPage_Impl( Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin ); - virtual void Resize(); virtual void ActivatePage(); virtual Control* GetLastFocusControl(); void SetDoubleClickHdl( const Link& rLink ); OUString GetSelectEntry() const; void AddBookmarks( const OUString& rTitle, const OUString& rURL ); - inline void SetFocusOnBox() { aBookmarksBox.GrabFocus(); } + void SetFocusOnBox() { m_pBookmarksBox->GrabFocus(); } }; // class SfxHelpIndexWindow_Impl ----------------------------------------- diff --git a/sfx2/source/appl/newhelp.src b/sfx2/source/appl/newhelp.src index 9433d06ca02f..33058f38d0bc 100644 --- a/sfx2/source/appl/newhelp.src +++ b/sfx2/source/appl/newhelp.src @@ -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 { HelpId = HID_HELP_TABPAGE_CONTENTS; diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc index 24fdd84f3b5b..240acad4cf66 100644 --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -107,7 +107,6 @@ #define HID_HELP_TABPAGE_CONTENTS "SFX2_HID_HELP_TABPAGE_CONTENTS" #define HID_HELP_TABPAGE_INDEX "SFX2_HID_HELP_TABPAGE_INDEX" #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_HELP_TOOLBOXITEM_SEARCHDIALOG "SFX2_HID_HELP_TOOLBOXITEM_SEARCHDIALOG" #define HID_HELP_BOOKMARKS_OPEN "SFX2_HID_HELP_BOOKMARKS_OPEN" diff --git a/sfx2/uiconfig/ui/helpbookmarkpage.ui b/sfx2/uiconfig/ui/helpbookmarkpage.ui new file mode 100644 index 000000000000..ecd9ede08c11 --- /dev/null +++ b/sfx2/uiconfig/ui/helpbookmarkpage.ui @@ -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> |