summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/control
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-08-01 17:05:28 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-08-01 22:17:46 +0200
commit57f30096080c7a9c072c551d68d2ffc20fa1e40b (patch)
treefedad97e7b5d363b0e8d09a3f6e503605ee90927 /dbaccess/source/ui/control
parentaee3aa2610971936d6f402365ebf34c14847ab44 (diff)
weld OGeneralPage and OGeneralPageWizard
Change-Id: I7caa08a5e060371c9b80ff83b141c27af09246bf Reviewed-on: https://gerrit.libreoffice.org/76817 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source/ui/control')
-rw-r--r--dbaccess/source/ui/control/opendoccontrols.cxx73
1 files changed, 18 insertions, 55 deletions
diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx
index c3c15e36070d..b94c4316a310 100644
--- a/dbaccess/source/ui/control/opendoccontrols.cxx
+++ b/dbaccess/source/ui/control/opendoccontrols.cxx
@@ -57,11 +57,10 @@ namespace dbaui
using ::com::sun::star::ui::XImageManager;
using ::com::sun::star::graphic::XGraphic;
- Image GetCommandIcon( const sal_Char* _pCommandURL, const OUString& _rModuleName )
+ Reference< XGraphic> GetCommandIcon( const sal_Char* _pCommandURL, const OUString& _rModuleName )
{
- Image aIcon;
if ( !_pCommandURL || !*_pCommandURL )
- return aIcon;
+ return nullptr;
OUString sCommandURL = OUString::createFromAscii( _pCommandURL );
try
@@ -88,27 +87,24 @@ namespace dbaui
if ( !xIconList.hasElements() )
break;
- aIcon = Image(Graphic(xIconList[0]).GetBitmapEx());
+ return xIconList[0];
}
while ( false );
}
catch ( Exception& ) {}
- return aIcon;
+ return nullptr;
}
-
}
// OpenButton
- OpenDocumentButton::OpenDocumentButton( vcl::Window* _pParent, const sal_Char* _pAsciiModuleName )
- :PushButton( _pParent )
+ OpenDocumentButton::OpenDocumentButton(std::unique_ptr<weld::Button> xControl, const sal_Char* _pAsciiModuleName)
+ : m_xControl(std::move(xControl))
{
impl_init( _pAsciiModuleName );
}
- VCL_BUILDER_FACTORY_ARGS( OpenDocumentButton, "com.sun.star.sdb.OfficeDatabaseDocument" );
-
void OpenDocumentButton::impl_init( const sal_Char* _pAsciiModuleName )
{
OSL_ENSURE( _pAsciiModuleName, "OpenDocumentButton::impl_init: invalid module name!" );
@@ -116,26 +112,20 @@ namespace dbaui
// our label should equal the UI text of the "Open" command
OUString sLabel(vcl::CommandInfoProvider::GetLabelForCommand(".uno:Open", m_sModule));
- SetText(" " + sLabel.replaceAll("~", ""));
+ m_xControl->set_label(" " + sLabel.replaceAll("~", ""));
// Place icon left of text and both centered in the button.
- SetModeImage( GetCommandIcon( ".uno:Open", m_sModule ) );
- EnableImageDisplay( true );
- EnableTextDisplay( true );
- SetImageAlign( ImageAlign::Left );
- SetStyle( GetStyle() | WB_CENTER );
+ m_xControl->set_image(GetCommandIcon(".uno:Open", m_sModule));
}
// OpenDocumentListBox
- OpenDocumentListBox::OpenDocumentListBox( vcl::Window* _pParent, const sal_Char* _pAsciiModuleName )
- :ListBox( _pParent, WB_BORDER | WB_DROPDOWN )
+ OpenDocumentListBox::OpenDocumentListBox(std::unique_ptr<weld::ComboBox> xControl, const sal_Char* _pAsciiModuleName )
+ : m_xControl(std::move(xControl))
{
impl_init( _pAsciiModuleName );
}
- VCL_BUILDER_FACTORY_ARGS( OpenDocumentListBox, "com.sun.star.sdb.OfficeDatabaseDocument" );
-
void OpenDocumentListBox::impl_init( const sal_Char* _pAsciiModuleName )
{
OSL_ENSURE( _pAsciiModuleName, "OpenDocumentListBox::impl_init: invalid module name!" );
@@ -179,8 +169,8 @@ namespace dbaui
OUString sDecodedURL = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
- sal_Int32 nPos = InsertEntry( sTitle );
- m_aURLs.emplace( nPos, StringPair( sDecodedURL, sFilter ) );
+ m_xControl->append_text(sTitle);
+ m_aURLs.emplace_back(StringPair(sDecodedURL, sFilter));
}
}
catch( Exception& ) {}
@@ -190,50 +180,23 @@ namespace dbaui
OUString OpenDocumentListBox::GetSelectedDocumentURL() const
{
OUString sURL;
- sal_Int32 nSelected = GetSelectedEntryPos();
- if ( LISTBOX_ENTRY_NOTFOUND != GetSelectedEntryPos() )
+ sal_Int32 nSelected = m_xControl->get_active();
+ if (nSelected != -1)
sURL = impl_getDocumentAtIndex( nSelected ).first;
return sURL;
}
OpenDocumentListBox::StringPair OpenDocumentListBox::impl_getDocumentAtIndex( sal_uInt16 _nListIndex, bool _bSystemNotation ) const
{
- MapIndexToStringPair::const_iterator pos = m_aURLs.find( _nListIndex );
- OSL_ENSURE( pos != m_aURLs.end(), "OpenDocumentListBox::impl_getDocumentAtIndex: invalid index!" );
-
- StringPair aDocumentDescriptor;
- if ( pos != m_aURLs.end() )
+ StringPair aDocumentDescriptor = m_aURLs[_nListIndex];
+ if ( _bSystemNotation && !aDocumentDescriptor.first.isEmpty() )
{
- aDocumentDescriptor = pos->second;
- if ( _bSystemNotation && !aDocumentDescriptor.first.isEmpty() )
- {
- ::svt::OFileNotation aNotation( aDocumentDescriptor.first );
- aDocumentDescriptor.first = aNotation.get( ::svt::OFileNotation::N_SYSTEM );
- }
+ ::svt::OFileNotation aNotation( aDocumentDescriptor.first );
+ aDocumentDescriptor.first = aNotation.get( ::svt::OFileNotation::N_SYSTEM );
}
return aDocumentDescriptor;
}
- void OpenDocumentListBox::RequestHelp( const HelpEvent& _rHEvt )
- {
- if( !( _rHEvt.GetMode() & HelpEventMode::QUICK ) )
- return;
- if ( !IsEnabled() )
- return;
-
- Point aRequestPos( ScreenToOutputPixel( _rHEvt.GetMousePosPixel() ) );
- sal_Int32 nItemIndex = LISTBOX_ENTRY_NOTFOUND;
- if ( GetIndexForPoint( aRequestPos, nItemIndex ) != -1 )
- {
- tools::Rectangle aItemRect( GetBoundingRectangle( nItemIndex ) );
- aItemRect = tools::Rectangle(
- OutputToScreenPixel( aItemRect.TopLeft() ),
- OutputToScreenPixel( aItemRect.BottomRight() ) );
- OUString sHelpText = impl_getDocumentAtIndex( nItemIndex, true ).first;
- Help::ShowQuickHelp( this, aItemRect, sHelpText, QuickHelpFlags::Left | QuickHelpFlags::VCenter );
- }
- }
-
} // namespace dbaui
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */