From f13a47fa04db2e8c653df8adf8249a89ca06b291 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 14 Nov 2013 10:40:16 +0000 Subject: convert insert slides dialog to .ui Change-Id: I9dc8366d2e8bd2ab16ce11c9e69cbdbdca0ccae5 --- extras/source/glade/libreoffice-catalog.xml.in | 3 + sd/AllLangResTarget_sd.mk | 1 - sd/UIConfig_sdraw.mk | 1 + sd/inc/helpids.h | 3 - sd/source/ui/dlg/inspagob.cxx | 59 +++++----- sd/source/ui/dlg/inspagob.src | 76 ------------- sd/source/ui/dlg/sdtreelb.cxx | 39 ++++++- sd/source/ui/inc/inspagob.hrc | 27 ----- sd/source/ui/inc/inspagob.hxx | 9 +- sd/source/ui/inc/sdtreelb.hxx | 3 +- sd/uiconfig/sdraw/ui/insertslidesdialog.ui | 145 +++++++++++++++++++++++++ 11 files changed, 219 insertions(+), 147 deletions(-) delete mode 100644 sd/source/ui/dlg/inspagob.src delete mode 100644 sd/source/ui/inc/inspagob.hrc create mode 100644 sd/uiconfig/sdraw/ui/insertslidesdialog.ui diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 6344078b3c8c..487ff00cb7ff 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -421,6 +421,9 @@ + diff --git a/sd/AllLangResTarget_sd.mk b/sd/AllLangResTarget_sd.mk index b9886970242c..3e360395dcbb 100644 --- a/sd/AllLangResTarget_sd.mk +++ b/sd/AllLangResTarget_sd.mk @@ -45,7 +45,6 @@ $(eval $(call gb_SrsTarget_add_files,sd/res,\ sd/source/ui/dlg/dlgass.src \ sd/source/ui/dlg/dlgfield.src \ sd/source/ui/dlg/dlgolbul.src \ - sd/source/ui/dlg/inspagob.src \ sd/source/ui/dlg/LayerDialog.src \ sd/source/ui/dlg/morphdlg.src \ sd/source/ui/dlg/navigatr.src \ diff --git a/sd/UIConfig_sdraw.mk b/sd/UIConfig_sdraw.mk index a578a2d3afc2..51c9726d3716 100644 --- a/sd/UIConfig_sdraw.mk +++ b/sd/UIConfig_sdraw.mk @@ -74,6 +74,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/sdraw,\ sd/uiconfig/sdraw/ui/drawpagedialog \ sd/uiconfig/sdraw/ui/drawprtldialog \ sd/uiconfig/sdraw/ui/insertlayer \ + sd/uiconfig/sdraw/ui/insertslidesdialog \ sd/uiconfig/sdraw/ui/namedesign \ sd/uiconfig/sdraw/ui/paranumberingtab \ sd/uiconfig/sdraw/ui/printeroptions \ diff --git a/sd/inc/helpids.h b/sd/inc/helpids.h index 3d6aabf52e97..1bab9f85ecca 100644 --- a/sd/inc/helpids.h +++ b/sd/inc/helpids.h @@ -101,8 +101,6 @@ #define HID_SD_UNDODELETEWARNING_DLG "SD_HID_SD_UNDODELETEWARNING_DLG" #define HID_SD_UNDODELETEWARNING_CBX "SD_HID_SD_UNDODELETEWARNING_CBX" -#define HID_SD_PAGEOBJSTLB "SD_HID_SD_PAGEOBJSTLB" - #define HID_SD_NAMEDIALOG_OBJECT "SD_HID_SD_NAMEDIALOG_OBJECT" #define HID_SD_NAMEDIALOG_PAGE "SD_HID_SD_NAMEDIALOG_PAGE" #define HID_SD_NAMEDIALOG_LINEEND "SD_HID_SD_NAMEDIALOG_LINEEND" @@ -157,7 +155,6 @@ #define HID_SD_TABLE_DESIGN "SD_HID_SD_TABLE_DESIGN" #define HID_SD_ANNOTATIONS "SD_HID_SD_ANNOTATIONS" -#define HID_DLG_INSERT_PAGES_OBJS "SD_HID_DLG_INSERT_PAGES_OBJS" #define HID_VECTORIZE_DLG "SD_HID_VECTORIZE_DLG" #define HID_MN_SUB_GRAPHIC "SD_HID_MN_SUB_GRAPHIC" diff --git a/sd/source/ui/dlg/inspagob.cxx b/sd/source/ui/dlg/inspagob.cxx index 813c54356bb5..1c1ed12d9cc2 100644 --- a/sd/source/ui/dlg/inspagob.cxx +++ b/sd/source/ui/dlg/inspagob.cxx @@ -25,30 +25,27 @@ #include "drawdoc.hxx" #include "DrawDocShell.hxx" #include "ViewShell.hxx" -#include "inspagob.hrc" SdInsertPagesObjsDlg::SdInsertPagesObjsDlg( - ::Window* pWindow, - const SdDrawDocument* pInDoc, - SfxMedium* pSfxMedium, - const OUString& rFileName ) - : ModalDialog ( pWindow, SdResId( DLG_INSERT_PAGES_OBJS ) ), - aLbTree ( this, SdResId( LB_TREE ) ), - aCbxLink ( this, SdResId( CBX_LINK ) ), - aCbxMasters ( this, SdResId( CBX_CHECK_MASTERS ) ), - aBtnOk ( this, SdResId( BTN_OK ) ), - aBtnCancel ( this, SdResId( BTN_CANCEL ) ), - aBtnHelp ( this, SdResId( BTN_HELP ) ), - pMedium ( pSfxMedium ), - mpDoc ( pInDoc ), - rName ( rFileName ) + ::Window* pWindow, const SdDrawDocument* pInDoc, + SfxMedium* pSfxMedium, const OUString& rFileName ) + : ModalDialog(pWindow, "InsertSlidesDialog", + "modules/sdraw/ui/insertslidesdialog.ui") + , pMedium(pSfxMedium) + , mpDoc(pInDoc) + , rName(rFileName) { - FreeResource(); + get(m_pLbTree, "tree"); + get(m_pCbxMasters, "backgrounds"); + get(m_pCbxLink, "links"); - aLbTree.SetViewFrame( ( (SdDrawDocument*) pInDoc )->GetDocSh()->GetViewShell()->GetViewFrame() ); + m_pLbTree->set_width_request(m_pLbTree->approximate_char_width() * 50); + m_pLbTree->set_height_request(m_pLbTree->GetTextHeight() * 12); - aLbTree.SetSelectHdl( LINK( this, SdInsertPagesObjsDlg, SelectObjectHdl ) ); + m_pLbTree->SetViewFrame( ( (SdDrawDocument*) pInDoc )->GetDocSh()->GetViewShell()->GetViewFrame() ); + + m_pLbTree->SetSelectHdl( LINK( this, SdInsertPagesObjsDlg, SelectObjectHdl ) ); // insert text if( !pMedium ) @@ -70,20 +67,20 @@ void SdInsertPagesObjsDlg::Reset() { if( pMedium ) { - aLbTree.SetSelectionMode( MULTIPLE_SELECTION ); + m_pLbTree->SetSelectionMode( MULTIPLE_SELECTION ); // transfer ownership of Medium - aLbTree.Fill( mpDoc, pMedium, rName ); + m_pLbTree->Fill( mpDoc, pMedium, rName ); } else { Color aColor( COL_WHITE ); Bitmap aBmpText( SdResId( BMP_DOC_TEXT ) ); Image aImgText( aBmpText, aColor ); - aLbTree.InsertEntry( rName, aImgText, aImgText ); + m_pLbTree->InsertEntry( rName, aImgText, aImgText ); } - aCbxMasters.Check( sal_True ); + m_pCbxMasters->Check( sal_True ); } std::vector SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType ) @@ -93,16 +90,16 @@ std::vector SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType ) { // to ensure that bookmarks are opened // (when the whole document is selected) - aLbTree.GetBookmarkDoc(); + m_pLbTree->GetBookmarkDoc(); // If the document is selected (too) or nothing is selected, // the whole document is inserted (but not more!) - if( aLbTree.GetSelectionCount() == 0 || - ( aLbTree.IsSelected( aLbTree.First() ) ) ) + if( m_pLbTree->GetSelectionCount() == 0 || + ( m_pLbTree->IsSelected( m_pLbTree->First() ) ) ) return std::vector(); } - return aLbTree.GetSelectEntryList( nType ); + return m_pLbTree->GetSelectEntryList( nType ); } /** @@ -110,7 +107,7 @@ std::vector SdInsertPagesObjsDlg::GetList( const sal_uInt16 nType ) */ sal_Bool SdInsertPagesObjsDlg::IsLink() { - return( aCbxLink.IsChecked() ); + return( m_pCbxLink->IsChecked() ); } /** @@ -118,7 +115,7 @@ sal_Bool SdInsertPagesObjsDlg::IsLink() */ sal_Bool SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const { - return( aCbxMasters.IsChecked() ); + return( m_pCbxMasters->IsChecked() ); } /** @@ -126,10 +123,10 @@ sal_Bool SdInsertPagesObjsDlg::IsRemoveUnnessesaryMasterPages() const */ IMPL_LINK_NOARG(SdInsertPagesObjsDlg, SelectObjectHdl) { - if( aLbTree.IsLinkableSelected() ) - aCbxLink.Enable(); + if( m_pLbTree->IsLinkableSelected() ) + m_pCbxLink->Enable(); else - aCbxLink.Disable(); + m_pCbxLink->Disable(); return( 0 ); } diff --git a/sd/source/ui/dlg/inspagob.src b/sd/source/ui/dlg/inspagob.src deleted file mode 100644 index b26936e0c7fc..000000000000 --- a/sd/source/ui/dlg/inspagob.src +++ /dev/null @@ -1,76 +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/. - * - * 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 "helpids.h" -#include "inspagob.hrc" - -ModalDialog DLG_INSERT_PAGES_OBJS -{ - HelpID = HID_DLG_INSERT_PAGES_OBJS ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 200 , 128 ) ; - Moveable = TRUE ; - Text [ en-US ] = "Insert Slides/Objects" ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 144 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 144 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 144 , 46 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - Control LB_TREE - { - HelpId = HID_SD_PAGEOBJSTLB; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 132 , 88 ) ; - TabStop = TRUE ; - }; - CheckBox CBX_LINK - { - HelpID = "sd:CheckBox:DLG_INSERT_PAGES_OBJS:CBX_LINK"; - Pos = MAP_APPFONT ( 6 , 100 ) ; - Size = MAP_APPFONT ( 140 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Link" ; - }; - CheckBox CBX_CHECK_MASTERS - { - HelpID = "sd:CheckBox:DLG_INSERT_PAGES_OBJS:CBX_CHECK_MASTERS"; - Pos = MAP_APPFONT ( 6 , 114 ) ; - Size = MAP_APPFONT ( 140 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Delete unused backg~rounds"; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index f01c00cb7554..311d17846bca 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -100,8 +100,14 @@ SdPageObjsTLB::SdPageObjsTransferable::SdPageObjsTransferable( { } - - +extern "C" SAL_DLLPUBLIC_EXPORT ::Window* SAL_CALL makeSdPageObjsTLB(::Window *pParent, VclBuilder::stringmap &rMap) +{ + WinBits nWinStyle = WB_TABSTOP; + OString sBorder = VclBuilder::extractCustomProperty(rMap); + if (!sBorder.isEmpty()) + nWinStyle |= WB_BORDER; + return new SdPageObjsTLB(pParent, nWinStyle); +} SdPageObjsTLB::SdPageObjsTransferable::~SdPageObjsTransferable() { @@ -243,6 +249,35 @@ SdPageObjsTLB::SdPageObjsTLB( Window* pParentWin, const SdResId& rSdResId ) SV_DRAGDROP_APP_MOVE | SV_DRAGDROP_APP_COPY | SV_DRAGDROP_APP_DROP ); } +SdPageObjsTLB::SdPageObjsTLB( Window* pParentWin, WinBits nStyle ) +: SvTreeListBox ( pParentWin, nStyle ) +, mpParent ( pParentWin ) +, mpDoc ( NULL ) +, mpBookmarkDoc ( NULL ) +, mpMedium ( NULL ) +, mpOwnMedium ( NULL ) +, maImgOle ( BitmapEx( SdResId( BMP_OLE ) ) ) +, maImgGraphic ( BitmapEx( SdResId( BMP_GRAPHIC ) ) ) +, mbLinkableSelected ( sal_False ) +, mpDropNavWin ( NULL ) +, mbShowAllShapes ( false ) +, mbShowAllPages ( false ) + +{ + // add lines to Tree-ListBox + SetStyle( GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES | + WB_HASBUTTONS | // WB_HASLINESATROOT | + WB_HSCROLL | + WB_HASBUTTONSATROOT | + WB_QUICK_SEARCH /* i31275 */ ); + SetNodeBitmaps( Image(Bitmap( SdResId(BMP_EXPAND) )), + Image(Bitmap( SdResId(BMP_COLLAPSE) ))); + + SetDragDropMode( + SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY | + SV_DRAGDROP_APP_MOVE | SV_DRAGDROP_APP_COPY | SV_DRAGDROP_APP_DROP ); +} + SdPageObjsTLB::~SdPageObjsTLB() { diff --git a/sd/source/ui/inc/inspagob.hrc b/sd/source/ui/inc/inspagob.hrc deleted file mode 100644 index 4248b25282cc..000000000000 --- a/sd/source/ui/inc/inspagob.hrc +++ /dev/null @@ -1,27 +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/. - * - * 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 DLG_INSERT_PAGES_OBJS 938 -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define LB_TREE 1 -#define CBX_LINK 1 -#define CBX_CHECK_MASTERS 2 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/inspagob.hxx b/sd/source/ui/inc/inspagob.hxx index a0d2da4ad745..ae2f68aa770e 100644 --- a/sd/source/ui/inc/inspagob.hxx +++ b/sd/source/ui/inc/inspagob.hxx @@ -31,12 +31,9 @@ class SdDrawDocument; class SdInsertPagesObjsDlg : public ModalDialog { private: - SdPageObjsTLB aLbTree; - CheckBox aCbxLink; - CheckBox aCbxMasters; - OKButton aBtnOk; - CancelButton aBtnCancel; - HelpButton aBtnHelp; + SdPageObjsTLB* m_pLbTree; + CheckBox* m_pCbxLink; + CheckBox* m_pCbxMasters; SfxMedium* pMedium; const SdDrawDocument* mpDoc; diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index f78d5becb34a..252a40384144 100644 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -179,7 +179,8 @@ protected: public: - SdPageObjsTLB( Window* pParent, const SdResId& rSdResId ); + SdPageObjsTLB( Window* pParent, const SdResId& rSdResId ); + SdPageObjsTLB( Window* pParent, WinBits nStyle ); ~SdPageObjsTLB(); virtual void SelectHdl(); diff --git a/sd/uiconfig/sdraw/ui/insertslidesdialog.ui b/sd/uiconfig/sdraw/ui/insertslidesdialog.ui new file mode 100644 index 000000000000..8a66c1fcb2dc --- /dev/null +++ b/sd/uiconfig/sdraw/ui/insertslidesdialog.ui @@ -0,0 +1,145 @@ + + + + + + False + 6 + Insert Slides/Objects + dialog + + + False + vertical + 12 + + + False + 5 + end + + + gtk-ok + True + True + True + True + True + True + + + False + True + 0 + + + + + gtk-cancel + True + True + True + True + + + False + True + 1 + + + + + gtk-help + True + True + True + True + + + False + True + 2 + + + + + False + True + end + 0 + + + + + True + False + True + True + 6 + + + Delete unused backg_rounds + True + True + False + True + 0 + True + + + 0 + 2 + 1 + 1 + + + + + _Link + True + True + False + True + 0 + True + + + 0 + 1 + 1 + 1 + + + + + True + False + True + True + + + + + + 0 + 0 + 1 + 1 + + + + + False + True + 1 + + + + + + ok + cancel + help + + + -- cgit v1.2.3