1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sd.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/text/WritingMode.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/frame/status/FontHeight.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/drawing/DrawViewMode.hpp> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include <memory> 40*cdf0e10cSrcweir #include <boost/scoped_ptr.hpp> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #include <vos/mutex.hxx> 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir #include <vcl/svapp.hxx> 45*cdf0e10cSrcweir #include <vcl/toolbox.hxx> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #include <svl/languageoptions.hxx> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include <svtools/ctrltool.hxx> 50*cdf0e10cSrcweir #include <svtools/ctrlbox.hxx> 51*cdf0e10cSrcweir #include <svtools/toolbarmenu.hxx> 52*cdf0e10cSrcweir #include <svtools/valueset.hxx> 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir #include <sfx2/imagemgr.hxx> 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir #include "app.hrc" 59*cdf0e10cSrcweir #include "glob.hrc" 60*cdf0e10cSrcweir #include "strings.hrc" 61*cdf0e10cSrcweir #include "res_bmp.hrc" 62*cdf0e10cSrcweir #include "sdresid.hxx" 63*cdf0e10cSrcweir #include "pres.hxx" 64*cdf0e10cSrcweir #include "slidelayoutcontroller.hxx" 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir using rtl::OUString; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir using namespace ::com::sun::star; 69*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 70*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 71*cdf0e10cSrcweir using namespace ::com::sun::star::text; 72*cdf0e10cSrcweir using namespace ::com::sun::star::frame; 73*cdf0e10cSrcweir using namespace ::com::sun::star::drawing; 74*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir namespace sd 77*cdf0e10cSrcweir { 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir extern ::rtl::OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const OUString& aCmdURL ); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir // ----------------------------------------------------------------------- 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir class LayoutToolbarMenu : public svtools::ToolbarMenu 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir public: 86*cdf0e10cSrcweir LayoutToolbarMenu( SlideLayoutController& rController, const Reference< XFrame >& xFrame, ::Window* pParent, const bool bInsertPage ); 87*cdf0e10cSrcweir virtual ~LayoutToolbarMenu(); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir protected: 90*cdf0e10cSrcweir DECL_LINK( SelectHdl, void * ); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir private: 93*cdf0e10cSrcweir SlideLayoutController& mrController; 94*cdf0e10cSrcweir Reference< XFrame > mxFrame; 95*cdf0e10cSrcweir bool mbInsertPage; 96*cdf0e10cSrcweir ValueSet* mpLayoutSet1; 97*cdf0e10cSrcweir ValueSet* mpLayoutSet2; 98*cdf0e10cSrcweir }; 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir // ----------------------------------------------------------------------- 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir struct snewfoil_value_info 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir sal_uInt16 mnBmpResId; 105*cdf0e10cSrcweir sal_uInt16 mnHCBmpResId; 106*cdf0e10cSrcweir sal_uInt16 mnStrResId; 107*cdf0e10cSrcweir WritingMode meWritingMode; 108*cdf0e10cSrcweir AutoLayout maAutoLayout; 109*cdf0e10cSrcweir }; 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir static snewfoil_value_info notes[] = 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir {BMP_FOILN_01, BMP_FOILN_01_H, STR_AUTOLAYOUT_NOTES, WritingMode_LR_TB, 114*cdf0e10cSrcweir AUTOLAYOUT_NOTES}, 115*cdf0e10cSrcweir {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}, 116*cdf0e10cSrcweir }; 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir static snewfoil_value_info handout[] = 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir {BMP_FOILH_01, BMP_FOILH_01_H, STR_AUTOLAYOUT_HANDOUT1, WritingMode_LR_TB, 121*cdf0e10cSrcweir AUTOLAYOUT_HANDOUT1}, 122*cdf0e10cSrcweir {BMP_FOILH_02, BMP_FOILH_02_H, STR_AUTOLAYOUT_HANDOUT2, WritingMode_LR_TB, 123*cdf0e10cSrcweir AUTOLAYOUT_HANDOUT2}, 124*cdf0e10cSrcweir {BMP_FOILH_03, BMP_FOILH_03_H, STR_AUTOLAYOUT_HANDOUT3, WritingMode_LR_TB, 125*cdf0e10cSrcweir AUTOLAYOUT_HANDOUT3}, 126*cdf0e10cSrcweir {BMP_FOILH_04, BMP_FOILH_04_H, STR_AUTOLAYOUT_HANDOUT4, WritingMode_LR_TB, 127*cdf0e10cSrcweir AUTOLAYOUT_HANDOUT4}, 128*cdf0e10cSrcweir {BMP_FOILH_06, BMP_FOILH_06_H, STR_AUTOLAYOUT_HANDOUT6, WritingMode_LR_TB, 129*cdf0e10cSrcweir AUTOLAYOUT_HANDOUT6}, 130*cdf0e10cSrcweir {BMP_FOILH_09, BMP_FOILH_09_H, STR_AUTOLAYOUT_HANDOUT9, WritingMode_LR_TB, 131*cdf0e10cSrcweir AUTOLAYOUT_HANDOUT9}, 132*cdf0e10cSrcweir {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}, 133*cdf0e10cSrcweir }; 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir static snewfoil_value_info standard[] = 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir {BMP_LAYOUT_EMPTY, BMP_LAYOUT_EMPTY_H, STR_AUTOLAYOUT_NONE, WritingMode_LR_TB, AUTOLAYOUT_NONE}, 138*cdf0e10cSrcweir {BMP_LAYOUT_HEAD03, BMP_LAYOUT_HEAD03_H, STR_AUTOLAYOUT_TITLE, WritingMode_LR_TB, AUTOLAYOUT_TITLE}, 139*cdf0e10cSrcweir {BMP_LAYOUT_HEAD02, BMP_LAYOUT_HEAD02_H, STR_AUTOLAYOUT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_ENUM}, 140*cdf0e10cSrcweir {BMP_LAYOUT_HEAD02A, BMP_LAYOUT_HEAD02A_H, STR_AUTOLAYOUT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2TEXT}, 141*cdf0e10cSrcweir {BMP_LAYOUT_HEAD01, BMP_LAYOUT_HEAD01_H, STR_AUTOLAYOUT_ONLY_TITLE, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TITLE}, 142*cdf0e10cSrcweir {BMP_LAYOUT_TEXTONLY, BMP_LAYOUT_TEXTONLY_H, STR_AUTOLAYOUT_ONLY_TEXT, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TEXT}, 143*cdf0e10cSrcweir {BMP_LAYOUT_HEAD03B, BMP_LAYOUT_HEAD03B_H, STR_AUTOLAYOUT_2CONTENT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2OBJTEXT}, 144*cdf0e10cSrcweir {BMP_LAYOUT_HEAD03C, BMP_LAYOUT_HEAD03C_H, STR_AUTOLAYOUT_CONTENT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_TEXT2OBJ}, 145*cdf0e10cSrcweir {BMP_LAYOUT_HEAD03A, BMP_LAYOUT_HEAD03A_H, STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT,WritingMode_LR_TB, AUTOLAYOUT_2OBJOVERTEXT}, 146*cdf0e10cSrcweir {BMP_LAYOUT_HEAD02B, BMP_LAYOUT_HEAD02B_H, STR_AUTOLAYOUT_CONTENT_OVER_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_OBJOVERTEXT}, 147*cdf0e10cSrcweir {BMP_LAYOUT_HEAD04, BMP_LAYOUT_HEAD04_H, STR_AUTOLAYOUT_4CONTENT, WritingMode_LR_TB, AUTOLAYOUT_4OBJ}, 148*cdf0e10cSrcweir {BMP_LAYOUT_HEAD06, BMP_LAYOUT_HEAD06_H, STR_AUTOLAYOUT_6CONTENT, WritingMode_LR_TB, AUTOLAYOUT_6CLIPART}, 149*cdf0e10cSrcweir {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE} 150*cdf0e10cSrcweir }; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir static snewfoil_value_info v_standard[] = 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir // vertical 155*cdf0e10cSrcweir {BMP_LAYOUT_VERTICAL02, BMP_LAYOUT_VERTICAL02_H, STR_AL_VERT_TITLE_TEXT_CHART, WritingMode_TB_RL,AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART}, 156*cdf0e10cSrcweir {BMP_LAYOUT_VERTICAL01, BMP_LAYOUT_VERTICAL01_H, STR_AL_VERT_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE}, 157*cdf0e10cSrcweir {BMP_LAYOUT_HEAD02, BMP_LAYOUT_HEAD02_H, STR_AL_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE}, 158*cdf0e10cSrcweir {BMP_LAYOUT_HEAD02A, BMP_LAYOUT_HEAD02A_H, STR_AL_TITLE_VERT_OUTLINE_CLIPART, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART}, 159*cdf0e10cSrcweir {0, 0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE} 160*cdf0e10cSrcweir }; 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir // ----------------------------------------------------------------------- 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir static void fillLayoutValueSet( ValueSet* pValue, snewfoil_value_info* pInfo, const bool bHighContrast ) 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir Size aLayoutItemSize; 167*cdf0e10cSrcweir for( ; pInfo->mnBmpResId; pInfo++ ) 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir String aText( SdResId( pInfo->mnStrResId ) ); 170*cdf0e10cSrcweir BitmapEx aBmp( SdResId( (bHighContrast ? pInfo->mnHCBmpResId : pInfo->mnBmpResId) ) ); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir pValue->InsertItem( static_cast<sal_uInt16>(pInfo->maAutoLayout)+1, aBmp, aText ); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir aLayoutItemSize.Width() = std::max( aLayoutItemSize.Width(), aBmp.GetSizePixel().Width() ); 175*cdf0e10cSrcweir aLayoutItemSize.Height() = std::max( aLayoutItemSize.Height(), aBmp.GetSizePixel().Height() ); 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir aLayoutItemSize = pValue->CalcItemSizePixel( aLayoutItemSize ); 179*cdf0e10cSrcweir pValue->SetSizePixel( pValue->CalcWindowSizePixel( aLayoutItemSize ) ); 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir // ----------------------------------------------------------------------- 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, const Reference< XFrame >& xFrame, ::Window* pParent, const bool bInsertPage ) 185*cdf0e10cSrcweir : svtools::ToolbarMenu(xFrame, pParent, WB_CLIPCHILDREN ) 186*cdf0e10cSrcweir , mrController( rController ) 187*cdf0e10cSrcweir , mxFrame(xFrame) 188*cdf0e10cSrcweir , mbInsertPage( bInsertPage ) 189*cdf0e10cSrcweir , mpLayoutSet1( 0 ) 190*cdf0e10cSrcweir , mpLayoutSet2( 0 ) 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir DrawViewMode eMode = DrawViewMode_DRAW; 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir // find out which view is running 195*cdf0e10cSrcweir if( xFrame.is() ) try 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir Reference< XPropertySet > xControllerSet( xFrame->getController(), UNO_QUERY_THROW ); 198*cdf0e10cSrcweir xControllerSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DrawViewMode" ) ) ) >>= eMode; 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir catch( Exception& e ) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir (void)e; 203*cdf0e10cSrcweir OSL_ASSERT(false); 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir const sal_Int32 LAYOUT_BORDER_PIX = 7; 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir String aTitle1( SdResId( STR_GLUE_ESCDIR_HORZ ) ); 209*cdf0e10cSrcweir String aTitle2( SdResId( STR_GLUE_ESCDIR_VERT ) ); 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir const bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); 212*cdf0e10cSrcweir SvtLanguageOptions aLanguageOptions; 213*cdf0e10cSrcweir const bool bVerticalEnabled = aLanguageOptions.IsVerticalTextEnabled(); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectHdl ) ); 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir mpLayoutSet1 = createEmptyValueSetControl(); 218*cdf0e10cSrcweir mpLayoutSet1->SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectHdl ) ); 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir snewfoil_value_info* pInfo = 0; 221*cdf0e10cSrcweir sal_Int16 nColCount = 4; 222*cdf0e10cSrcweir switch( eMode ) 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir case DrawViewMode_DRAW: pInfo = &standard[0]; break; 225*cdf0e10cSrcweir case DrawViewMode_HANDOUT: pInfo = &handout[0]; nColCount = 2; break; 226*cdf0e10cSrcweir case DrawViewMode_NOTES: pInfo = ¬es[0]; nColCount = 1; break; 227*cdf0e10cSrcweir default: break; 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir mpLayoutSet1->SetColCount( nColCount ); 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir fillLayoutValueSet( mpLayoutSet1, pInfo, bHighContrast ); 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir Size aSize( mpLayoutSet1->GetOutputSizePixel() ); 235*cdf0e10cSrcweir aSize.Width() += (mpLayoutSet1->GetColCount() + 1) * LAYOUT_BORDER_PIX; 236*cdf0e10cSrcweir aSize.Height() += (mpLayoutSet1->GetLineCount() +1) * LAYOUT_BORDER_PIX; 237*cdf0e10cSrcweir mpLayoutSet1->SetOutputSizePixel( aSize ); 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir if( bVerticalEnabled && (eMode == DrawViewMode_DRAW) ) 240*cdf0e10cSrcweir appendEntry( -1, aTitle1 ); 241*cdf0e10cSrcweir appendEntry( 0, mpLayoutSet1 ); 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir if( bVerticalEnabled && (eMode == DrawViewMode_DRAW) ) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir mpLayoutSet2 = new ValueSet( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); 246*cdf0e10cSrcweir // mpLayoutSet2->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING ); 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir mpLayoutSet2->SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectHdl ) ); 249*cdf0e10cSrcweir mpLayoutSet2->SetColCount( 4 ); 250*cdf0e10cSrcweir mpLayoutSet2->EnableFullItemMode( sal_False ); 251*cdf0e10cSrcweir mpLayoutSet2->SetColor( GetControlBackground() ); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir fillLayoutValueSet( mpLayoutSet2, &v_standard[0], bHighContrast ); 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir aSize = mpLayoutSet2->GetOutputSizePixel(); 256*cdf0e10cSrcweir aSize.Width() += (mpLayoutSet2->GetColCount() + 1) * LAYOUT_BORDER_PIX; 257*cdf0e10cSrcweir aSize.Height() += (mpLayoutSet2->GetLineCount() + 1) * LAYOUT_BORDER_PIX; 258*cdf0e10cSrcweir mpLayoutSet2->SetOutputSizePixel( aSize ); 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir appendEntry( -1, aTitle2 ); 261*cdf0e10cSrcweir appendEntry( 1, mpLayoutSet2 ); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir if( eMode == DrawViewMode_DRAW ) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir appendSeparator(); 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir OUString sSlotStr; 269*cdf0e10cSrcweir Image aSlotImage; 270*cdf0e10cSrcweir if( mxFrame.is() ) 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir if( bInsertPage ) 273*cdf0e10cSrcweir sSlotStr = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DuplicatePage" ) ); 274*cdf0e10cSrcweir else 275*cdf0e10cSrcweir sSlotStr = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Undo" ) ); 276*cdf0e10cSrcweir aSlotImage = ::GetImage( mxFrame, sSlotStr, sal_False, bHighContrast ); 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir String sSlotTitle; 279*cdf0e10cSrcweir if( bInsertPage ) 280*cdf0e10cSrcweir sSlotTitle = ImplRetrieveLabelFromCommand( mxFrame, sSlotStr ); 281*cdf0e10cSrcweir else 282*cdf0e10cSrcweir sSlotTitle = String( SdResId( STR_RESET_LAYOUT ) ); 283*cdf0e10cSrcweir appendEntry( 2, sSlotTitle, aSlotImage); 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir SetOutputSizePixel( getMenuSize() ); 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir // ----------------------------------------------------------------------- 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir LayoutToolbarMenu::~LayoutToolbarMenu() 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir // ----------------------------------------------------------------------- 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir IMPL_LINK( LayoutToolbarMenu, SelectHdl, void *, pControl ) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir if ( IsInPopupMode() ) 301*cdf0e10cSrcweir EndPopupMode(); 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir Sequence< PropertyValue > aArgs; 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir AutoLayout eLayout = AUTOLAYOUT__END; 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir OUString sCommandURL( mrController.getCommandURL() ); 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir if( pControl == mpLayoutSet1 ) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir eLayout = static_cast< AutoLayout >(mpLayoutSet1->GetSelectItemId()-1); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir else if( pControl == mpLayoutSet2 ) 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir eLayout = static_cast< AutoLayout >(mpLayoutSet2->GetSelectItemId()-1); 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir if( eLayout != AUTOLAYOUT__END ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir aArgs = Sequence< PropertyValue >(1); 321*cdf0e10cSrcweir aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "WhatLayout" ) ); 322*cdf0e10cSrcweir aArgs[0].Value <<= (sal_Int32)eLayout; 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir else if( mbInsertPage ) 325*cdf0e10cSrcweir { 326*cdf0e10cSrcweir sCommandURL = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DuplicatePage" ) ); 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir mrController.dispatchCommand( sCommandURL, aArgs ); 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir return 0; 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir // ==================================================================== 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir OUString SlideLayoutController_getImplementationName() 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.sd.SlideLayoutController" )); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir // -------------------------------------------------------------------- 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir Sequence< OUString > SlideLayoutController_getSupportedServiceNames() throw( RuntimeException ) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir Sequence< OUString > aSNS( 1 ); 346*cdf0e10cSrcweir aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); 347*cdf0e10cSrcweir return aSNS; 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir // -------------------------------------------------------------------- 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir Reference< XInterface > SAL_CALL SlideLayoutController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir return *new SlideLayoutController( rSMgr, OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AssignLayout" )), false ); 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir // -------------------------------------------------------------------- 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir OUString InsertSlideController_getImplementationName() 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.sd.InsertSlideController" )); 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir // -------------------------------------------------------------------- 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir Sequence< OUString > InsertSlideController_getSupportedServiceNames() throw( RuntimeException ) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir Sequence< OUString > aSNS( 1 ); 369*cdf0e10cSrcweir aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); 370*cdf0e10cSrcweir return aSNS; 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir // -------------------------------------------------------------------- 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir Reference< XInterface > SAL_CALL InsertSlideController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir return *new SlideLayoutController( rSMgr, OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPage" )), true ); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir //======================================================================== 381*cdf0e10cSrcweir // class SlideLayoutController 382*cdf0e10cSrcweir //======================================================================== 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir SlideLayoutController::SlideLayoutController( const Reference< lang::XMultiServiceFactory >& rServiceManager, const rtl::OUString& sCommandURL, bool bInsertPage ) 385*cdf0e10cSrcweir : svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), sCommandURL ) 386*cdf0e10cSrcweir , mbInsertPage( bInsertPage ) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir // -------------------------------------------------------------------- 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir ::Window* SlideLayoutController::createPopupWindow( ::Window* pParent ) 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir return new sd::LayoutToolbarMenu( *this, m_xFrame, pParent, mbInsertPage ); 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir // -------------------------------------------------------------------- 398*cdf0e10cSrcweir // XServiceInfo 399*cdf0e10cSrcweir // -------------------------------------------------------------------- 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir OUString SAL_CALL SlideLayoutController::getImplementationName() throw( RuntimeException ) 402*cdf0e10cSrcweir { 403*cdf0e10cSrcweir if( mbInsertPage ) 404*cdf0e10cSrcweir return InsertSlideController_getImplementationName(); 405*cdf0e10cSrcweir else 406*cdf0e10cSrcweir return SlideLayoutController_getImplementationName(); 407*cdf0e10cSrcweir } 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir // -------------------------------------------------------------------- 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir Sequence< OUString > SAL_CALL SlideLayoutController::getSupportedServiceNames( ) throw( RuntimeException ) 412*cdf0e10cSrcweir { 413*cdf0e10cSrcweir if( mbInsertPage ) 414*cdf0e10cSrcweir return InsertSlideController_getSupportedServiceNames(); 415*cdf0e10cSrcweir else 416*cdf0e10cSrcweir return SlideLayoutController_getSupportedServiceNames(); 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir } 420