From 0dc13e9c06bf5bc188b427f0760d0dc2eee8f75e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 10 Jun 2014 12:32:03 +0100 Subject: tweak things to allow switching between small and large toolbar icons Change-Id: Ife4da4c6f4acc3b3f9fde18cdfc09635cf9b6776 --- dbaccess/inc/dbaccess_helpid.hrc | 7 - dbaccess/source/ui/dlg/indexdialog.cxx | 75 +++++--- dbaccess/source/ui/inc/indexdialog.hxx | 31 +++- dbaccess/source/ui/misc/ToolBoxHelper.cxx | 5 +- dbaccess/uiconfig/ui/indexdesigndialog.ui | 260 ++++++++++++++++++--------- include/dbaccess/ToolBoxHelper.hxx | 9 +- reportdesign/source/ui/dlg/AddField.cxx | 4 +- reportdesign/source/ui/dlg/Condition.cxx | 5 +- reportdesign/source/ui/dlg/Condition.hxx | 4 +- reportdesign/source/ui/dlg/GroupsSorting.cxx | 5 +- reportdesign/source/ui/inc/AddField.hxx | 4 +- reportdesign/source/ui/inc/GroupsSorting.hxx | 4 +- 12 files changed, 270 insertions(+), 143 deletions(-) diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc index 407c414b166c..873e657efe74 100644 --- a/dbaccess/inc/dbaccess_helpid.hrc +++ b/dbaccess/inc/dbaccess_helpid.hrc @@ -126,12 +126,6 @@ #define HID_DSADMIN_MOZILLA_PROFILE_NAME "DBACCESS_HID_DSADMIN_MOZILLA_PROFILE_NAME" #define HID_DSADMIN_THUNDERBIRD_PROFILE_NAME "DBACCESS_HID_DSADMIN_THUNDERBIRD_PROFILE_NAME" -#define HID_DLGIDX_NEWINDEX "DBACCESS_HID_DLGIDX_NEWINDEX" -#define HID_DLGIDX_DROPINDEX "DBACCESS_HID_DLGIDX_DROPINDEX" -#define HID_DLGIDX_RENAMEINDEX "DBACCESS_HID_DLGIDX_RENAMEINDEX" -#define HID_DLGIDX_SAVEINDEX "DBACCESS_HID_DLGIDX_SAVEINDEX" -#define HID_DLGIDX_RESETINDEX "DBACCESS_HID_DLGIDX_RESETINDEX" -#define HID_DLGIDX_INDEXLIST "DBACCESS_HID_DLGIDX_INDEXLIST" #define UID_DLGINDEX_INDEXDETAILS_BACK "DBACCESS_UID_DLGINDEX_INDEXDETAILS_BACK" #define UID_DLGINDEX_INDEXDETAILS_MAIN "DBACCESS_UID_DLGINDEX_INDEXDETAILS_MAIN" #define HID_DLGINDEX_INDEXDETAILS_FIELD "DBACCESS_HID_DLGINDEX_INDEXDETAILS_FIELD" @@ -249,7 +243,6 @@ #define HID_PAGE_DBWIZARD_USERDEFINED_ET_BROWSE "DBACCESS_HID_PAGE_DBWIZARD_USERDEFINED_ET_BROWSE" #define HID_PAGE_DBWIZARD_USERDEFINED_BROWSE "DBACCESS_HID_PAGE_DBWIZARD_USERDEFINED_BROWSE" -#define HID_INDEX_DIALOG_ACTION_TB "DBACCESS_HID_INDEX_DIALOG_ACTION_TB" #define HID_DLG_DATABASE_WIZARD "DBACCESS_HID_DLG_DATABASE_WIZARD" diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx index 3c5cfacc08d2..7de55fa128e8 100644 --- a/dbaccess/source/ui/dlg/indexdialog.cxx +++ b/dbaccess/source/ui/dlg/indexdialog.cxx @@ -177,14 +177,38 @@ namespace dbaui ,m_xContext(_rxContext) { get(m_pActions, "ACTIONS"); + + mnNewCmdId = m_pActions->GetItemId(INDEX_NEW_CMD); + mnDropCmdId = m_pActions->GetItemId(INDEX_DROP_CMD); + mnRenameCmdId = m_pActions->GetItemId(INDEX_RENAME_CMD); + mnSaveCmdId = m_pActions->GetItemId(INDEX_SAVE_CMD); + mnResetCmdId = m_pActions->GetItemId(INDEX_RESET_CMD); + + maScNewCmdImg = m_pActions->GetItemImage(mnNewCmdId); + maScDropCmdImg = m_pActions->GetItemImage(mnDropCmdId); + maScRenameCmdImg = m_pActions->GetItemImage(mnRenameCmdId); + maScSaveCmdImg = m_pActions->GetItemImage(mnSaveCmdId); + maScResetCmdImg = m_pActions->GetItemImage(mnResetCmdId); + maLcNewCmdImg = get("image1")->GetImage(); + maLcDropCmdImg = get("image2")->GetImage(); + maLcRenameCmdImg = get("image3")->GetImage(); + maLcSaveCmdImg = get("image4")->GetImage(); + maLcResetCmdImg = get("image5")->GetImage(); + get(m_pIndexList, "INDEX_LIST"); + Size aSize(LogicToPixel(Size(70, 97), MAP_APPFONT)); + m_pIndexList->set_width_request(aSize.Width()); + m_pIndexList->set_height_request(aSize.Height()); get(m_pIndexDetails, "INDEX_DETAILS"); get(m_pDescriptionLabel, "DESC_LABEL"); get(m_pDescription, "DESCRIPTION"); get(m_pUnique, "UNIQUE"); get(m_pFieldsLabel, "FIELDS_LABEL"); get(m_pFields, "FIELDS"); - get(m_pClose, "CLOSE"); + aSize = LogicToPixel(Size(128, 61), MAP_APPFONT); + m_pFields->set_width_request(aSize.Width()); + m_pFields->set_height_request(aSize.Height()); + get(m_pClose, "close"); m_pActions->SetSelectHdl(LINK(this, DbaIndexDialog, OnIndexAction)); @@ -242,7 +266,7 @@ namespace dbaui void DbaIndexDialog::updateToolbox() { - m_pActions->EnableItem(m_pActions->GetItemId(INDEX_NEW_CMD), !m_pIndexList->IsEditingActive()); + m_pActions->EnableItem(mnNewCmdId, !m_pIndexList->IsEditingActive()); SvTreeListEntry* pSelected = m_pIndexList->FirstSelected(); bool bSelectedAnything = NULL != pSelected; @@ -251,17 +275,17 @@ namespace dbaui { // is the current entry modified? Indexes::const_iterator aSelectedPos = m_pIndexes->begin() + reinterpret_cast(pSelected->GetUserData()); - m_pActions->EnableItem(m_pActions->GetItemId(INDEX_SAVE_CMD), aSelectedPos->isModified() || aSelectedPos->isNew()); - m_pActions->EnableItem(m_pActions->GetItemId(INDEX_RESET_CMD), aSelectedPos->isModified() || aSelectedPos->isNew()); + m_pActions->EnableItem(mnSaveCmdId, aSelectedPos->isModified() || aSelectedPos->isNew()); + m_pActions->EnableItem(mnResetCmdId, aSelectedPos->isModified() || aSelectedPos->isNew()); bSelectedAnything = bSelectedAnything && !aSelectedPos->bPrimaryKey; } else { - m_pActions->EnableItem(m_pActions->GetItemId(INDEX_SAVE_CMD), false); - m_pActions->EnableItem(m_pActions->GetItemId(INDEX_RESET_CMD), false); + m_pActions->EnableItem(mnSaveCmdId, false); + m_pActions->EnableItem(mnResetCmdId, false); } - m_pActions->EnableItem(m_pActions->GetItemId(INDEX_DROP_CMD), bSelectedAnything); - m_pActions->EnableItem(m_pActions->GetItemId(INDEX_RENAME_CMD), bSelectedAnything); + m_pActions->EnableItem(mnDropCmdId, bSelectedAnything); + m_pActions->EnableItem(mnRenameCmdId, bSelectedAnything); } void DbaIndexDialog::fillIndexList() @@ -508,17 +532,16 @@ namespace dbaui IMPL_LINK( DbaIndexDialog, OnIndexAction, ToolBox*, /*NOTINTERESTEDIN*/ ) { - const OUString sClicked(m_pActions->GetItemCommand(m_pActions->GetCurItemId())); - - if(sClicked == INDEX_NEW_CMD) + sal_uInt16 nClicked = m_pActions->GetCurItemId(); + if (nClicked == mnNewCmdId) OnNewIndex(); - else if(sClicked == INDEX_DROP_CMD) + else if (nClicked == mnDropCmdId) OnDropIndex(); - else if(sClicked == INDEX_RENAME_CMD) + else if (nClicked == mnRenameCmdId) OnRenameIndex(); - else if(sClicked == INDEX_SAVE_CMD) + else if (nClicked == mnSaveCmdId) OnSaveIndex(); - else if(sClicked == INDEX_RESET_CMD) + else if (nClicked == mnResetCmdId) OnResetIndex(); return 0L; @@ -804,16 +827,28 @@ namespace dbaui checkImageList(); } } - ImageList DbaIndexDialog::getImageList(sal_Int16 _eBitmapSet) const + + void DbaIndexDialog::setImageList(sal_Int16 _eBitmapSet) { - sal_Int16 nN = IMG_INDEX_DLG_SC; if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE ) { - nN = IMG_INDEX_DLG_LC; + m_pActions->SetItemImage(mnNewCmdId, maLcNewCmdImg); + m_pActions->SetItemImage(mnDropCmdId, maLcDropCmdImg); + m_pActions->SetItemImage(mnRenameCmdId, maLcRenameCmdImg); + m_pActions->SetItemImage(mnSaveCmdId, maLcSaveCmdImg); + m_pActions->SetItemImage(mnResetCmdId, maLcResetCmdImg); + } + else + { + m_pActions->SetItemImage(mnNewCmdId, maScNewCmdImg); + m_pActions->SetItemImage(mnDropCmdId, maScDropCmdImg); + m_pActions->SetItemImage(mnRenameCmdId, maScRenameCmdImg); + m_pActions->SetItemImage(mnSaveCmdId, maScSaveCmdImg); + m_pActions->SetItemImage(mnResetCmdId, maScResetCmdImg); } - return ImageList(ModuleRes(nN)); } - void DbaIndexDialog::resizeControls(const Size& _rDiff) + + void DbaIndexDialog::resizeControls(const Size&) { } diff --git a/dbaccess/source/ui/inc/indexdialog.hxx b/dbaccess/source/ui/inc/indexdialog.hxx index 057c6a4d2f97..3aa05ffafe8e 100644 --- a/dbaccess/source/ui/inc/indexdialog.hxx +++ b/dbaccess/source/ui/inc/indexdialog.hxx @@ -115,18 +115,14 @@ namespace dbaui virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; - /** will be called whenthe id of the image list is needed. + //TO-DO, remove when all other OToolBoxHelper are converted to .ui + virtual void resizeControls(const Size&) SAL_OVERRIDE; + + /** will be called when the id of the image list needs to change @param _eBitmapSet - @param _bHiContast - when in high contrast mode. - */ - virtual ImageList getImageList(sal_Int16 _eBitmapSet) const SAL_OVERRIDE; - - /** will be called when the controls need to be resized. */ - virtual void resizeControls(const Size& _rDiff) SAL_OVERRIDE; - + virtual void setImageList(sal_Int16 _eBitmapSet) SAL_OVERRIDE; protected: void fillIndexList(); void updateToolbox(); @@ -142,6 +138,23 @@ namespace dbaui DECL_LINK( OnEditIndexAgain, SvTreeListEntry* ); private: + sal_uInt16 mnNewCmdId; + sal_uInt16 mnDropCmdId; + sal_uInt16 mnRenameCmdId; + sal_uInt16 mnSaveCmdId; + sal_uInt16 mnResetCmdId; + + Image maScNewCmdImg; + Image maScDropCmdImg; + Image maScRenameCmdImg; + Image maScSaveCmdImg; + Image maScResetCmdImg; + Image maLcNewCmdImg; + Image maLcDropCmdImg; + Image maLcRenameCmdImg; + Image maLcSaveCmdImg; + Image maLcResetCmdImg; + void OnNewIndex(); void OnDropIndex(bool _bConfirm = true); void OnRenameIndex(); diff --git a/dbaccess/source/ui/misc/ToolBoxHelper.cxx b/dbaccess/source/ui/misc/ToolBoxHelper.cxx index c9e0df35d99f..0e05165bcaad 100644 --- a/dbaccess/source/ui/misc/ToolBoxHelper.cxx +++ b/dbaccess/source/ui/misc/ToolBoxHelper.cxx @@ -29,7 +29,7 @@ namespace dbaui { OToolBoxHelper::OToolBoxHelper() - : m_nSymbolsSize(-1 ) + : m_nSymbolsSize(-1) , m_pToolBox(NULL) { @@ -51,8 +51,8 @@ namespace dbaui if ( nCurSymbolsSize != m_nSymbolsSize ) { m_nSymbolsSize = nCurSymbolsSize; + setImageList(m_nSymbolsSize); - m_pToolBox->SetImageList( getImageList(m_nSymbolsSize) ); Size aTbOldSize = m_pToolBox->GetSizePixel(); adjustToolBoxSize(m_pToolBox); Size aTbNewSize = m_pToolBox->GetSizePixel(); @@ -62,6 +62,7 @@ namespace dbaui } } } + IMPL_LINK(OToolBoxHelper, ConfigOptionsChanged, SvtMiscOptions*, /*_pOptions*/) { if ( m_pToolBox ) diff --git a/dbaccess/uiconfig/ui/indexdesigndialog.ui b/dbaccess/uiconfig/ui/indexdesigndialog.ui index 0c6b91d304ec..3068894d5df2 100755 --- a/dbaccess/uiconfig/ui/indexdesigndialog.ui +++ b/dbaccess/uiconfig/ui/indexdesigndialog.ui @@ -1,11 +1,11 @@ + - + + - 500 - 300 False - 5 + 6 Indexes dialog @@ -18,13 +18,12 @@ False end - - gtk-cancel + + gtk-close False True True True - False True @@ -34,13 +33,12 @@ - + gtk-help False True True True - False True @@ -64,92 +62,175 @@ vertical 6 - + True False - - False - True - False - start - False - .index:createNew - New Index - True - dbaccess/res/lc036.png - - - False - True - - - - - False - True - False - start - False - .index:dropCurrent - Delete Current Index - True - dbaccess/res/lc037.png - - - False - True - - - - - False - True - False - start - False - .index:renameCurrent - Rename Current Index - True - dbaccess/res/lc038.png - - - False - True - - - - - False + True False - start - False - .index:saveCurrent - Save Current Index - True - dbaccess/res/lc039.png + + + True + False + start + .index:createNew + New Index + True + dbaccess/res/sc036.png + + + False + True + + + + + True + False + start + .index:dropCurrent + Delete Current Index + True + dbaccess/res/sc037.png + + + False + True + + + + + True + False + start + .index:renameCurrent + Rename Current Index + True + dbaccess/res/sc038.png + + + False + True + + + + + True + False + start + .index:saveCurrent + Save Current Index + True + dbaccess/res/sc039.png + + + False + True + + + + + True + False + start + .index:resetCurrent + Reset Current Index + True + dbaccess/res/sc040.png + + + False + True + + - False - True + 0 + 0 + 1 + 1 - - False - True + False - start - False - .index:resetCurrent - Reset Current Index - True - dbaccess/res/lc040.png + True + end + center + True + 12 + + + True + False + dbaccess/res/lc036.png + + + 0 + 0 + 1 + 1 + + + + + True + False + dbaccess/res/lc037.png + + + 1 + 0 + 1 + 1 + + + + + True + False + dbaccess/res/lc038.png + + + 2 + 0 + 1 + 1 + + + + + True + False + dbaccess/res/lc039.png + + + 3 + 0 + 1 + 1 + + + + + True + False + dbaccess/res/lc040.png + + + 4 + 0 + 1 + 1 + + - False - True + 1 + 0 + 1 + 1 @@ -231,7 +312,6 @@ True False start - False True 0 True @@ -248,6 +328,8 @@ False start Fields + True + FIELDS False @@ -257,12 +339,13 @@ - 210 - 100 True True True True + + + True @@ -284,6 +367,9 @@ False True True + + + 0 @@ -309,8 +395,8 @@ - CLOSE - HELP + close + help diff --git a/include/dbaccess/ToolBoxHelper.hxx b/include/dbaccess/ToolBoxHelper.hxx index e06dc308e8a8..6fe04d5423ac 100644 --- a/include/dbaccess/ToolBoxHelper.hxx +++ b/include/dbaccess/ToolBoxHelper.hxx @@ -42,16 +42,17 @@ namespace dbaui /** will be called when the controls need to be resized. @param _rDiff Contains the difference of the old and new toolbox size. + + TO-DO: remove this when all implmentations + are converted to .ui format */ virtual void resizeControls(const Size& _rDiff) = 0; - /** will be called when the image list is needed. + /** will be called when the image list needs to change @param _eSymbolsSize - @param _bHiContast - when in high contrast mode. */ - virtual ImageList getImageList(sal_Int16 _eSymbolsSize) const = 0; + virtual void setImageList(sal_Int16 _eSymbolsSize) = 0; /** only the member will be set, derived classes can overload this function and do what need to be done. @param _pTB diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx index c8bb5cff7de4..1b447be68c85 100644 --- a/reportdesign/source/ui/dlg/AddField.cxx +++ b/reportdesign/source/ui/dlg/AddField.cxx @@ -490,12 +490,12 @@ IMPL_LINK( OAddFieldWindow, OnDoubleClickHdl, void* ,/*_pAddFieldDlg*/) return 0L; } -ImageList OAddFieldWindow::getImageList(sal_Int16 _eBitmapSet) const +void OAddFieldWindow::setImageList(sal_Int16 _eBitmapSet) { sal_Int16 nN = IMG_ADDFIELD_DLG_SC; if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE ) nN = IMG_ADDFIELD_DLG_LC; - return ImageList(ModuleRes(nN)); + m_aActions.SetImageList(ImageList(ModuleRes(nN))); } void OAddFieldWindow::resizeControls(const Size& _rDiff) diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index 3d22579bdd14..d41009d02d3a 100644 --- a/reportdesign/source/ui/dlg/Condition.cxx +++ b/reportdesign/source/ui/dlg/Condition.cxx @@ -365,7 +365,6 @@ IMPL_LINK( Condition, OnConditionAction, Button*, _pClickedButton ) return 0L; } - void Condition::ApplyCommand( sal_uInt16 _nCommandId, const ::Color& _rColor) { if ( _nCommandId == SID_ATTR_CHAR_COLOR2 ) @@ -376,12 +375,12 @@ void Condition::ApplyCommand( sal_uInt16 _nCommandId, const ::Color& _rColor) m_rAction.applyCommand( m_nCondIndex, _nCommandId, _rColor ); } -ImageList Condition::getImageList(sal_Int16 _eBitmapSet) const +void Condition::setImageList(sal_Int16 _eBitmapSet) { sal_Int16 nN = IMG_CONDFORMAT_DLG_SC; if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE ) nN = IMG_CONDFORMAT_DLG_LC; - return ImageList(ModuleRes(nN)); + m_aActions.SetImageList(ImageList(ModuleRes(nN))); } void Condition::resizeControls(const Size& _rDiff) diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx index 2e1b66db3e46..b28b43ab3537 100644 --- a/reportdesign/source/ui/dlg/Condition.hxx +++ b/reportdesign/source/ui/dlg/Condition.hxx @@ -98,11 +98,11 @@ namespace rptui Condition( Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController ); virtual ~Condition(); - /** will be called when the id of the image list is needed. + /** will be called when the id of the image list needs to change. @param _eBitmapSet */ - virtual ImageList getImageList(sal_Int16 _eBitmapSet) const SAL_OVERRIDE; + virtual void setImageList(sal_Int16 _eBitmapSet) SAL_OVERRIDE; /** will be called when the controls need to be resized. */ diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index c25262f56c70..a77fcadb1cc8 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -1404,15 +1404,14 @@ void OGroupsSortingDialog::checkButtons(sal_Int32 _nRow) } } -ImageList OGroupsSortingDialog::getImageList(sal_Int16 _eBitmapSet) const +void OGroupsSortingDialog::setImageList(sal_Int16 _eBitmapSet) { sal_Int16 nN = IMG_CONDFORMAT_DLG_SC; if ( _eBitmapSet == SFX_SYMBOLS_SIZE_LARGE ) nN = IMG_CONDFORMAT_DLG_LC; - return ImageList(ModuleRes( nN )); + m_aToolBox.SetImageList(ImageList(ModuleRes(nN))); } - void OGroupsSortingDialog::resizeControls(const Size& _rDiff) { // we use large images so we must change them diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx index 524c08abe87c..3c188f925d4c 100644 --- a/reportdesign/source/ui/inc/AddField.hxx +++ b/reportdesign/source/ui/inc/AddField.hxx @@ -94,11 +94,11 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors(); - /** will be called when the id of the image list is needed. + /** will be called when the id of the image list needs to change. @param _eBitmapSet */ - virtual ImageList getImageList(sal_Int16 _eBitmapSet) const SAL_OVERRIDE; + virtual void setImageList(sal_Int16 _eBitmapSet) SAL_OVERRIDE; /** will be called when the controls need to be resized. */ diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx index a36d64e6594c..feb4d4d42436 100644 --- a/reportdesign/source/ui/inc/GroupsSorting.hxx +++ b/reportdesign/source/ui/inc/GroupsSorting.hxx @@ -172,11 +172,11 @@ public: */ virtual void resizeControls(const Size& _rDiff) SAL_OVERRIDE; - /** will be called when the image list is needed. + /** will be called when the image list needs to change @param _eSymbolsSize */ - virtual ImageList getImageList(sal_Int16 _eSymbolsSize) const SAL_OVERRIDE; + virtual void setImageList(sal_Int16 _eSymbolsSize) SAL_OVERRIDE; // ImageListProvider interface virtual ImageList getImageList(vcl::ImageListType) SAL_OVERRIDE; -- cgit