From 6abfb890a2fad1931a79d53018f932205a668264 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 15 Nov 2013 10:26:19 +0000 Subject: convert impress remote dialog to .ui Change-Id: I4ed22a776720bd6de64d08767a03a746276acba4 --- extras/source/glade/libreoffice-catalog.xml.in | 4 ++ sd/AllLangResTarget_sd.mk | 1 - sd/UIConfig_simpress.mk | 1 + sd/inc/glob.hrc | 1 + sd/source/core/glob.src | 5 ++ sd/source/ui/dlg/RemoteDialog.cxx | 30 ++++------ sd/source/ui/dlg/RemoteDialog.hxx | 8 +-- sd/source/ui/dlg/RemoteDialog.src | 56 ------------------ sd/source/ui/dlg/RemoteDialogClientBox.cxx | 73 ++++++++++++++---------- sd/source/ui/dlg/RemoteDialogClientBox.hxx | 6 +- sd/source/ui/inc/RemoteDialog.hrc | 18 ------ sd/source/ui/table/TableDesignPane.cxx | 16 ++---- sd/uiconfig/simpress/ui/remotedialog.ui | 78 ++++++++++++++++++++++++++ 13 files changed, 155 insertions(+), 142 deletions(-) delete mode 100644 sd/source/ui/dlg/RemoteDialog.src delete mode 100644 sd/source/ui/inc/RemoteDialog.hrc create mode 100644 sd/uiconfig/simpress/ui/remotedialog.ui diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index d4b88a0c345f..83946db41228 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -533,6 +533,10 @@ generic-name="BmpWindow" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> + + diff --git a/sd/AllLangResTarget_sd.mk b/sd/AllLangResTarget_sd.mk index 8cb57277f0b8..895bdbb33247 100644 --- a/sd/AllLangResTarget_sd.mk +++ b/sd/AllLangResTarget_sd.mk @@ -48,7 +48,6 @@ $(eval $(call gb_SrsTarget_add_files,sd/res,\ sd/source/ui/dlg/LayerDialog.src \ sd/source/ui/dlg/navigatr.src \ sd/source/ui/dlg/PaneDockingWindow.src \ - sd/source/ui/dlg/RemoteDialog.src \ sd/source/ui/dlg/sdpreslt.src \ sd/source/ui/dlg/tpaction.src \ sd/source/ui/dlg/vectdlg.src \ diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk index 2bea2351b911..040db6b43ac0 100644 --- a/sd/UIConfig_simpress.mk +++ b/sd/UIConfig_simpress.mk @@ -89,6 +89,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\ sd/uiconfig/simpress/ui/presentationdialog \ sd/uiconfig/simpress/ui/printeroptions \ sd/uiconfig/simpress/ui/prntopts \ + sd/uiconfig/simpress/ui/remotedialog \ sd/uiconfig/simpress/ui/sdviewpage \ sd/uiconfig/simpress/ui/slidetransitionspanel \ sd/uiconfig/simpress/ui/tabledesignpanel \ diff --git a/sd/inc/glob.hrc b/sd/inc/glob.hrc index 622ce9367a5e..522ecb2a5e4e 100644 --- a/sd/inc/glob.hrc +++ b/sd/inc/glob.hrc @@ -127,6 +127,7 @@ #define STR_SLIDE_NAME RID_GLOB_START+112 #define STR_LEFT_IMPRESS_PANE_SHELL RID_GLOB_START+113 #define STR_LEFT_DRAW_PANE_SHELL RID_GLOB_START+114 +#define STR_ENTER_PIN RID_GLOB_START+115 #define STR_TOOL_PANEL_SHELL RID_GLOB_START+116 #define STR_TASKPANEVIEWSHELL RID_GLOB_START+117 diff --git a/sd/source/core/glob.src b/sd/source/core/glob.src index 2ad0d58dcaaf..0e6f235b963e 100644 --- a/sd/source/core/glob.src +++ b/sd/source/core/glob.src @@ -449,4 +449,9 @@ String STR_POOLSHEET_LAST_COLUMN Text [ en-US ] = "Last column" ; }; +String STR_ENTER_PIN +{ + Text [ en-US ] = "Enter PIN:"; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/RemoteDialog.cxx b/sd/source/ui/dlg/RemoteDialog.cxx index 5da2882f364d..fd2fe8136987 100644 --- a/sd/source/ui/dlg/RemoteDialog.cxx +++ b/sd/source/ui/dlg/RemoteDialog.cxx @@ -12,19 +12,18 @@ #include "cusshow.hxx" #include "RemoteDialog.hxx" -#include "RemoteDialog.hrc" #include "RemoteServer.hxx" using namespace ::sd; using namespace ::std; -RemoteDialog::RemoteDialog( Window *pWindow ) : - ModalDialog( pWindow, SdResId( DLG_PAIR_REMOTE ) ), - mButtonConnect( this, SdResId( BTN_CONNECT ) ), - mButtonCancel( this, SdResId( BTN_CANCEL ) ), - mClientBox( this, SdResId( LB_SERVERS ) ) +RemoteDialog::RemoteDialog( Window *pWindow ) + : ModalDialog(pWindow, "RemoteDialog", + "modules/simpress/ui/remotedialog.ui") { - FreeResource(); + get(m_pButtonConnect, "connect"); + get(m_pButtonClose, "close"); + get(m_pClientBox, "tree"); #ifdef ENABLE_SDREMOTE RemoteServer::ensureDiscoverable(); @@ -36,30 +35,25 @@ RemoteDialog::RemoteDialog( Window *pWindow ) : for ( vector::const_iterator aIt( aClients.begin() ); aIt != aEnd; ++aIt ) { - mClientBox.addEntry( *aIt ); + m_pClientBox->addEntry( *aIt ); } #endif - mButtonConnect.SetClickHdl( LINK( this, RemoteDialog, HandleConnectButton ) ); + m_pButtonConnect->SetClickHdl( LINK( this, RemoteDialog, HandleConnectButton ) ); SetCloseHdl( LINK( this, RemoteDialog, CloseHdl ) ); - mButtonCancel.SetClickHdl( LINK( this, RemoteDialog, CloseHdl ) ); + m_pButtonClose->SetClickHdl( LINK( this, RemoteDialog, CloseHdl ) ); } -RemoteDialog::~RemoteDialog() -{ -} - -// ----------------------------------------------------------------------- IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton) { // setBusy( true ); // Fixme: Try and connect #if defined(ENABLE_SDREMOTE) && defined(ENABLE_SDREMOTE_BLUETOOTH) - long aSelected = mClientBox.GetActiveEntryIndex(); + long aSelected = m_pClientBox->GetActiveEntryIndex(); if ( aSelected < 0 ) return 1; - TClientBoxEntry aEntry = mClientBox.GetEntryData(aSelected); - OUString aPin ( mClientBox.getPin() ); + TClientBoxEntry aEntry = m_pClientBox->GetEntryData(aSelected); + OUString aPin ( m_pClientBox->getPin() ); if ( RemoteServer::connectClient( aEntry->m_pClientInfo, aPin ) ) { return CloseHdl( 0 ); diff --git a/sd/source/ui/dlg/RemoteDialog.hxx b/sd/source/ui/dlg/RemoteDialog.hxx index 938192fd1f7c..27adf2bfe83f 100644 --- a/sd/source/ui/dlg/RemoteDialog.hxx +++ b/sd/source/ui/dlg/RemoteDialog.hxx @@ -24,16 +24,14 @@ namespace sd class RemoteDialog : public ModalDialog { private: - OKButton mButtonConnect; - CancelButton mButtonCancel; - ClientBox mClientBox; + PushButton* m_pButtonConnect; + CloseButton* m_pButtonClose; + ClientBox* m_pClientBox; DECL_DLLPRIVATE_LINK( HandleConnectButton, void * ); DECL_LINK( CloseHdl, void * ); public: RemoteDialog( Window* pWindow ); - ~RemoteDialog(); - }; } diff --git a/sd/source/ui/dlg/RemoteDialog.src b/sd/source/ui/dlg/RemoteDialog.src deleted file mode 100644 index 609dbeed440f..000000000000 --- a/sd/source/ui/dlg/RemoteDialog.src +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -#include "helpids.h" -#include -#include "RemoteDialog.hrc" - -ModalDialog DLG_PAIR_REMOTE -{ - - HelpID = CMD_SID_REMOTE_DLG ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 200, 160 ) ; - Text [ en-US ] = "Impress Remote" ; - Moveable = TRUE ; - Closeable = TRUE ; - - Control LB_SERVERS - { -//; HelpId = HID_SD_SLIDETRANSITIONPANE_LB_SLIDE_TRANSITIONS; - Border = TRUE ; - TabStop = TRUE ; -//; AutoVScroll = TRUE ; -//; Pos = MAP_APPFONT ( 0, 0 ) ; - Size = MAP_APPFONT( 200, 140 ); - }; - - OKButton BTN_CONNECT - { - Pos = MAP_APPFONT ( 100, 146 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Connect" ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 150, 146 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - Text [ en-US ] = "Close" ; - TabStop = TRUE ; - }; - - String STR_ENTER_PIN - { - Text [ en-US ] = "Enter PIN:"; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.cxx b/sd/source/ui/dlg/RemoteDialogClientBox.cxx index f1eef9d53417..a47f45aa553e 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.cxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.cxx @@ -20,7 +20,6 @@ #include "svtools/controldims.hrc" #include "RemoteDialogClientBox.hxx" -#include "RemoteDialog.hrc" #include "RemoteServer.hxx" #include "comphelper/processfactory.hxx" @@ -28,6 +27,8 @@ #include "com/sun/star/deployment/DependencyException.hpp" #include "com/sun/star/deployment/DeploymentException.hpp" +#include "glob.hrc" + using namespace ::com::sun::star; namespace sd { @@ -63,8 +64,8 @@ ClientRemovedListener::~ClientRemovedListener() //------------------------------------------------------------------------------ // ClientBox //------------------------------------------------------------------------------ -ClientBox::ClientBox( Dialog* pParent, const SdResId& aId ) : - Control( pParent, aId ), +ClientBox::ClientBox( Window* pParent, WinBits nStyle ) : + Control( pParent, nStyle ), m_bHasScrollBar( false ), m_bHasActive( false ), m_bNeedsRecalc( true ), @@ -75,15 +76,13 @@ ClientBox::ClientBox( Dialog* pParent, const SdResId& aId ) : m_nTopIndex( 0 ), m_nActiveHeight( 0 ), m_nExtraHeight( 2 ), - m_aPinBox( this, SdResId( INPUT_PIN ) ), - m_aPinDescription( this, SdResId( TEXT_PIN ) ), - m_pScrollBar( new ScrollBar( this, WB_VERT ) ) + m_aPinBox( this, 0 ), + m_aScrollBar( this, WB_VERT ) { - m_pScrollBar->SetScrollHdl( LINK( this, ClientBox, ScrollHdl ) ); - m_pScrollBar->EnableDrag(); + m_aScrollBar.SetScrollHdl( LINK( this, ClientBox, ScrollHdl ) ); + m_aScrollBar.EnableDrag(); m_aPinBox.SetUseThousandSep(false); -// m_aPinDescription.SetText( SD_RESSTR( STR_ENTER_PIN ) ); SetPaintTransparent( true ); SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) ); @@ -112,6 +111,20 @@ ClientBox::ClientBox( Dialog* pParent, const SdResId& aId ) : Show(); } +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeClientBox(Window *pParent, VclBuilder::stringmap &rMap) +{ + WinBits nWinStyle = WB_TABSTOP; + OString sBorder = VclBuilder::extractCustomProperty(rMap); + if (!sBorder.isEmpty()) + nWinStyle |= WB_BORDER; + return new ClientBox(pParent, nWinStyle); +} + +Size ClientBox::GetOptimalSize() const +{ + return LogicToPixel(Size(200, 140), MAP_APPFONT); +} + //------------------------------------------------------------------------------ ClientBox::~ClientBox() { @@ -151,7 +164,7 @@ void ClientBox::CalcActiveHeight( const long nPos ) // Text entry height Size aSize = GetOutputSizePixel(); if ( m_bHasScrollBar ) - aSize.Width() -= m_pScrollBar->GetSizePixel().Width(); + aSize.Width() -= m_aScrollBar.GetSizePixel().Width(); aSize.Width() -= ICON_OFFSET; @@ -173,7 +186,7 @@ Rectangle ClientBox::GetEntryRect( const long nPos ) const Size aSize( GetOutputSizePixel() ); if ( m_bHasScrollBar ) - aSize.Width() -= m_pScrollBar->GetSizePixel().Width(); + aSize.Width() -= m_aScrollBar.GetSizePixel().Width(); if ( m_vEntries[ nPos ]->m_bActive ) aSize.Height() = m_nActiveHeight; @@ -334,11 +347,11 @@ void ClientBox::DrawRow( const Rectangle& rRect, const TClientBoxEntry pEntry ) Size aBtnSize( m_aPinBox.GetSizePixel() ); Point aBtnPos( aRect.Left(), aRect.Bottom() - TOP_OFFSET - aBtnSize.Height() ); -// m_aPinDescription.SetPosPixel( aBtnPos ); + OUString sPinText(SD_RESSTR(STR_ENTER_PIN)); DrawText( Rectangle( aBtnPos.X(), aBtnPos.Y(), rRect.Right(), rRect.Bottom() - TOP_OFFSET), - SD_RESSTR( STR_ENTER_PIN ), 0 ); + sPinText, 0 ); - aBtnPos = Point( aRect.Left() + GetTextWidth( SD_RESSTR( STR_ENTER_PIN ) ), + aBtnPos = Point( aRect.Left() + GetTextWidth( sPinText ), aRect.Bottom() - TOP_OFFSET - aBtnSize.Height() ); m_aPinBox.SetPosPixel( aBtnPos ); @@ -407,7 +420,7 @@ void ClientBox::RecalcAll() } if ( m_bHasScrollBar ) - m_pScrollBar->SetThumbPos( m_nTopIndex ); + m_aScrollBar.SetThumbPos( m_nTopIndex ); } } @@ -478,7 +491,7 @@ void ClientBox::Paint( const Rectangle &/*rPaintRect*/ ) Size aSize( GetOutputSizePixel() ); if ( m_bHasScrollBar ) - aSize.Width() -= m_pScrollBar->GetSizePixel().Width(); + aSize.Width() -= m_aScrollBar.GetSizePixel().Width(); const ::osl::MutexGuard aGuard( m_entriesMutex ); @@ -518,20 +531,20 @@ void ClientBox::SetupScrollBar() if ( m_nTopIndex + aSize.Height() > nTotalHeight ) m_nTopIndex = nTotalHeight - aSize.Height(); - m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ), + m_aScrollBar.SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ), Size( nScrBarSize, aSize.Height() ) ); - m_pScrollBar->SetRangeMax( nTotalHeight ); - m_pScrollBar->SetVisibleSize( aSize.Height() ); - m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 ); - m_pScrollBar->SetLineSize( m_nStdHeight ); - m_pScrollBar->SetThumbPos( m_nTopIndex ); + m_aScrollBar.SetRangeMax( nTotalHeight ); + m_aScrollBar.SetVisibleSize( aSize.Height() ); + m_aScrollBar.SetPageSize( ( aSize.Height() * 4 ) / 5 ); + m_aScrollBar.SetLineSize( m_nStdHeight ); + m_aScrollBar.SetThumbPos( m_nTopIndex ); if ( !m_bHasScrollBar ) - m_pScrollBar->Show(); + m_aScrollBar.Show(); } else if ( m_bHasScrollBar ) { - m_pScrollBar->Hide(); + m_aScrollBar.Hide(); m_nTopIndex = 0; } @@ -607,11 +620,11 @@ long ClientBox::Notify( NotifyEvent& rNEvt ) const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData(); if ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) { - long nThumbPos = m_pScrollBar->GetThumbPos(); + long nThumbPos = m_aScrollBar.GetThumbPos(); if ( pData->GetDelta() < 0 ) - m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight ); + m_aScrollBar.DoScroll( nThumbPos + m_nStdHeight ); else - m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight ); + m_aScrollBar.DoScroll( nThumbPos - m_nStdHeight ); bHandled = true; } } @@ -690,13 +703,13 @@ long ClientBox::addEntry( ClientInfo* pClientInfo ) void ClientBox::DoScroll( long nDelta ) { m_nTopIndex += nDelta; - Point aNewSBPt( m_pScrollBar->GetPosPixel() ); + Point aNewSBPt( m_aScrollBar.GetPosPixel() ); Rectangle aScrRect( Point(), GetOutputSizePixel() ); - aScrRect.Right() -= m_pScrollBar->GetSizePixel().Width(); + aScrRect.Right() -= m_aScrollBar.GetSizePixel().Width(); Scroll( 0, -nDelta, aScrRect ); - m_pScrollBar->SetPosPixel( aNewSBPt ); + m_aScrollBar.SetPosPixel( aNewSBPt ); } // ----------------------------------------------------------------------- diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx index 522225a3fe44..d4f754f94fdd 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx @@ -106,9 +106,8 @@ class ClientBox: Link m_aClickHdl; NumericBox m_aPinBox; - FixedText m_aPinDescription; - ScrollBar* m_pScrollBar; + ScrollBar m_aScrollBar; com::sun::star::uno::Reference< ClientRemovedListener > m_xRemoveListener; @@ -140,12 +139,13 @@ class ClientBox: public: - ClientBox( Dialog* pParent, const SdResId& aId ); + ClientBox( Window* pParent, WinBits nStyle ); ~ClientBox(); void MouseButtonDown( const MouseEvent& rMEvt ); void Paint( const Rectangle &rPaintRect ); void Resize(); + Size GetOptimalSize() const; long Notify( NotifyEvent& rNEvt ); const Size GetMinOutputSizePixel() const; diff --git a/sd/source/ui/inc/RemoteDialog.hrc b/sd/source/ui/inc/RemoteDialog.hrc deleted file mode 100644 index a896f713badf..000000000000 --- a/sd/source/ui/inc/RemoteDialog.hrc +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -#include - -#define DLG_PAIR_REMOTE RID_APP_START+700 - -#define BTN_CONNECT 1 -#define BTN_CANCEL 2 -#define LB_SERVERS 3 -#define INPUT_PIN 4 -#define TEXT_PIN 5 -#define STR_ENTER_PIN 6 diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index a14e8522df82..eb52e4ff9423 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -387,17 +387,11 @@ void TableValueSet::updateSettings() extern "C" SAL_DLLPUBLIC_EXPORT ::Window* SAL_CALL makeTableValueSet(::Window *pParent, VclBuilder::stringmap &rMap) { - WinBits nWinBits = WB_TABSTOP; - - VclBuilder::stringmap::iterator aFind = rMap.find(OString("border")); - if (aFind != rMap.end()) - { - if (toBool(aFind->second)) - nWinBits |= WB_BORDER; - rMap.erase(aFind); - } - - return new TableValueSet(pParent, nWinBits); + WinBits nWinStyle = WB_TABSTOP; + OString sBorder = VclBuilder::extractCustomProperty(rMap); + if (!sBorder.isEmpty()) + nWinStyle |= WB_BORDER; + return new TableValueSet(pParent, nWinStyle); } // -------------------------------------------------------------------- diff --git a/sd/uiconfig/simpress/ui/remotedialog.ui b/sd/uiconfig/simpress/ui/remotedialog.ui new file mode 100644 index 000000000000..ad2049f889b1 --- /dev/null +++ b/sd/uiconfig/simpress/ui/remotedialog.ui @@ -0,0 +1,78 @@ + + + + + + False + 6 + Impress Remote + dialog + + + False + vertical + 12 + + + False + 5 + end + + + gtk-connect + True + True + True + True + True + True + + + False + True + 0 + + + + + gtk-close + True + True + True + True + + + False + True + 1 + + + + + False + True + end + 0 + + + + + True + False + True + True + + + False + True + 1 + + + + + + connect + close + + + -- cgit