From 79b9cd76f88c2b7f808aaedffb7cbd5dd5889f65 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 31 Oct 2012 12:07:45 +0000 Subject: convert run macro to .ui Change-Id: I4e83afa3d164ba0ae8640f4b5f2712b88c1e305f --- cui/source/customize/selector.cxx | 294 ++++++++++++++++++-------------------- cui/source/customize/selector.hrc | 45 ------ cui/source/customize/selector.src | 183 ------------------------ cui/source/dialogs/cuires.src | 47 ++++++ cui/source/factory/dlgfact.cxx | 11 +- cui/source/inc/cuires.hrc | 23 ++- cui/source/inc/helpid.hrc | 3 - cui/source/inc/selector.hxx | 56 ++++---- 8 files changed, 231 insertions(+), 431 deletions(-) delete mode 100644 cui/source/customize/selector.hrc delete mode 100644 cui/source/customize/selector.src (limited to 'cui/source') diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx index 9c5cae324a6c..039c14ec967e 100644 --- a/cui/source/customize/selector.cxx +++ b/cui/source/customize/selector.cxx @@ -20,9 +20,9 @@ #include #include #include +#include #include "selector.hxx" #include -#include "selector.hrc" #include // for RID_SVXIMG_... #include // for RID_SVXIMG_... #include @@ -67,29 +67,47 @@ using namespace ::com::sun::star::container; #include /* - * The implementations of SvxConfigFunctionListBox_Impl and - * SvxConfigGroupListBox_Impl are copied from sfx2/source/dialog/cfg.cxx + * The implementations of SvxConfigFunctionListBox and + * SvxConfigGroupListBox are copied from sfx2/source/dialog/cfg.cxx */ -SvxConfigFunctionListBox_Impl::SvxConfigFunctionListBox_Impl( Window* pParent, const ResId& rResId) +SvxConfigFunctionListBox::SvxConfigFunctionListBox( Window* pParent, const ResId& rResId) : SvTreeListBox( pParent, rResId ) , pCurEntry( 0 ) , m_pDraggingEntry( 0 ) { SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT ); + Init(); +} + +SvxConfigFunctionListBox::SvxConfigFunctionListBox(Window* pParent) + : SvTreeListBox(pParent, WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT) + , pCurEntry(0) + , m_pDraggingEntry(0) +{ + Init(); +} + +void SvxConfigFunctionListBox::Init() +{ GetModel()->SetSortMode( SortAscending ); // Timer for the BallonHelp aTimer.SetTimeout( 200 ); aTimer.SetTimeoutHdl( - LINK( this, SvxConfigFunctionListBox_Impl, TimerHdl ) ); + LINK( this, SvxConfigFunctionListBox, TimerHdl ) ); +} + +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxConfigFunctionListBox(Window *pParent, VclBuilder::stringmap &) +{ + return new SvxConfigFunctionListBox(pParent); } -SvxConfigFunctionListBox_Impl::~SvxConfigFunctionListBox_Impl() +SvxConfigFunctionListBox::~SvxConfigFunctionListBox() { ClearAll(); } -SvTreeListEntry* SvxConfigFunctionListBox_Impl::GetLastSelectedEntry() +SvTreeListEntry* SvxConfigFunctionListBox::GetLastSelectedEntry() { if ( m_pDraggingEntry != NULL ) { @@ -101,7 +119,7 @@ SvTreeListEntry* SvxConfigFunctionListBox_Impl::GetLastSelectedEntry() } } -void SvxConfigFunctionListBox_Impl::MouseMove( const MouseEvent& rMEvt ) +void SvxConfigFunctionListBox::MouseMove( const MouseEvent& rMEvt ) { Point aMousePos = rMEvt.GetPosPixel(); pCurEntry = GetCurEntry(); @@ -116,7 +134,7 @@ void SvxConfigFunctionListBox_Impl::MouseMove( const MouseEvent& rMEvt ) } -IMPL_LINK_NOARG(SvxConfigFunctionListBox_Impl, TimerHdl) +IMPL_LINK_NOARG(SvxConfigFunctionListBox, TimerHdl) { aTimer.Stop(); Point aMousePos = GetPointerPosPixel(); @@ -126,13 +144,13 @@ IMPL_LINK_NOARG(SvxConfigFunctionListBox_Impl, TimerHdl) return 0L; } -void SvxConfigFunctionListBox_Impl::ClearAll() +void SvxConfigFunctionListBox::ClearAll() { aArr.clear(); Clear(); } -String SvxConfigFunctionListBox_Impl::GetHelpText( SvTreeListEntry *pEntry ) +String SvxConfigFunctionListBox::GetHelpText( SvTreeListEntry *pEntry ) { SvxGroupInfo_Impl *pInfo = pEntry ? (SvxGroupInfo_Impl*) pEntry->GetUserData(): 0; @@ -156,41 +174,41 @@ String SvxConfigFunctionListBox_Impl::GetHelpText( SvTreeListEntry *pEntry ) return String(); } -void SvxConfigFunctionListBox_Impl::FunctionSelected() +void SvxConfigFunctionListBox::FunctionSelected() { Help::ShowBalloon( this, Point(), String() ); } // drag and drop support -DragDropMode SvxConfigFunctionListBox_Impl::NotifyStartDrag( +DragDropMode SvxConfigFunctionListBox::NotifyStartDrag( TransferDataContainer& /*aTransferDataContainer*/, SvTreeListEntry* pEntry ) { m_pDraggingEntry = pEntry; return GetDragDropMode(); } -void SvxConfigFunctionListBox_Impl::DragFinished( sal_Int8 /*nDropAction*/ ) +void SvxConfigFunctionListBox::DragFinished( sal_Int8 /*nDropAction*/ ) { m_pDraggingEntry = NULL; } sal_Int8 -SvxConfigFunctionListBox_Impl::AcceptDrop( const AcceptDropEvent& /*rEvt*/ ) +SvxConfigFunctionListBox::AcceptDrop( const AcceptDropEvent& /*rEvt*/ ) { return DND_ACTION_NONE; } -SvxConfigGroupListBox_Impl::SvxConfigGroupListBox_Impl( +SvxConfigGroupListBox::SvxConfigGroupListBox( Window* pParent, const ResId& rResId, bool _bShowSlots, const Reference< frame::XFrame >& xFrame ) : SvTreeListBox( pParent, rResId ) - , m_bShowSlots( _bShowSlots ), - m_hdImage(ResId(IMG_HARDDISK,*rResId.GetResMgr())), - m_libImage(ResId(IMG_LIB,*rResId.GetResMgr())), - m_macImage(ResId(IMG_MACRO,*rResId.GetResMgr())), - m_docImage(ResId(IMG_DOC,*rResId.GetResMgr())), - m_sMyMacros(String(ResId(STR_MYMACROS,*rResId.GetResMgr()))), - m_sProdMacros(String(ResId(STR_PRODMACROS,*rResId.GetResMgr()))) + , m_bShowSlots( _bShowSlots ) + , m_hdImage(CUI_RES(RID_CUIIMG_HARDDISK)) + , m_libImage(CUI_RES(RID_CUIIMG_LIB)) + , m_macImage(CUI_RES(RID_CUIIMG_MACRO)) + , m_docImage(CUI_RES(RID_CUIIMG_DOC)) + , m_sMyMacros(CUI_RESSTR(RID_SVXSTR_MYMACROS)) + , m_sProdMacros(CUI_RESSTR(RID_SVXSTR_PRODMACROS)) { FreeResource(); @@ -209,13 +227,36 @@ SvxConfigGroupListBox_Impl::SvxConfigGroupListBox_Impl( ); } +SvxConfigGroupListBox::SvxConfigGroupListBox(Window* pParent) + : SvTreeListBox(pParent, + WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT) + , m_bShowSlots(false) + , m_hdImage(CUI_RES(RID_CUIIMG_HARDDISK)) + , m_libImage(CUI_RES(RID_CUIIMG_LIB)) + , m_macImage(CUI_RES(RID_CUIIMG_MACRO)) + , m_docImage(CUI_RES(RID_CUIIMG_DOC)) + , m_sMyMacros(CUI_RESSTR(RID_SVXSTR_MYMACROS)) + , m_sProdMacros(CUI_RESSTR(RID_SVXSTR_PRODMACROS)) +{ + ImageList aNavigatorImages( SVX_RES( RID_SVXIMGLIST_FMEXPL ) ); + + SetNodeBitmaps( + aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ), + aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE ) + ); +} + +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxConfigGroupListBox(Window *pParent, VclBuilder::stringmap &) +{ + return new SvxConfigGroupListBox(pParent); +} -SvxConfigGroupListBox_Impl::~SvxConfigGroupListBox_Impl() +SvxConfigGroupListBox::~SvxConfigGroupListBox() { ClearAll(); } -void SvxConfigGroupListBox_Impl::ClearAll() +void SvxConfigGroupListBox::ClearAll() { aArr.clear(); Clear(); @@ -275,9 +316,9 @@ namespace } } -void SvxConfigGroupListBox_Impl::fillScriptList( const Reference< browse::XBrowseNode >& _rxRootNode, SvTreeListEntry* _pParentEntry, bool _bCheapChildrenOnDemand ) +void SvxConfigGroupListBox::fillScriptList( const Reference< browse::XBrowseNode >& _rxRootNode, SvTreeListEntry* _pParentEntry, bool _bCheapChildrenOnDemand ) { - OSL_PRECOND( _rxRootNode.is(), "SvxConfigGroupListBox_Impl::fillScriptList: invalid root node!" ); + OSL_PRECOND( _rxRootNode.is(), "SvxConfigGroupListBox::fillScriptList: invalid root node!" ); if ( !_rxRootNode.is() ) return; @@ -384,8 +425,11 @@ void SvxConfigGroupListBox_Impl::fillScriptList( const Reference< browse::XBrows } } -void SvxConfigGroupListBox_Impl::Init() +void SvxConfigGroupListBox::Init(bool bShowSlots, const Reference< frame::XFrame >& xFrame) { + m_bShowSlots = bShowSlots; + m_xFrame.set(xFrame); + SetUpdateMode(sal_False); ClearAll(); @@ -507,8 +551,7 @@ void SvxConfigGroupListBox_Impl::Init() SvxGroupInfo_Impl *pInfo = new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0, rootNode ); - String aTitle = - String( CUI_RES( STR_SELECTOR_MACROS ) ); + String aTitle = CUI_RESSTR(RID_SVXSTR_PRODMACROS); SvTreeListEntry *pNewEntry = InsertEntry( aTitle, NULL ); pNewEntry->SetUserData( pInfo ); @@ -524,7 +567,7 @@ void SvxConfigGroupListBox_Impl::Init() SetUpdateMode( sal_True ); } -Image SvxConfigGroupListBox_Impl::GetImage( +Image SvxConfigGroupListBox::GetImage( Reference< browse::XBrowseNode > node, Reference< XComponentContext > xCtx, bool bIsRootNode @@ -586,7 +629,7 @@ Image SvxConfigGroupListBox_Impl::GetImage( } Reference< XInterface > -SvxConfigGroupListBox_Impl::getDocumentModel( +SvxConfigGroupListBox::getDocumentModel( Reference< XComponentContext >& xCtx, OUString& docName ) { Reference< XInterface > xModel; @@ -618,7 +661,7 @@ SvxConfigGroupListBox_Impl::getDocumentModel( return xModel; } -void SvxConfigGroupListBox_Impl::GroupSelected() +void SvxConfigGroupListBox::GroupSelected() { SvTreeListEntry *pEntry = FirstSelected(); SvxGroupInfo_Impl *pInfo = (SvxGroupInfo_Impl*) pEntry->GetUserData(); @@ -796,7 +839,7 @@ void SvxConfigGroupListBox_Impl::GroupSelected() pFunctionListBox->SetUpdateMode(sal_True); } -sal_Bool SvxConfigGroupListBox_Impl::Expand( SvTreeListEntry* pParent ) +sal_Bool SvxConfigGroupListBox::Expand( SvTreeListEntry* pParent ) { sal_Bool bRet = SvTreeListBox::Expand( pParent ); if ( bRet ) @@ -827,7 +870,7 @@ sal_Bool SvxConfigGroupListBox_Impl::Expand( SvTreeListEntry* pParent ) return bRet; } -void SvxConfigGroupListBox_Impl::RequestingChildren( SvTreeListEntry *pEntry ) +void SvxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry ) { SvxGroupInfo_Impl *pInfo = (SvxGroupInfo_Impl*) pEntry->GetUserData(); pInfo->bWasOpened = sal_True; @@ -857,115 +900,52 @@ void SvxConfigGroupListBox_Impl::RequestingChildren( SvTreeListEntry *pEntry ) */ SvxScriptSelectorDialog::SvxScriptSelectorDialog( - Window* pParent, sal_Bool bShowSlots, const Reference< frame::XFrame >& xFrame ) - : - ModelessDialog( pParent, CUI_RES( RID_DLG_SCRIPTSELECTOR ) ), - aDialogDescription( this, CUI_RES( TXT_SELECTOR_DIALOG_DESCRIPTION ) ), - aGroupText( this, CUI_RES( TXT_SELECTOR_CATEGORIES ) ), - aCategories( this, CUI_RES( BOX_SELECTOR_CATEGORIES ), bShowSlots, xFrame ), - aFunctionText( this, CUI_RES( TXT_SELECTOR_COMMANDS ) ), - aCommands( this, CUI_RES( BOX_SELECTOR_COMMANDS ) ), - aOKButton( this, CUI_RES( BTN_SELECTOR_OK ) ), - aCancelButton( this, CUI_RES( BTN_SELECTOR_CANCEL ) ), - aHelpButton( this, CUI_RES( BTN_SELECTOR_HELP ) ), - aDescription( this, CUI_RES( GRP_SELECTOR_DESCRIPTION ) ), - aDescriptionText( this, CUI_RES( TXT_SELECTOR_DESCRIPTION ) ), - m_bShowSlots( bShowSlots ) + Window* pParent, sal_Bool bShowSlots, const Reference< frame::XFrame >& xFrame) + : ModelessDialog(pParent, "MacroSelectorDialog", "cui/ui/macroselectordialog.ui") + , m_bShowSlots(bShowSlots) { - - ResMgr& rMgr = CUI_MGR(); - - // If we are showing Slot API commands update labels in the UI, and - // enable drag'n'drop - if ( m_bShowSlots ) + get("libraryft")->Show(!m_bShowSlots); + get("categoryft")->Show(m_bShowSlots); + get("macronameft")->Show(!m_bShowSlots); + get("commandsft")->Show(m_bShowSlots); + get(m_pDescriptionText, "description"); + get(m_pCommands, "commands"); + if (m_bShowSlots) { - aGroupText.SetText( String( ResId( STR_SELECTOR_CATEGORIES, rMgr ) ) ); - aOKButton.SetText( String( ResId( STR_SELECTOR_ADD, rMgr ) ) ); - aCancelButton.SetText( String( ResId( STR_SELECTOR_CLOSE, rMgr ) ) ); - aFunctionText.SetText( String( ResId( STR_SELECTOR_COMMANDS, rMgr ) ) ); - SetDialogDescription( - String( ResId( STR_SELECTOR_ADD_COMMANDS_DESCRIPTION, rMgr ) ) ); - SetText( String( ResId( STR_SELECTOR_ADD_COMMANDS, rMgr ) ) ); - - aCommands.SetDragDropMode( SV_DRAGDROP_APP_COPY ); + // If we are showing Slot API commands update labels in the UI, and + // enable drag'n'drop + SetText(CUI_RESSTR(RID_SVXSTR_SELECTOR_ADD_COMMANDS)); + m_pCommands->SetDragDropMode( SV_DRAGDROP_APP_COPY ); + + get(m_pCancelButton, "close"); + get(m_pDialogDescription, "helptoolbar"); + get(m_pOKButton, "add"); } + else + { + get(m_pCancelButton, "cancel"); + get(m_pDialogDescription, "helpmacro"); + get(m_pOKButton, "ok"); + } + m_pCancelButton->Show(); + m_pDialogDescription->Show(); + m_pOKButton->Show(); - ResizeControls(); - - aCategories.SetFunctionListBox( &aCommands ); - aCategories.Init(); + get(m_pCategories, "categories"); + m_pCategories->SetFunctionListBox(m_pCommands); + m_pCategories->Init(bShowSlots, xFrame); - aCategories.SetSelectHdl( + m_pCategories->SetSelectHdl( LINK( this, SvxScriptSelectorDialog, SelectHdl ) ); - aCommands.SetSelectHdl( LINK( this, SvxScriptSelectorDialog, SelectHdl ) ); - aCommands.SetDoubleClickHdl( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) ); + m_pCommands->SetSelectHdl( LINK( this, SvxScriptSelectorDialog, SelectHdl ) ); + m_pCommands->SetDoubleClickHdl( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) ); - aOKButton.SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) ); - aCancelButton.SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) ); + m_pOKButton->SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) ); + m_pCancelButton->SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) ); - UpdateUI(); - FreeResource(); -} + m_sDefaultDesc = m_pDescriptionText->GetText(); -void SvxScriptSelectorDialog::ResizeControls() -{ - Point p, newp; - Size s, news; - long gap; - - sal_uInt16 style = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | - TEXT_DRAW_LEFT | TEXT_DRAW_WORDBREAK; - - // get dimensions of dialog instructions control - p = aDialogDescription.GetPosPixel(); - s = aDialogDescription.GetSizePixel(); - - // get dimensions occupied by text in the control - Rectangle rect = - GetTextRect( Rectangle( p, s ), aDialogDescription.GetText(), style ); - news = rect.GetSize(); - - // the gap is the difference between the control height and its text height - gap = s.Height() - news.Height(); - - // resize the dialog instructions control - news = Size( s.Width(), s.Height() - gap ); - aDialogDescription.SetSizePixel( news ); - - // resize other controls to fill the gap - p = aGroupText.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aGroupText.SetPosPixel( newp ); - - p = aCategories.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aCategories.SetPosPixel( newp ); - s = aCategories.GetSizePixel(); - news = Size( s.Width(), s.Height() + gap ); - aCategories.SetSizePixel( news ); - - p = aFunctionText.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aFunctionText.SetPosPixel( newp ); - - p = aCommands.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aCommands.SetPosPixel( newp ); - s = aCommands.GetSizePixel(); - news = Size( s.Width(), s.Height() + gap ); - aCommands.SetSizePixel( news ); - - p = aOKButton.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aOKButton.SetPosPixel( newp ); - - p = aCancelButton.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aCancelButton.SetPosPixel( newp ); - - p = aHelpButton.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aHelpButton.SetPosPixel( newp ); + UpdateUI(); } SvxScriptSelectorDialog::~SvxScriptSelectorDialog() @@ -974,13 +954,13 @@ SvxScriptSelectorDialog::~SvxScriptSelectorDialog() IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, Control*, pCtrl ) { - if ( pCtrl == &aCategories ) + if (pCtrl == m_pCategories) { - aCategories.GroupSelected(); + m_pCategories->GroupSelected(); } - else if ( pCtrl == &aCommands ) + else if (pCtrl == m_pCommands) { - aCommands.FunctionSelected(); + m_pCommands->FunctionSelected(); } UpdateUI(); return 0; @@ -989,8 +969,8 @@ IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, Control*, pCtrl ) IMPL_LINK( SvxScriptSelectorDialog, FunctionDoubleClickHdl, Control*, pCtrl ) { (void)pCtrl; - if ( aOKButton.IsEnabled() ) - return ClickHdl( &aOKButton ); + if (m_pOKButton->IsEnabled()) + return ClickHdl(m_pOKButton); return 0; } @@ -1002,22 +982,22 @@ SvxScriptSelectorDialog::UpdateUI() OUString url = GetScriptURL(); if ( url != NULL && !url.isEmpty() ) { - String rMessage = - aCommands.GetHelpText( aCommands.FirstSelected() ); - aDescriptionText.SetText( rMessage ); + OUString sMessage = + m_pCommands->GetHelpText(m_pCommands->FirstSelected()); + m_pDescriptionText->SetText(sMessage.isEmpty() ? m_sDefaultDesc : sMessage); - aOKButton.Enable( sal_True ); + m_pOKButton->Enable( sal_True ); } else { - aDescriptionText.SetText( String() ); - aOKButton.Enable( sal_False ); + m_pDescriptionText->SetText(m_sDefaultDesc); + m_pOKButton->Enable( sal_False ); } } IMPL_LINK( SvxScriptSelectorDialog, ClickHdl, Button *, pButton ) { - if ( pButton == &aCancelButton ) + if (pButton == m_pCancelButton) { // If we are displaying Slot API commands then the dialog is being // run from Tools/Configure and we should not close it, just hide it @@ -1030,7 +1010,7 @@ IMPL_LINK( SvxScriptSelectorDialog, ClickHdl, Button *, pButton ) Hide(); } } - else if ( pButton == &aOKButton ) + else if (pButton == m_pOKButton) { GetAddHdl().Call( this ); @@ -1043,12 +1023,12 @@ IMPL_LINK( SvxScriptSelectorDialog, ClickHdl, Button *, pButton ) else { // Select the next entry in the list if possible - SvTreeListEntry* current = aCommands.FirstSelected(); - SvTreeListEntry* next = aCommands.NextSibling( current ); + SvTreeListEntry* current = m_pCommands->FirstSelected(); + SvTreeListEntry* next = m_pCommands->NextSibling( current ); if ( next != NULL ) { - aCommands.Select( next ); + m_pCommands->Select( next ); } } } @@ -1059,13 +1039,13 @@ IMPL_LINK( SvxScriptSelectorDialog, ClickHdl, Button *, pButton ) void SvxScriptSelectorDialog::SetRunLabel() { - aOKButton.SetText( String( CUI_RES( STR_SELECTOR_RUN ) ) ); + m_pOKButton->SetText(CUI_RESSTR(RID_SVXSTR_SELECTOR_RUN)); } void SvxScriptSelectorDialog::SetDialogDescription( const String& rDescription ) { - aDialogDescription.SetText( rDescription ); + m_pDialogDescription->SetText( rDescription ); } String @@ -1073,7 +1053,7 @@ SvxScriptSelectorDialog::GetScriptURL() const { OUString result; - SvTreeListEntry *pEntry = const_cast< SvxScriptSelectorDialog* >( this )->aCommands.GetLastSelectedEntry(); + SvTreeListEntry *pEntry = const_cast< SvxScriptSelectorDialog* >( this )->m_pCommands->GetLastSelectedEntry(); if ( pEntry ) { SvxGroupInfo_Impl *pData = (SvxGroupInfo_Impl*) pEntry->GetUserData(); @@ -1091,13 +1071,13 @@ SvxScriptSelectorDialog::GetScriptURL() const String SvxScriptSelectorDialog::GetSelectedDisplayName() { - return aCommands.GetEntryText( aCommands.GetLastSelectedEntry() ); + return m_pCommands->GetEntryText( m_pCommands->GetLastSelectedEntry() ); } String SvxScriptSelectorDialog::GetSelectedHelpText() { - return aCommands.GetHelpText( aCommands.GetLastSelectedEntry() ); + return m_pCommands->GetHelpText( m_pCommands->GetLastSelectedEntry() ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/selector.hrc b/cui/source/customize/selector.hrc deleted file mode 100644 index 0e35802e1b7a..000000000000 --- a/cui/source/customize/selector.hrc +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#define TXT_SELECTOR_DIALOG_DESCRIPTION 1 -#define TXT_SELECTOR_CATEGORIES 2 -#define BOX_SELECTOR_CATEGORIES 3 -#define TXT_SELECTOR_COMMANDS 4 -#define BOX_SELECTOR_COMMANDS 5 -#define BTN_SELECTOR_OK 6 -#define BTN_SELECTOR_CANCEL 7 -#define BTN_SELECTOR_HELP 8 -#define GRP_SELECTOR_DESCRIPTION 9 -#define TXT_SELECTOR_DESCRIPTION 10 - -#define IMG_HARDDISK 1 -#define IMG_LIB 3 -#define IMG_MACRO 5 -#define IMG_DOC 7 - -#define STR_SELECTOR_ADD 310 -#define STR_SELECTOR_CLOSE 311 -#define STR_SELECTOR_COMMANDS 312 -#define STR_SELECTOR_ADD_COMMANDS 313 -#define STR_SELECTOR_ADD_COMMANDS_DESCRIPTION 314 -#define STR_SELECTOR_MACROS 315 -#define STR_SELECTOR_CATEGORIES 316 -#define STR_BASICMACROS 317 -#define STR_SELECTOR_RUN 318 -#define STR_MYMACROS 319 -#define STR_PRODMACROS 320 diff --git a/cui/source/customize/selector.src b/cui/source/customize/selector.src deleted file mode 100644 index 533e91edf54c..000000000000 --- a/cui/source/customize/selector.src +++ /dev/null @@ -1,183 +0,0 @@ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include "helpid.hrc" -#include -#include "selector.hrc" - -#define MASKCOLOR MaskColor = \ - Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - -#define FIXEDTEXT_DIALOG_DESCRIPTION \ -Text [ en-US ] = "Select the library that contains the macro you want. Then select the macro under 'Macro name'." ;\ - -String STR_SELECTOR_ADD_COMMANDS -{ - TEXT [ en-US ] = "Add Commands" ; -}; - -String STR_SELECTOR_MACROS -{ - Text [ en-US ] = "%PRODUCTNAME Macros" ; -}; - -String STR_SELECTOR_CATEGORIES -{ - Text [ en-US ] = "~Category" ; -}; - -String STR_SELECTOR_COMMANDS -{ - Text [ en-US ] = "Commands" ; -}; - -String STR_SELECTOR_ADD -{ - TEXT [ en-US ] = "Add" ; -}; - -String STR_SELECTOR_RUN -{ - TEXT [ en-US ] = "Run" ; - -}; - -String STR_SELECTOR_CLOSE -{ - TEXT [ en-US ] = "Close" ; - -}; - -String STR_SELECTOR_ADD_COMMANDS_DESCRIPTION -{ - TEXT [ en-US ] = "To add a command to a toolbar, select the category and then the command. Then drag the command to the Commands list of the Toolbars tab page in the Customize dialog."; -}; - -String STR_BASICMACROS -{ - Text [ en-US ] = "BASIC Macros" ; -}; - - -ModelessDialog RID_DLG_SCRIPTSELECTOR -{ - OutputSize = TRUE ; - Size = MAP_APPFONT ( 256 , 233 ) ; - Text [ en-US ] = "Macro Selector" ; - HelpId = HID_SELECTOR_DIALOG; - SvLook = TRUE ; - Moveable = TRUE ; - Hide = TRUE; - FixedText TXT_SELECTOR_DIALOG_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 190 , 48 ) ; - Group = TRUE ; - Left = TRUE ; - WordBreak = TRUE ; - FIXEDTEXT_DIALOG_DESCRIPTION - }; - FixedText TXT_SELECTOR_CATEGORIES - { - Pos = MAP_APPFONT ( 6 , 62 ) ; - Size = MAP_APPFONT ( 83 , 8 ) ; - Group = TRUE ; - Left = TRUE ; - Text [ en-US ] = "Library" ; - }; - Control BOX_SELECTOR_CATEGORIES - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 73 ) ; - Size = MAP_APPFONT ( 83 , 89 ) ; - TabStop = TRUE; - HelpId = HID_SELECTOR_CATEGORIES; - String STR_MYMACROS - { - Text [ en-US ] = "My Macros"; - }; - String STR_PRODMACROS - { - Text [ en-US ] = "%PRODUCTNAME Macros"; - }; - Image IMG_HARDDISK - { - ImageBitmap = Bitmap { File = "harddisk_16.bmp" ; }; - MASKCOLOR - }; - Image IMG_LIB - { - ImageBitmap = Bitmap { File = "im30820.png"; }; - MASKCOLOR - }; - Image IMG_MACRO - { - ImageBitmap = Bitmap { File = "im30821.png"; }; - MASKCOLOR - }; - Image IMG_DOC - { - ImageBitmap = Bitmap { File = "im30826.png"; }; - MASKCOLOR - }; - }; - FixedText TXT_SELECTOR_COMMANDS - { - Pos = MAP_APPFONT ( 101 , 62 ) ; - Size = MAP_APPFONT ( 93 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Macro name" ; - }; - Control BOX_SELECTOR_COMMANDS - { - Border = TRUE ; - Pos = MAP_APPFONT ( 101 , 73 ) ; - Size = MAP_APPFONT ( 93 , 89 ) ; - TabStop = TRUE; - HelpId = HID_SELECTOR_COMMANDS; - }; - OKButton BTN_SELECTOR_OK - { - Pos = MAP_APPFONT ( 200 , 73 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE; - }; - CancelButton BTN_SELECTOR_CANCEL - { - Pos = MAP_APPFONT ( 200 , 90 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_SELECTOR_HELP - { - Pos = MAP_APPFONT ( 200 , 107 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - FixedLine GRP_SELECTOR_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 168 ) ; - Size = MAP_APPFONT ( 224 , 8 ) ; - Group = TRUE ; - Text [ en-US ] = "Description" ; - }; - FixedText TXT_SELECTOR_DESCRIPTION - { - Pos = MAP_APPFONT ( 12 , 179 ) ; - Size = MAP_APPFONT ( 224 , 48 ) ; - WordBreak = TRUE ; - }; -}; - // ********************************************************************** EOF diff --git a/cui/source/dialogs/cuires.src b/cui/source/dialogs/cuires.src index 91c0f5e34e98..2e6e6ed01b42 100644 --- a/cui/source/dialogs/cuires.src +++ b/cui/source/dialogs/cuires.src @@ -19,4 +19,51 @@ String RID_SVXSTR_SELECT_FILE_IFRAME Text [ en-US ] = "Select File for Floating Frame" ; }; +String RID_SVXSTR_MYMACROS +{ + Text [ en-US ] = "My Macros"; +}; + +String RID_SVXSTR_PRODMACROS +{ + Text [ en-US ] = "%PRODUCTNAME Macros"; +}; + +String RID_SVXSTR_SELECTOR_ADD_COMMANDS +{ + TEXT [ en-US ] = "Add Commands" ; +}; + +String RID_SVXSTR_SELECTOR_RUN +{ + TEXT [ en-US ] = "Run" ; +}; + +#define MASKCOLOR MaskColor = \ + Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; + +Image RID_CUIIMG_HARDDISK +{ + ImageBitmap = Bitmap { File = "harddisk_16.bmp" ; }; + MASKCOLOR +}; + +Image RID_CUIIMG_LIB +{ + ImageBitmap = Bitmap { File = "im30820.png"; }; + MASKCOLOR +}; + +Image RID_CUIIMG_MACRO +{ + ImageBitmap = Bitmap { File = "im30821.png"; }; + MASKCOLOR +}; + +Image RID_CUIIMG_DOC +{ + ImageBitmap = Bitmap { File = "im30826.png"; }; + MASKCOLOR +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 3c019294e1bf..ebd3d6449c42 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1208,15 +1208,8 @@ AbstractScriptSelectorDialog* AbstractDialogFactory_Impl::CreateScriptSelectorDialog( Window* pParent, sal_Bool bShowSlots, const Reference< frame::XFrame >& _rxFrame ) { - SvxScriptSelectorDialog* pDlg = NULL; - - pDlg = new SvxScriptSelectorDialog( pParent, bShowSlots, _rxFrame ); - - if (pDlg) - { - return new AbstractScriptSelectorDialog_Impl( pDlg ); - } - return 0; + SvxScriptSelectorDialog* pDlg = new SvxScriptSelectorDialog(pParent, bShowSlots, _rxFrame); + return new AbstractScriptSelectorDialog_Impl(pDlg); } String AbstractScriptSelectorDialog_Impl::GetScriptURL() const diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc index 8a0c5600d3b8..710f6cff183a 100644 --- a/cui/source/inc/cuires.hrc +++ b/cui/source/inc/cuires.hrc @@ -24,6 +24,16 @@ // Resource-Id's ------------------------------------------------------------ +#define RID_SVX_MSGBOX_JAVA_RESTART (RID_SVX_START + 0) +#define RID_SVX_MSGBOX_OPTIONS_RESTART (RID_SVX_START + 1) +#define RID_SVX_MSGBOX_LANGUAGE_RESTART (RID_SVX_START + 2) +#define RID_CUI_DIALOG_COLORPICKER (RID_SVX_START + 3) + +#define RID_CUIIMG_HARDDISK (RID_SVX_START + 4) +#define RID_CUIIMG_LIB (RID_SVX_START + 5) +#define RID_CUIIMG_MACRO (RID_SVX_START + 6) +#define RID_CUIIMG_DOC (RID_SVX_START + 7) + // Gallery #define RID_CUI_GALLERY_START (RID_SVX_START + 360) // RID_CUI_GALLERY_END (RID_SVX_START + 410) @@ -157,15 +167,12 @@ #define RID_SVXSTR_COLOR_CONFIG_SAVE2 (RID_SVX_START + 854) #define RID_SVXSTR_COLOR_CONFIG_DELETE (RID_SVX_START + 855) #define RID_SVXSTR_OPT_DOUBLE_DICTS (RID_SVX_START + 320) -#define RID_SVX_MSGBOX_LANGUAGE_RESTART ( RID_SVX_START + 2 ) #define RID_SVXERR_OPT_PROXYPORTS (RID_SVX_START + 224) #define RID_SVXDLG_OPT_JAVASCRIPT_DISABLE (RID_SVX_START + 225) #define RID_SVXDLG_JAVA_PARAMETER (RID_SVX_START + 254) #define RID_SVXDLG_JAVA_CLASSPATH (RID_SVX_START + 255) #define RID_SVXERR_JRE_NOT_RECOGNIZED (RID_SVX_START + 256) #define RID_SVXERR_JRE_FAILED_VERSION (RID_SVX_START + 257) -#define RID_SVX_MSGBOX_JAVA_RESTART ( RID_SVX_START + 0 ) -#define RID_SVX_MSGBOX_OPTIONS_RESTART ( RID_SVX_START + 1 ) #define RID_SVXDLG_LNG_ED_NUM_PREBREAK (RID_SVX_START + 830) #define RID_SVXDLG_EDIT_MODULES (RID_SVX_START + 831) #define RID_SVXSTR_PATH_NAME_START (RID_SVX_START + 1003) @@ -315,7 +322,7 @@ #define RID_SVXPAGE_EVENTS (RID_SVX_START + 295) #define RID_SVXPAGE_CONFIGGROUPBOX (RID_SVX_START + 304) #define RID_SVXDLG_ASSIGNCOMPONENT (RID_SVX_START + 297) -#define RID_DLG_SCRIPTSELECTOR (RID_SVX_START + 259) + #define RID_SVXSTR_NEW_MENU (RID_SVX_START + 1039) #define RID_SVXSTR_NEW_TOOLBAR (RID_SVX_START + 1040) #define RID_SVXSTR_MOVE_MENU (RID_SVX_START + 1041) @@ -418,9 +425,11 @@ #define RID_SVXSTR_ERR_TEXTNOTFOUND (RID_SVX_START + 1195) #define RID_SVXSTR_SELECT_FILE_IFRAME (RID_SVX_START + 1196) +#define RID_SVXSTR_MYMACROS (RID_SVX_START + 1197) +#define RID_SVXSTR_PRODMACROS (RID_SVX_START + 1198) +#define RID_SVXSTR_SELECTOR_ADD_COMMANDS (RID_SVX_START + 1199) +#define RID_SVXSTR_SELECTOR_RUN (RID_SVX_START + 1200) -#define RID_SVXDLG_CERTPATH (RID_SVX_START + 1198) - -#define RID_CUI_DIALOG_COLORPICKER (RID_SVX_START + 3) +#define RID_SVXDLG_CERTPATH (RID_SVX_START + 1201) #endif diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc index 38ed2206142a..8387ebaab4e5 100644 --- a/cui/source/inc/helpid.hrc +++ b/cui/source/inc/helpid.hrc @@ -170,11 +170,8 @@ #define HID_SVX_CONFIG_EVENT "CUI_HID_SVX_CONFIG_EVENT" #define HID_CONFIG_EVENT_OFFICE_BASED "CUI_HID_CONFIG_EVENT_OFFICE_BASED" #define HID_CONFIG_EVENT_DOCUMENT_BASED "CUI_HID_CONFIG_EVENT_DOCUMENT_BASED" -#define HID_SELECTOR_DIALOG "CUI_HID_SELECTOR_DIALOG" -#define HID_SELECTOR_CATEGORIES "CUI_HID_SELECTOR_CATEGORIES" #define HID_SVX_CONFIG_TOOLBAR "CUI_HID_SVX_CONFIG_TOOLBAR" #define HID_SVX_CONFIG_TOOLBAR_CONTENTS "CUI_HID_SVX_CONFIG_TOOLBAR_CONTENTS" -#define HID_SELECTOR_COMMANDS "CUI_HID_SELECTOR_COMMANDS" #define HID_GALLERY_EDIT_MSNAME "CUI_HID_GALLERY_EDIT_MSNAME" #define HID_SVX_CONFIG_MENU "CUI_HID_SVX_CONFIG_MENU" #define HID_SVX_CONFIG_MENU_CONTENTS "CUI_HID_SVX_CONFIG_MENU_CONTENTS" diff --git a/cui/source/inc/selector.hxx b/cui/source/inc/selector.hxx index c4a8c7ec69d8..28459b33594b 100644 --- a/cui/source/inc/selector.hxx +++ b/cui/source/inc/selector.hxx @@ -89,9 +89,9 @@ public: virtual Image GetImage( const rtl::OUString& rCommandURL ) = 0; }; -class SvxConfigFunctionListBox_Impl : public SvTreeListBox +class SvxConfigFunctionListBox : public SvTreeListBox { -friend class SvxConfigGroupListBox_Impl; +friend class SvxConfigGroupListBox; Timer aTimer; SvTreeListEntry* pCurEntry; SvxGroupInfoArr_Impl aArr; @@ -100,13 +100,16 @@ friend class SvxConfigGroupListBox_Impl; DECL_LINK(TimerHdl, void *); virtual void MouseMove( const MouseEvent& rMEvt ); + void Init(); + public: - SvxConfigFunctionListBox_Impl( Window*, const ResId& ); - ~SvxConfigFunctionListBox_Impl(); + SvxConfigFunctionListBox(Window*, const ResId&); + SvxConfigFunctionListBox(Window* pParent); + ~SvxConfigFunctionListBox(); void ClearAll(); String GetHelpText( SvTreeListEntry *pEntry ); using Window::GetHelpText; - SvTreeListEntry* GetLastSelectedEntry(); + SvTreeListEntry* GetLastSelectedEntry(); void FunctionSelected(); // drag n drop methods @@ -118,12 +121,12 @@ public: virtual void DragFinished( sal_Int8 ); }; -class SvxConfigGroupListBox_Impl : public SvTreeListBox +class SvxConfigGroupListBox : public SvTreeListBox { SvxGroupInfoArr_Impl aArr; bool m_bShowSlots; - SvxConfigFunctionListBox_Impl* pFunctionListBox; + SvxConfigFunctionListBox* pFunctionListBox; ImageProvider* m_pImageProvider; ::com::sun::star::uno::Reference @@ -162,21 +165,23 @@ protected: using SvListView::Expand; public: - SvxConfigGroupListBox_Impl ( + SvxConfigGroupListBox ( Window* pParent, const ResId&, bool _bShowSlots, const ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame >& xFrame ); + SvxConfigGroupListBox(Window* pParent); + ~SvxConfigGroupListBox(); - ~SvxConfigGroupListBox_Impl(); + void Init(bool bShowSlots, const ::com::sun::star::uno::Reference + < ::com::sun::star::frame::XFrame >& xFrame); - void Init(); void Open( SvTreeListEntry*, sal_Bool ); void ClearAll(); void GroupSelected(); - void SetFunctionListBox( SvxConfigFunctionListBox_Impl *pBox ) + void SetFunctionListBox( SvxConfigFunctionListBox *pBox ) { pFunctionListBox = pBox; } void SetImageProvider( ImageProvider* provider ) @@ -185,26 +190,21 @@ public: class SvxScriptSelectorDialog : public ModelessDialog { - FixedText aDialogDescription; - FixedText aGroupText; - SvxConfigGroupListBox_Impl aCategories; - FixedText aFunctionText; - SvxConfigFunctionListBox_Impl aCommands; - OKButton aOKButton; - CancelButton aCancelButton; - HelpButton aHelpButton; - FixedLine aDescription; - FixedText aDescriptionText; - - sal_Bool m_bShowSlots; + FixedText* m_pDialogDescription; + SvxConfigGroupListBox* m_pCategories; + SvxConfigFunctionListBox* m_pCommands; + PushButton* m_pOKButton; + PushButton* m_pCancelButton; + VclMultiLineEdit* m_pDescriptionText; + OUString m_sDefaultDesc; + sal_Bool m_bShowSlots; Link m_aAddHdl; DECL_LINK( ClickHdl, Button * ); DECL_LINK( SelectHdl, Control* ); DECL_LINK( FunctionDoubleClickHdl, Control* ); - void UpdateUI(); - void ResizeControls(); + void UpdateUI(); public: @@ -220,8 +220,10 @@ public: void SetAddHdl( const Link& rLink ) { m_aAddHdl = rLink; } const Link& GetAddHdl() const { return m_aAddHdl; } - void SetImageProvider( ImageProvider* provider ) - { aCategories.SetImageProvider( provider ); } + void SetImageProvider(ImageProvider* provider) + { + m_pCategories->SetImageProvider(provider); + } String GetScriptURL() const; String GetSelectedDisplayName(); -- cgit v1.2.3