1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10*5b190011SAndrew Rist * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*5b190011SAndrew Rist * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19*5b190011SAndrew Rist * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> 27cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 28cdf0e10cSrcweir #include <svx/svdlayer.hxx> 29cdf0e10cSrcweir #ifndef _SVXIDS_HXX 30cdf0e10cSrcweir #include <svx/svxids.hrc> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #include <sfx2/msgpool.hxx> 33cdf0e10cSrcweir #include <svx/hyprlink.hxx> 34cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 35cdf0e10cSrcweir #include <svx/hlnkitem.hxx> 36cdf0e10cSrcweir #include <tools/urlobj.hxx> 37cdf0e10cSrcweir #include <editeng/eeitem.hxx> 38cdf0e10cSrcweir #ifndef _FLDITEM_HXX 39cdf0e10cSrcweir #include <editeng/flditem.hxx> 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir #include <vcl/msgbox.hxx> 42cdf0e10cSrcweir #include <sfx2/request.hxx> 43cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 44cdf0e10cSrcweir #include <svx/svdorect.hxx> 45cdf0e10cSrcweir #include <sfx2/docfile.hxx> 46cdf0e10cSrcweir #include <basic/sbstar.hxx> 47cdf0e10cSrcweir #include <basic/sberrors.hxx> 48cdf0e10cSrcweir #include <svx/fmshell.hxx> 49cdf0e10cSrcweir #include <svx/svxdlg.hxx> 50cdf0e10cSrcweir #include <svx/dialogs.hrc> 51cdf0e10cSrcweir #include <unotools/useroptions.hxx> 52cdf0e10cSrcweir 53cdf0e10cSrcweir #include "app.hrc" 54cdf0e10cSrcweir #include "strings.hrc" 55cdf0e10cSrcweir #include "res_bmp.hrc" 56cdf0e10cSrcweir #include "glob.hrc" 57cdf0e10cSrcweir #include "Outliner.hxx" 58cdf0e10cSrcweir #include "Window.hxx" 59cdf0e10cSrcweir #include "app.hxx" 60cdf0e10cSrcweir #include "sdattr.hxx" 61cdf0e10cSrcweir #include "drawdoc.hxx" 62cdf0e10cSrcweir #include "DrawDocShell.hxx" 63cdf0e10cSrcweir #include "sdresid.hxx" 64cdf0e10cSrcweir #include "sdpage.hxx" 65cdf0e10cSrcweir #include "DrawViewShell.hxx" 66cdf0e10cSrcweir #include "drawview.hxx" 67cdf0e10cSrcweir #include "unmodpg.hxx" 68cdf0e10cSrcweir #include "undolayer.hxx" 69cdf0e10cSrcweir #include "ViewShellBase.hxx" 70cdf0e10cSrcweir #include "FormShellManager.hxx" 71cdf0e10cSrcweir #include "LayerTabBar.hxx" 72cdf0e10cSrcweir #include "sdabstdlg.hxx" 73cdf0e10cSrcweir #include "SlideSorterViewShell.hxx" 74cdf0e10cSrcweir #include "SlideSorter.hxx" 75cdf0e10cSrcweir #include "controller/SlideSorterController.hxx" 76cdf0e10cSrcweir 77cdf0e10cSrcweir #define RET_DELETE 100 78cdf0e10cSrcweir 79cdf0e10cSrcweir namespace sd { 80cdf0e10cSrcweir 81cdf0e10cSrcweir /************************************************************************* 82cdf0e10cSrcweir |* 83cdf0e10cSrcweir |* SfxRequests fuer temporaere Funktionen 84cdf0e10cSrcweir |* 85cdf0e10cSrcweir \************************************************************************/ 86cdf0e10cSrcweir 87cdf0e10cSrcweir void DrawViewShell::FuTemp02(SfxRequest& rReq) 88cdf0e10cSrcweir { 89cdf0e10cSrcweir sal_uInt16 nSId = rReq.GetSlot(); 90cdf0e10cSrcweir switch( nSId ) 91cdf0e10cSrcweir { 92cdf0e10cSrcweir case SID_INSERTLAYER: 93cdf0e10cSrcweir { 94cdf0e10cSrcweir if ( mpDrawView->IsTextEdit() ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir mpDrawView->SdrEndTextEdit(); 97cdf0e10cSrcweir } 98cdf0e10cSrcweir 99cdf0e10cSrcweir SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin(); 100cdf0e10cSrcweir sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount(); 101cdf0e10cSrcweir sal_uInt16 nLayer = nLayerCnt - 2 + 1; 102cdf0e10cSrcweir String aLayerName ( SdResId(STR_LAYER) ), aLayerTitle, aLayerDesc; 103cdf0e10cSrcweir aLayerName += String::CreateFromInt32( (sal_Int32)nLayer ); 104cdf0e10cSrcweir sal_Bool bIsVisible = sal_False; 105cdf0e10cSrcweir sal_Bool bIsLocked = sal_False; 106cdf0e10cSrcweir sal_Bool bIsPrintable = sal_False; 107cdf0e10cSrcweir 108cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 109cdf0e10cSrcweir 110cdf0e10cSrcweir if (! pArgs) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir SfxItemSet aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START, ATTR_LAYER_END ); 113cdf0e10cSrcweir 114cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerName( aLayerName ) ); 115cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerTitle() ); 116cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerDesc() ); 117cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerVisible() ); 118cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerPrintable() ); 119cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerLocked() ); 120cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerThisPage() ); 121cdf0e10cSrcweir 122cdf0e10cSrcweir SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); 123cdf0e10cSrcweir AbstractSdInsertLayerDlg* pDlg = pFact ? pFact->CreateSdInsertLayerDlg(NULL, aNewAttr, true, String( SdResId( STR_INSERTLAYER ) ) ) : 0; 124cdf0e10cSrcweir if( pDlg ) 125cdf0e10cSrcweir { 126cdf0e10cSrcweir pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_INSERTLAYER )->GetCommand() ); 127cdf0e10cSrcweir 128cdf0e10cSrcweir // Ueberpruefung auf schon vorhandene Namen 129cdf0e10cSrcweir sal_Bool bLoop = sal_True; 130cdf0e10cSrcweir while( bLoop && pDlg->Execute() == RET_OK ) 131cdf0e10cSrcweir { 132cdf0e10cSrcweir pDlg->GetAttr( aNewAttr ); 133cdf0e10cSrcweir aLayerName = ((SdAttrLayerName &) aNewAttr.Get (ATTR_LAYER_NAME)).GetValue (); 134cdf0e10cSrcweir 135cdf0e10cSrcweir if( rLayerAdmin.GetLayer( aLayerName, sal_False ) 136cdf0e10cSrcweir || aLayerName.Len()==0 ) 137cdf0e10cSrcweir { 138cdf0e10cSrcweir // Name ist schon vorhanden 139cdf0e10cSrcweir WarningBox aWarningBox ( 140cdf0e10cSrcweir GetParentWindow(), 141cdf0e10cSrcweir WinBits( WB_OK ), 142cdf0e10cSrcweir String(SdResId( STR_WARN_NAME_DUPLICATE))); 143cdf0e10cSrcweir aWarningBox.Execute(); 144cdf0e10cSrcweir } 145cdf0e10cSrcweir else 146cdf0e10cSrcweir bLoop = sal_False; 147cdf0e10cSrcweir } 148cdf0e10cSrcweir if( bLoop ) // wurde abgebrochen 149cdf0e10cSrcweir { 150cdf0e10cSrcweir delete pDlg; 151cdf0e10cSrcweir 152cdf0e10cSrcweir Cancel(); 153cdf0e10cSrcweir rReq.Ignore (); 154cdf0e10cSrcweir break; 155cdf0e10cSrcweir } 156cdf0e10cSrcweir else 157cdf0e10cSrcweir { 158cdf0e10cSrcweir //pDlg->GetAttr( aNewAttr ); 159cdf0e10cSrcweir //aLayerName = ((SdAttrLayerName &) aNewAttr.Get (ATTR_LAYER_NAME)).GetValue (); 160cdf0e10cSrcweir aLayerTitle = ((SdAttrLayerTitle &) aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue (); 161cdf0e10cSrcweir aLayerDesc = ((SdAttrLayerDesc &) aNewAttr.Get (ATTR_LAYER_DESC)).GetValue (); 162cdf0e10cSrcweir bIsVisible = ((SdAttrLayerVisible &) aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue (); 163cdf0e10cSrcweir bIsLocked = ((SdAttrLayerLocked &) aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue () ; 164cdf0e10cSrcweir bIsPrintable = ((SdAttrLayerPrintable &) aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue () ; 165cdf0e10cSrcweir 166cdf0e10cSrcweir delete pDlg; 167cdf0e10cSrcweir } 168cdf0e10cSrcweir } 169cdf0e10cSrcweir } 170cdf0e10cSrcweir else if (pArgs->Count () != 4) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir StarBASIC::FatalError (SbERR_WRONG_ARGS); 173cdf0e10cSrcweir Cancel(); 174cdf0e10cSrcweir rReq.Ignore (); 175cdf0e10cSrcweir break; 176cdf0e10cSrcweir } 177cdf0e10cSrcweir else 178cdf0e10cSrcweir { 179cdf0e10cSrcweir SFX_REQUEST_ARG (rReq, pLayerName, SfxStringItem, ID_VAL_LAYERNAME, sal_False); 180cdf0e10cSrcweir SFX_REQUEST_ARG (rReq, pIsVisible, SfxBoolItem, ID_VAL_ISVISIBLE, sal_False); 181cdf0e10cSrcweir SFX_REQUEST_ARG (rReq, pIsLocked, SfxBoolItem, ID_VAL_ISLOCKED, sal_False); 182cdf0e10cSrcweir SFX_REQUEST_ARG (rReq, pIsPrintable, SfxBoolItem, ID_VAL_ISPRINTABLE, sal_False); 183cdf0e10cSrcweir 184cdf0e10cSrcweir aLayerName = pLayerName->GetValue (); 185cdf0e10cSrcweir bIsVisible = pIsVisible->GetValue (); 186cdf0e10cSrcweir bIsLocked = pIsLocked->GetValue (); 187cdf0e10cSrcweir bIsPrintable = pIsPrintable->GetValue (); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir 190cdf0e10cSrcweir String aPrevLayer = mpDrawView->GetActiveLayer(); 191cdf0e10cSrcweir String aName; 192cdf0e10cSrcweir SdrLayer* pLayer; 193cdf0e10cSrcweir sal_uInt16 nPrevLayer = 0; 194cdf0e10cSrcweir nLayerCnt = rLayerAdmin.GetLayerCount(); 195cdf0e10cSrcweir 196cdf0e10cSrcweir for ( nLayer = 0; nLayer < nLayerCnt; nLayer++ ) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir pLayer = rLayerAdmin.GetLayer(nLayer); 199cdf0e10cSrcweir aName = pLayer->GetName(); 200cdf0e10cSrcweir 201cdf0e10cSrcweir if ( aPrevLayer == aName ) 202cdf0e10cSrcweir { 203cdf0e10cSrcweir // nPrevLayer = nLayer; 204cdf0e10cSrcweir nPrevLayer = Max(nLayer, (sal_uInt16) 4); 205cdf0e10cSrcweir } 206cdf0e10cSrcweir } 207cdf0e10cSrcweir 208cdf0e10cSrcweir mpDrawView->InsertNewLayer(aLayerName, nPrevLayer + 1); 209cdf0e10cSrcweir pLayer = rLayerAdmin.GetLayer(aLayerName, sal_False); 210cdf0e10cSrcweir if( pLayer ) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir pLayer->SetTitle( aLayerTitle ); 213cdf0e10cSrcweir pLayer->SetDescription( aLayerDesc ); 214cdf0e10cSrcweir } 215cdf0e10cSrcweir 216cdf0e10cSrcweir mpDrawView->SetLayerVisible( aLayerName, bIsVisible ); 217cdf0e10cSrcweir mpDrawView->SetLayerLocked( aLayerName, bIsLocked); 218cdf0e10cSrcweir mpDrawView->SetLayerPrintable(aLayerName, bIsPrintable); 219cdf0e10cSrcweir 220cdf0e10cSrcweir mpDrawView->SetActiveLayer(aLayerName); 221cdf0e10cSrcweir 222cdf0e10cSrcweir ResetActualLayer(); 223cdf0e10cSrcweir 224cdf0e10cSrcweir GetDoc()->SetChanged(sal_True); 225cdf0e10cSrcweir 226cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHLAYER, 227cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 228cdf0e10cSrcweir 229cdf0e10cSrcweir Cancel(); 230cdf0e10cSrcweir rReq.Done (); 231cdf0e10cSrcweir } 232cdf0e10cSrcweir break; 233cdf0e10cSrcweir 234cdf0e10cSrcweir case SID_MODIFYLAYER: 235cdf0e10cSrcweir { 236cdf0e10cSrcweir if ( mpDrawView->IsTextEdit() ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir mpDrawView->SdrEndTextEdit(); 239cdf0e10cSrcweir } 240cdf0e10cSrcweir 241cdf0e10cSrcweir SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin(); 242cdf0e10cSrcweir sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId(); 243cdf0e10cSrcweir String aLayerName( GetLayerTabControl()->GetPageText(nCurPage) ); 244cdf0e10cSrcweir SdrLayer* pLayer = rLayerAdmin.GetLayer(aLayerName, sal_False); 245cdf0e10cSrcweir 246cdf0e10cSrcweir String aLayerTitle( pLayer->GetTitle() ); 247cdf0e10cSrcweir String aLayerDesc( pLayer->GetDescription() ); 248cdf0e10cSrcweir 249cdf0e10cSrcweir String aOldLayerName( aLayerName ); 250cdf0e10cSrcweir String aOldLayerTitle( aLayerTitle ); 251cdf0e10cSrcweir String aOldLayerDesc( aLayerDesc ); 252cdf0e10cSrcweir 253cdf0e10cSrcweir sal_Bool bIsVisible, bIsLocked, bIsPrintable; 254cdf0e10cSrcweir sal_Bool bOldIsVisible = bIsVisible = mpDrawView->IsLayerVisible(aLayerName); 255cdf0e10cSrcweir sal_Bool bOldIsLocked = bIsLocked = mpDrawView->IsLayerLocked(aLayerName); 256cdf0e10cSrcweir sal_Bool bOldIsPrintable = bIsPrintable = mpDrawView->IsLayerPrintable(aLayerName); 257cdf0e10cSrcweir 258cdf0e10cSrcweir 259cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 260cdf0e10cSrcweir // darf der Layer geloescht werden ? 261cdf0e10cSrcweir bool bDelete = true; 262cdf0e10cSrcweir 263cdf0e10cSrcweir String aLayoutLayer ( SdResId(STR_LAYER_LAYOUT) ); 264cdf0e10cSrcweir String aControlsLayer ( SdResId(STR_LAYER_CONTROLS) ); 265cdf0e10cSrcweir String aMeasureLinesLayer ( SdResId(STR_LAYER_MEASURELINES) ); 266cdf0e10cSrcweir String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) ); 267cdf0e10cSrcweir String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) ); 268cdf0e10cSrcweir 269cdf0e10cSrcweir if( aLayerName == aLayoutLayer || aLayerName == aControlsLayer || 270cdf0e10cSrcweir aLayerName == aMeasureLinesLayer || 271cdf0e10cSrcweir aLayerName == aBackgroundLayer || aLayerName == aBackgroundObjLayer ) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir bDelete = false; 274cdf0e10cSrcweir } 275cdf0e10cSrcweir 276cdf0e10cSrcweir if (! pArgs) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir SfxItemSet aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START, ATTR_LAYER_END ); 279cdf0e10cSrcweir 280cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerName( aLayerName ) ); 281cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerTitle( aLayerTitle ) ); 282cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerDesc( aLayerDesc ) ); 283cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerVisible( bIsVisible ) ); 284cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerLocked( bIsLocked ) ); 285cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerPrintable( bIsPrintable ) ); 286cdf0e10cSrcweir aNewAttr.Put( SdAttrLayerThisPage() ); 287cdf0e10cSrcweir 288cdf0e10cSrcweir SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); 289cdf0e10cSrcweir AbstractSdInsertLayerDlg* pDlg = pFact ? pFact->CreateSdInsertLayerDlg(NULL, aNewAttr, bDelete, String( SdResId( STR_MODIFYLAYER ) ) ) : 0; 290cdf0e10cSrcweir if( pDlg ) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir pDlg->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_MODIFYLAYER )->GetCommand() ); 293cdf0e10cSrcweir 294cdf0e10cSrcweir // Ueberpruefung auf schon vorhandene Namen 295cdf0e10cSrcweir sal_Bool bLoop = sal_True; 296cdf0e10cSrcweir sal_uInt16 nRet = 0; 297cdf0e10cSrcweir while( bLoop && ( (nRet = pDlg->Execute()) == RET_OK ) ) 298cdf0e10cSrcweir { 299cdf0e10cSrcweir pDlg->GetAttr( aNewAttr ); 300cdf0e10cSrcweir aLayerName = ((SdAttrLayerName &) aNewAttr.Get (ATTR_LAYER_NAME)).GetValue (); 301cdf0e10cSrcweir 302cdf0e10cSrcweir if( (rLayerAdmin.GetLayer( aLayerName, sal_False ) && 303cdf0e10cSrcweir aLayerName != aOldLayerName) || aLayerName.Len()==0 ) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir // Name ist schon vorhanden 306cdf0e10cSrcweir WarningBox aWarningBox ( 307cdf0e10cSrcweir GetParentWindow(), 308cdf0e10cSrcweir WinBits( WB_OK ), 309cdf0e10cSrcweir String( SdResId( STR_WARN_NAME_DUPLICATE))); 310cdf0e10cSrcweir aWarningBox.Execute(); 311cdf0e10cSrcweir } 312cdf0e10cSrcweir else 313cdf0e10cSrcweir bLoop = sal_False; 314cdf0e10cSrcweir } 315cdf0e10cSrcweir switch (nRet) 316cdf0e10cSrcweir { 317cdf0e10cSrcweir case RET_OK : 318cdf0e10cSrcweir aLayerTitle = ((SdAttrLayerTitle &) aNewAttr.Get (ATTR_LAYER_TITLE)).GetValue (); 319cdf0e10cSrcweir aLayerDesc = ((SdAttrLayerDesc &) aNewAttr.Get (ATTR_LAYER_DESC)).GetValue (); 320cdf0e10cSrcweir bIsVisible = ((const SdAttrLayerVisible &) aNewAttr.Get (ATTR_LAYER_VISIBLE)).GetValue (); 321cdf0e10cSrcweir bIsLocked = ((const SdAttrLayerLocked &) aNewAttr.Get (ATTR_LAYER_LOCKED)).GetValue (); 322cdf0e10cSrcweir bIsPrintable = ((const SdAttrLayerLocked &) aNewAttr.Get (ATTR_LAYER_PRINTABLE)).GetValue (); 323cdf0e10cSrcweir 324cdf0e10cSrcweir delete pDlg; 325cdf0e10cSrcweir break; 326cdf0e10cSrcweir 327cdf0e10cSrcweir default : 328cdf0e10cSrcweir delete pDlg; 329cdf0e10cSrcweir rReq.Ignore (); 330cdf0e10cSrcweir Cancel (); 331cdf0e10cSrcweir return; 332cdf0e10cSrcweir } 333cdf0e10cSrcweir } 334cdf0e10cSrcweir } 335cdf0e10cSrcweir else if (pArgs->Count () == 4) 336cdf0e10cSrcweir { 337cdf0e10cSrcweir SFX_REQUEST_ARG (rReq, pLayerName, SfxStringItem, ID_VAL_LAYERNAME, sal_False); 338cdf0e10cSrcweir SFX_REQUEST_ARG (rReq, pIsVisible, SfxBoolItem, ID_VAL_ISVISIBLE, sal_False); 339cdf0e10cSrcweir SFX_REQUEST_ARG (rReq, pIsLocked, SfxBoolItem, ID_VAL_ISLOCKED, sal_False); 340cdf0e10cSrcweir SFX_REQUEST_ARG (rReq, pIsPrintable, SfxBoolItem, ID_VAL_ISPRINTABLE, sal_False); 341cdf0e10cSrcweir 342cdf0e10cSrcweir aLayerName = pLayerName->GetValue (); 343cdf0e10cSrcweir bIsVisible = pIsVisible->GetValue (); 344cdf0e10cSrcweir bIsLocked = pIsLocked->GetValue (); 345cdf0e10cSrcweir bIsPrintable = pIsPrintable->GetValue (); 346cdf0e10cSrcweir } 347cdf0e10cSrcweir else 348cdf0e10cSrcweir { 349cdf0e10cSrcweir StarBASIC::FatalError (SbERR_WRONG_ARGS); 350cdf0e10cSrcweir Cancel (); 351cdf0e10cSrcweir rReq.Ignore (); 352cdf0e10cSrcweir break; 353cdf0e10cSrcweir } 354cdf0e10cSrcweir 355cdf0e10cSrcweir ::svl::IUndoManager* pManager = GetDoc()->GetDocSh()->GetUndoManager(); 356cdf0e10cSrcweir SdLayerModifyUndoAction* pAction = new SdLayerModifyUndoAction( 357cdf0e10cSrcweir GetDoc(), 358cdf0e10cSrcweir pLayer, 359cdf0e10cSrcweir // old values 360cdf0e10cSrcweir aOldLayerName, 361cdf0e10cSrcweir aOldLayerTitle, 362cdf0e10cSrcweir aOldLayerDesc, 363cdf0e10cSrcweir bOldIsVisible, 364cdf0e10cSrcweir bOldIsLocked, 365cdf0e10cSrcweir bOldIsPrintable, 366cdf0e10cSrcweir // new values 367cdf0e10cSrcweir aLayerName, 368cdf0e10cSrcweir aLayerTitle, 369cdf0e10cSrcweir aLayerDesc, 370cdf0e10cSrcweir bIsVisible, 371cdf0e10cSrcweir bIsLocked, 372cdf0e10cSrcweir bIsPrintable 373cdf0e10cSrcweir ); 374cdf0e10cSrcweir pManager->AddUndoAction( pAction ); 375cdf0e10cSrcweir 376cdf0e10cSrcweir ModifyLayer( pLayer, aLayerName, aLayerTitle, aLayerDesc, bIsVisible, bIsLocked, bIsPrintable ); 377cdf0e10cSrcweir 378cdf0e10cSrcweir Cancel(); 379cdf0e10cSrcweir rReq.Done (); 380cdf0e10cSrcweir } 381cdf0e10cSrcweir break; 382cdf0e10cSrcweir 383cdf0e10cSrcweir case SID_RENAMELAYER: 384cdf0e10cSrcweir { 385cdf0e10cSrcweir if ( mpDrawView->IsTextEdit() ) 386cdf0e10cSrcweir { 387cdf0e10cSrcweir mpDrawView->SdrEndTextEdit(); 388cdf0e10cSrcweir } 389cdf0e10cSrcweir 390cdf0e10cSrcweir GetLayerTabControl()->StartEditMode( 391cdf0e10cSrcweir GetLayerTabControl()->GetCurPageId() ); 392cdf0e10cSrcweir 393cdf0e10cSrcweir Cancel(); 394cdf0e10cSrcweir rReq.Ignore (); 395cdf0e10cSrcweir } 396cdf0e10cSrcweir break; 397cdf0e10cSrcweir 398cdf0e10cSrcweir case SID_EDIT_HYPERLINK : 399cdf0e10cSrcweir { 400cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG ); 401cdf0e10cSrcweir 402cdf0e10cSrcweir Cancel(); 403cdf0e10cSrcweir rReq.Done (); 404cdf0e10cSrcweir } 405cdf0e10cSrcweir break; 406cdf0e10cSrcweir 407cdf0e10cSrcweir case SID_OPEN_HYPERLINK: 408cdf0e10cSrcweir { 409cdf0e10cSrcweir OutlinerView* pOutView = mpDrawView->GetTextEditOutlinerView(); 410cdf0e10cSrcweir if ( pOutView ) 411cdf0e10cSrcweir { 412cdf0e10cSrcweir const SvxFieldItem* pFieldItem = pOutView->GetFieldAtSelection(); 413cdf0e10cSrcweir if ( pFieldItem ) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir const SvxFieldData* pField = pFieldItem->GetField(); 416cdf0e10cSrcweir if( pField && pField->ISA( SvxURLField ) ) 417cdf0e10cSrcweir { 418cdf0e10cSrcweir const SvxURLField* pURLField = static_cast< const SvxURLField* >( pField ); 419cdf0e10cSrcweir 420cdf0e10cSrcweir SfxStringItem aUrl( SID_FILE_NAME, pURLField->GetURL() ); 421cdf0e10cSrcweir SfxStringItem aTarget( SID_TARGETNAME, pURLField->GetTargetFrame() ); 422cdf0e10cSrcweir 423cdf0e10cSrcweir String aReferName; 424cdf0e10cSrcweir SfxViewFrame* pFrame = GetViewFrame(); 425cdf0e10cSrcweir SfxMedium* pMed = pFrame->GetObjectShell()->GetMedium(); 426cdf0e10cSrcweir if (pMed) 427cdf0e10cSrcweir aReferName = pMed->GetName(); 428cdf0e10cSrcweir 429cdf0e10cSrcweir SfxFrameItem aFrm( SID_DOCFRAME, pFrame ); 430cdf0e10cSrcweir SfxStringItem aReferer( SID_REFERER, aReferName ); 431cdf0e10cSrcweir 432cdf0e10cSrcweir SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, sal_False ); 433cdf0e10cSrcweir SfxBoolItem aBrowsing( SID_BROWSE, sal_True ); 434cdf0e10cSrcweir 435cdf0e10cSrcweir SfxViewFrame* pViewFrm = SfxViewFrame::Current(); 436cdf0e10cSrcweir if (pViewFrm) 437cdf0e10cSrcweir pViewFrm->GetDispatcher()->Execute( SID_OPENDOC, 438cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, 439cdf0e10cSrcweir &aUrl, &aTarget, 440cdf0e10cSrcweir &aFrm, &aReferer, 441cdf0e10cSrcweir &aNewView, &aBrowsing, 442cdf0e10cSrcweir 0L ); 443cdf0e10cSrcweir } 444cdf0e10cSrcweir } 445cdf0e10cSrcweir } 446cdf0e10cSrcweir Cancel(); 447cdf0e10cSrcweir rReq.Done (); 448cdf0e10cSrcweir } 449cdf0e10cSrcweir break; 450cdf0e10cSrcweir 451cdf0e10cSrcweir case SID_HYPERLINK_SETLINK: 452cdf0e10cSrcweir { 453cdf0e10cSrcweir const SfxItemSet* pReqArgs = rReq.GetArgs(); 454cdf0e10cSrcweir 455cdf0e10cSrcweir if (pReqArgs) 456cdf0e10cSrcweir { 457cdf0e10cSrcweir SvxHyperlinkItem* pHLItem = 458cdf0e10cSrcweir (SvxHyperlinkItem*) &pReqArgs->Get(SID_HYPERLINK_SETLINK); 459cdf0e10cSrcweir 460cdf0e10cSrcweir if (pHLItem->GetInsertMode() == HLINK_FIELD) 461cdf0e10cSrcweir { 462cdf0e10cSrcweir InsertURLField(pHLItem->GetURL(), pHLItem->GetName(), 463cdf0e10cSrcweir pHLItem->GetTargetFrame(), NULL); 464cdf0e10cSrcweir } 465cdf0e10cSrcweir else if (pHLItem->GetInsertMode() == HLINK_BUTTON) 466cdf0e10cSrcweir { 467cdf0e10cSrcweir InsertURLButton(pHLItem->GetURL(), pHLItem->GetName(), 468cdf0e10cSrcweir pHLItem->GetTargetFrame(), NULL); 469cdf0e10cSrcweir } 470cdf0e10cSrcweir else if (pHLItem->GetInsertMode() == HLINK_DEFAULT) 471cdf0e10cSrcweir { 472cdf0e10cSrcweir OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView(); 473cdf0e10cSrcweir 474cdf0e10cSrcweir if (pOlView) 475cdf0e10cSrcweir { 476cdf0e10cSrcweir InsertURLField(pHLItem->GetURL(), pHLItem->GetName(), 477cdf0e10cSrcweir pHLItem->GetTargetFrame(), NULL); 478cdf0e10cSrcweir } 479cdf0e10cSrcweir else 480cdf0e10cSrcweir { 481cdf0e10cSrcweir InsertURLButton(pHLItem->GetURL(), pHLItem->GetName(), 482cdf0e10cSrcweir pHLItem->GetTargetFrame(), NULL); 483cdf0e10cSrcweir } 484cdf0e10cSrcweir } 485cdf0e10cSrcweir } 486cdf0e10cSrcweir 487cdf0e10cSrcweir Cancel(); 488cdf0e10cSrcweir rReq.Ignore (); 489cdf0e10cSrcweir } 490cdf0e10cSrcweir break; 491cdf0e10cSrcweir 492cdf0e10cSrcweir case SID_INSERT_FLD_DATE_FIX: 493cdf0e10cSrcweir case SID_INSERT_FLD_DATE_VAR: 494cdf0e10cSrcweir case SID_INSERT_FLD_TIME_FIX: 495cdf0e10cSrcweir case SID_INSERT_FLD_TIME_VAR: 496cdf0e10cSrcweir case SID_INSERT_FLD_AUTHOR: 497cdf0e10cSrcweir case SID_INSERT_FLD_PAGE: 498cdf0e10cSrcweir case SID_INSERT_FLD_PAGES: 499cdf0e10cSrcweir case SID_INSERT_FLD_FILE: 500cdf0e10cSrcweir { 501cdf0e10cSrcweir sal_uInt16 nMul = 1; 502cdf0e10cSrcweir SvxFieldItem* pFieldItem = 0; 503cdf0e10cSrcweir 504cdf0e10cSrcweir switch( nSId ) 505cdf0e10cSrcweir { 506cdf0e10cSrcweir case SID_INSERT_FLD_DATE_FIX: 507cdf0e10cSrcweir pFieldItem = new SvxFieldItem( 508cdf0e10cSrcweir SvxDateField( Date(), SVXDATETYPE_FIX ), EE_FEATURE_FIELD ); 509cdf0e10cSrcweir break; 510cdf0e10cSrcweir 511cdf0e10cSrcweir case SID_INSERT_FLD_DATE_VAR: 512cdf0e10cSrcweir pFieldItem = new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD ); 513cdf0e10cSrcweir break; 514cdf0e10cSrcweir 515cdf0e10cSrcweir case SID_INSERT_FLD_TIME_FIX: 516cdf0e10cSrcweir pFieldItem = new SvxFieldItem( 517cdf0e10cSrcweir SvxExtTimeField( Time(), SVXTIMETYPE_FIX ), EE_FEATURE_FIELD ); 518cdf0e10cSrcweir break; 519cdf0e10cSrcweir 520cdf0e10cSrcweir case SID_INSERT_FLD_TIME_VAR: 521cdf0e10cSrcweir pFieldItem = new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD ); 522cdf0e10cSrcweir break; 523cdf0e10cSrcweir 524cdf0e10cSrcweir case SID_INSERT_FLD_AUTHOR: 525cdf0e10cSrcweir { 526cdf0e10cSrcweir SvtUserOptions aUserOptions; 527cdf0e10cSrcweir pFieldItem = new SvxFieldItem( 528cdf0e10cSrcweir SvxAuthorField( 529cdf0e10cSrcweir aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() ), EE_FEATURE_FIELD ); 530cdf0e10cSrcweir } 531cdf0e10cSrcweir break; 532cdf0e10cSrcweir 533cdf0e10cSrcweir case SID_INSERT_FLD_PAGE: 534cdf0e10cSrcweir { 535cdf0e10cSrcweir pFieldItem = new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD ); 536cdf0e10cSrcweir nMul = 3; 537cdf0e10cSrcweir } 538cdf0e10cSrcweir break; 539cdf0e10cSrcweir 540cdf0e10cSrcweir case SID_INSERT_FLD_PAGES: 541cdf0e10cSrcweir { 542cdf0e10cSrcweir pFieldItem = new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD ); 543cdf0e10cSrcweir nMul = 3; 544cdf0e10cSrcweir } 545cdf0e10cSrcweir break; 546cdf0e10cSrcweir 547cdf0e10cSrcweir case SID_INSERT_FLD_FILE: 548cdf0e10cSrcweir { 549cdf0e10cSrcweir String aName; 550cdf0e10cSrcweir if( GetDocSh()->HasName() ) 551cdf0e10cSrcweir aName = GetDocSh()->GetMedium()->GetName(); 552cdf0e10cSrcweir //else 553cdf0e10cSrcweir // aName = GetDocSh()->GetName(); 554cdf0e10cSrcweir pFieldItem = new SvxFieldItem( SvxExtFileField( aName ), EE_FEATURE_FIELD ); 555cdf0e10cSrcweir } 556cdf0e10cSrcweir break; 557cdf0e10cSrcweir } 558cdf0e10cSrcweir 559cdf0e10cSrcweir OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); 560cdf0e10cSrcweir 561cdf0e10cSrcweir if( pOLV ) 562cdf0e10cSrcweir { 563cdf0e10cSrcweir const SvxFieldItem* pOldFldItem = pOLV->GetFieldAtSelection(); 564cdf0e10cSrcweir 565cdf0e10cSrcweir if( pOldFldItem && ( pOldFldItem->GetField()->ISA( SvxURLField ) || 566cdf0e10cSrcweir pOldFldItem->GetField()->ISA( SvxDateField ) || 567cdf0e10cSrcweir pOldFldItem->GetField()->ISA( SvxTimeField ) || 568cdf0e10cSrcweir pOldFldItem->GetField()->ISA( SvxExtTimeField ) || 569cdf0e10cSrcweir pOldFldItem->GetField()->ISA( SvxExtFileField ) || 570cdf0e10cSrcweir pOldFldItem->GetField()->ISA( SvxAuthorField ) || 571cdf0e10cSrcweir pOldFldItem->GetField()->ISA( SvxPageField ) ) ) 572cdf0e10cSrcweir { 573cdf0e10cSrcweir // Feld selektieren, so dass es beim Insert geloescht wird 574cdf0e10cSrcweir ESelection aSel = pOLV->GetSelection(); 575cdf0e10cSrcweir if( aSel.nStartPos == aSel.nEndPos ) 576cdf0e10cSrcweir aSel.nEndPos++; 577cdf0e10cSrcweir pOLV->SetSelection( aSel ); 578cdf0e10cSrcweir } 579cdf0e10cSrcweir 580cdf0e10cSrcweir if( pFieldItem ) 581cdf0e10cSrcweir pOLV->InsertField( *pFieldItem ); 582cdf0e10cSrcweir } 583cdf0e10cSrcweir else 584cdf0e10cSrcweir { 585cdf0e10cSrcweir Outliner* pOutl = GetDoc()->GetInternalOutliner(); 586cdf0e10cSrcweir pOutl->Init( OUTLINERMODE_TEXTOBJECT ); 587cdf0e10cSrcweir sal_uInt16 nOutlMode = pOutl->GetMode(); 588cdf0e10cSrcweir pOutl->SetStyleSheet( 0, NULL ); 589cdf0e10cSrcweir pOutl->QuickInsertField( *pFieldItem, ESelection() ); 590cdf0e10cSrcweir OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject(); 591cdf0e10cSrcweir 592cdf0e10cSrcweir SdrRectObj* pRectObj = new SdrRectObj( OBJ_TEXT ); 593cdf0e10cSrcweir pRectObj->SetMergedItem(SdrTextAutoGrowWidthItem(sal_True)); 594cdf0e10cSrcweir 595cdf0e10cSrcweir pOutl->UpdateFields(); 596cdf0e10cSrcweir pOutl->SetUpdateMode( sal_True ); 597cdf0e10cSrcweir Size aSize( pOutl->CalcTextSize() ); 598cdf0e10cSrcweir aSize.Width() *= nMul; 599cdf0e10cSrcweir pOutl->SetUpdateMode( sal_False ); 600cdf0e10cSrcweir 601cdf0e10cSrcweir Point aPos; 602cdf0e10cSrcweir Rectangle aRect( aPos, GetActiveWindow()->GetOutputSizePixel() ); 603cdf0e10cSrcweir aPos = aRect.Center(); 604cdf0e10cSrcweir aPos = GetActiveWindow()->PixelToLogic(aPos); 605cdf0e10cSrcweir aPos.X() -= aSize.Width() / 2; 606cdf0e10cSrcweir aPos.Y() -= aSize.Height() / 2; 607cdf0e10cSrcweir 608cdf0e10cSrcweir Rectangle aLogicRect(aPos, aSize); 609cdf0e10cSrcweir pRectObj->SetLogicRect(aLogicRect); 610cdf0e10cSrcweir pRectObj->SetOutlinerParaObject( pOutlParaObject ); 611cdf0e10cSrcweir mpDrawView->InsertObjectAtView(pRectObj, *mpDrawView->GetSdrPageView()); 612cdf0e10cSrcweir pOutl->Init( nOutlMode ); 613cdf0e10cSrcweir } 614cdf0e10cSrcweir 615cdf0e10cSrcweir delete pFieldItem; 616cdf0e10cSrcweir 617cdf0e10cSrcweir Cancel(); 618cdf0e10cSrcweir rReq.Ignore (); 619cdf0e10cSrcweir } 620cdf0e10cSrcweir break; 621cdf0e10cSrcweir 622cdf0e10cSrcweir case SID_MODIFY_FIELD: 623cdf0e10cSrcweir { 624cdf0e10cSrcweir OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); 625cdf0e10cSrcweir 626cdf0e10cSrcweir if( pOLV ) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir const SvxFieldItem* pFldItem = pOLV->GetFieldAtSelection(); 629cdf0e10cSrcweir 630cdf0e10cSrcweir if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) || 631cdf0e10cSrcweir pFldItem->GetField()->ISA( SvxAuthorField ) || 632cdf0e10cSrcweir pFldItem->GetField()->ISA( SvxExtFileField ) || 633cdf0e10cSrcweir pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir // Dialog... 636cdf0e10cSrcweir SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); 637cdf0e10cSrcweir AbstractSdModifyFieldDlg* pDlg = pFact ? pFact->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem->GetField(), pOLV->GetAttribs() ) : 0; 638cdf0e10cSrcweir if( pDlg && pDlg->Execute() == RET_OK ) 639cdf0e10cSrcweir { 640cdf0e10cSrcweir // #108538# 641cdf0e10cSrcweir // To make a correct SetAttribs() call at the utlinerView 642cdf0e10cSrcweir // it is necessary to split the actions here 643cdf0e10cSrcweir SvxFieldData* pField = pDlg->GetField(); 644cdf0e10cSrcweir ESelection aSel = pOLV->GetSelection(); 645cdf0e10cSrcweir sal_Bool bSelectionWasModified(sal_False); 646cdf0e10cSrcweir 647cdf0e10cSrcweir if( pField ) 648cdf0e10cSrcweir { 649cdf0e10cSrcweir SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD ); 650cdf0e10cSrcweir 651cdf0e10cSrcweir if( aSel.nStartPos == aSel.nEndPos ) 652cdf0e10cSrcweir { 653cdf0e10cSrcweir bSelectionWasModified = sal_True; 654cdf0e10cSrcweir aSel.nEndPos++; 655cdf0e10cSrcweir pOLV->SetSelection( aSel ); 656cdf0e10cSrcweir } 657cdf0e10cSrcweir 658cdf0e10cSrcweir pOLV->InsertField( aFieldItem ); 659cdf0e10cSrcweir 660cdf0e10cSrcweir // #108538# select again for eventual SetAttribs call 661cdf0e10cSrcweir pOLV->SetSelection( aSel ); 662cdf0e10cSrcweir } 663cdf0e10cSrcweir 664cdf0e10cSrcweir SfxItemSet aSet( pDlg->GetItemSet() ); 665cdf0e10cSrcweir 666cdf0e10cSrcweir if( aSet.Count() ) 667cdf0e10cSrcweir { 668cdf0e10cSrcweir pOLV->SetAttribs( aSet ); 669cdf0e10cSrcweir 670cdf0e10cSrcweir ::Outliner* pOutliner = pOLV->GetOutliner(); 671cdf0e10cSrcweir if( pOutliner ) 672cdf0e10cSrcweir pOutliner->UpdateFields(); 673cdf0e10cSrcweir } 674cdf0e10cSrcweir 675cdf0e10cSrcweir if(pField) 676cdf0e10cSrcweir { 677cdf0e10cSrcweir // #108538# restore selection to original 678cdf0e10cSrcweir if(bSelectionWasModified) 679cdf0e10cSrcweir { 680cdf0e10cSrcweir aSel.nEndPos--; 681cdf0e10cSrcweir pOLV->SetSelection( aSel ); 682cdf0e10cSrcweir } 683cdf0e10cSrcweir 684cdf0e10cSrcweir delete pField; 685cdf0e10cSrcweir } 686cdf0e10cSrcweir } 687cdf0e10cSrcweir delete pDlg; 688cdf0e10cSrcweir } 689cdf0e10cSrcweir } 690cdf0e10cSrcweir 691cdf0e10cSrcweir Cancel(); 692cdf0e10cSrcweir rReq.Ignore (); 693cdf0e10cSrcweir } 694cdf0e10cSrcweir break; 695cdf0e10cSrcweir 696cdf0e10cSrcweir case SID_OPEN_XML_FILTERSETTINGS: 697cdf0e10cSrcweir { 698cdf0e10cSrcweir try 699cdf0e10cSrcweir { 700cdf0e10cSrcweir com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), com::sun::star::uno::UNO_QUERY); 701cdf0e10cSrcweir if( xDialog.is() ) 702cdf0e10cSrcweir { 703cdf0e10cSrcweir xDialog->execute(); 704cdf0e10cSrcweir } 705cdf0e10cSrcweir } 706cdf0e10cSrcweir catch( ::com::sun::star::uno::RuntimeException& ) 707cdf0e10cSrcweir { 708cdf0e10cSrcweir } 709cdf0e10cSrcweir 710cdf0e10cSrcweir Cancel(); 711cdf0e10cSrcweir rReq.Ignore (); 712cdf0e10cSrcweir } 713cdf0e10cSrcweir break; 714cdf0e10cSrcweir 715cdf0e10cSrcweir default: 716cdf0e10cSrcweir { 717cdf0e10cSrcweir // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die 718cdf0e10cSrcweir // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp03 (drviewsb) 719cdf0e10cSrcweir // gewandert. 720cdf0e10cSrcweir FuTemp03(rReq); 721cdf0e10cSrcweir } 722cdf0e10cSrcweir break; 723cdf0e10cSrcweir }; 724cdf0e10cSrcweir }; 725cdf0e10cSrcweir 726cdf0e10cSrcweir bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const String & rName ) 727cdf0e10cSrcweir { 728cdf0e10cSrcweir sal_Bool bOutDummy; 729cdf0e10cSrcweir if( GetDoc()->GetPageByName( rName, bOutDummy ) != SDRPAGE_NOTFOUND ) 730cdf0e10cSrcweir return false; 731cdf0e10cSrcweir 732cdf0e10cSrcweir SdPage* pPageToRename = NULL; 733cdf0e10cSrcweir PageKind ePageKind = GetPageKind(); 734cdf0e10cSrcweir 735cdf0e10cSrcweir if( GetEditMode() == EM_PAGE ) 736cdf0e10cSrcweir { 737cdf0e10cSrcweir pPageToRename = GetDoc()->GetSdPage( nPageId - 1, ePageKind ); 738cdf0e10cSrcweir 739cdf0e10cSrcweir // Undo 740cdf0e10cSrcweir SdPage* pUndoPage = pPageToRename; 741cdf0e10cSrcweir SdrLayerAdmin & rLayerAdmin = GetDoc()->GetLayerAdmin(); 742cdf0e10cSrcweir sal_uInt8 nBackground = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRND )), sal_False ); 743cdf0e10cSrcweir sal_uInt8 nBgObj = rLayerAdmin.GetLayerID( String( SdResId( STR_LAYER_BCKGRNDOBJ )), sal_False ); 744cdf0e10cSrcweir SetOfByte aVisibleLayers = mpActualPage->TRG_GetMasterPageVisibleLayers(); 745cdf0e10cSrcweir 746cdf0e10cSrcweir // (#67720#) 747cdf0e10cSrcweir ::svl::IUndoManager* pManager = GetDoc()->GetDocSh()->GetUndoManager(); 748cdf0e10cSrcweir ModifyPageUndoAction* pAction = new ModifyPageUndoAction( 749cdf0e10cSrcweir GetDoc(), pUndoPage, rName, pUndoPage->GetAutoLayout(), 750cdf0e10cSrcweir aVisibleLayers.IsSet( nBackground ), 751cdf0e10cSrcweir aVisibleLayers.IsSet( nBgObj )); 752cdf0e10cSrcweir pManager->AddUndoAction( pAction ); 753cdf0e10cSrcweir 754cdf0e10cSrcweir // rename 755cdf0e10cSrcweir pPageToRename->SetName( rName ); 756cdf0e10cSrcweir 757cdf0e10cSrcweir if( ePageKind == PK_STANDARD ) 758cdf0e10cSrcweir { 759cdf0e10cSrcweir // also rename notes-page 760cdf0e10cSrcweir SdPage* pNotesPage = GetDoc()->GetSdPage( nPageId - 1, PK_NOTES ); 761cdf0e10cSrcweir pNotesPage->SetName( rName ); 762cdf0e10cSrcweir } 763cdf0e10cSrcweir } 764cdf0e10cSrcweir else 765cdf0e10cSrcweir { 766cdf0e10cSrcweir // rename MasterPage -> rename LayoutTemplate 767cdf0e10cSrcweir pPageToRename = GetDoc()->GetMasterSdPage( nPageId - 1, ePageKind ); 768cdf0e10cSrcweir GetDoc()->RenameLayoutTemplate( pPageToRename->GetLayoutName(), rName ); 769cdf0e10cSrcweir } 770cdf0e10cSrcweir 771cdf0e10cSrcweir bool bSuccess = ( sal_False != rName.Equals( pPageToRename->GetName())); 772cdf0e10cSrcweir 773cdf0e10cSrcweir if( bSuccess ) 774cdf0e10cSrcweir { 775cdf0e10cSrcweir // user edited page names may be changed by the page so update control 776cdf0e10cSrcweir maTabControl.SetPageText( nPageId, rName ); 777cdf0e10cSrcweir 778cdf0e10cSrcweir // set document to modified state 779cdf0e10cSrcweir GetDoc()->SetChanged( sal_True ); 780cdf0e10cSrcweir 781cdf0e10cSrcweir // inform navigator about change 782cdf0e10cSrcweir SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True ); 783cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( 784cdf0e10cSrcweir SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); 785cdf0e10cSrcweir 786cdf0e10cSrcweir // Tell the slide sorter about the name change (necessary for 787cdf0e10cSrcweir // accessibility.) 788cdf0e10cSrcweir slidesorter::SlideSorterViewShell* pSlideSorterViewShell 789cdf0e10cSrcweir = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase()); 790cdf0e10cSrcweir if (pSlideSorterViewShell != NULL) 791cdf0e10cSrcweir { 792cdf0e10cSrcweir pSlideSorterViewShell->GetSlideSorter().GetController().PageNameHasChanged( 793cdf0e10cSrcweir nPageId-1, rName); 794cdf0e10cSrcweir } 795cdf0e10cSrcweir } 796cdf0e10cSrcweir 797cdf0e10cSrcweir return bSuccess; 798cdf0e10cSrcweir } 799cdf0e10cSrcweir 800cdf0e10cSrcweir 801cdf0e10cSrcweir 802cdf0e10cSrcweir 803cdf0e10cSrcweir IMPL_LINK( DrawViewShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog ) 804cdf0e10cSrcweir { 805cdf0e10cSrcweir if( ! pDialog ) 806cdf0e10cSrcweir return 0; 807cdf0e10cSrcweir 808cdf0e10cSrcweir String aNewName; 809cdf0e10cSrcweir pDialog->GetName( aNewName ); 810cdf0e10cSrcweir 811cdf0e10cSrcweir SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl.GetCurPageId() - 1, GetPageKind() ); 812cdf0e10cSrcweir 813cdf0e10cSrcweir return pCurrentPage && ( aNewName.Equals( pCurrentPage->GetName() ) || GetDocSh()->IsNewPageNameValid( aNewName ) ); 814cdf0e10cSrcweir } 815cdf0e10cSrcweir 816cdf0e10cSrcweir 817cdf0e10cSrcweir 818cdf0e10cSrcweir 819cdf0e10cSrcweir void DrawViewShell::ModifyLayer ( 820cdf0e10cSrcweir SdrLayer* pLayer, 821cdf0e10cSrcweir const String& rLayerName, 822cdf0e10cSrcweir const String& rLayerTitle, 823cdf0e10cSrcweir const String& rLayerDesc, 824cdf0e10cSrcweir bool bIsVisible, 825cdf0e10cSrcweir bool bIsLocked, 826cdf0e10cSrcweir bool bIsPrintable) 827cdf0e10cSrcweir { 828cdf0e10cSrcweir if( pLayer ) 829cdf0e10cSrcweir { 830cdf0e10cSrcweir const sal_uInt16 nPageCount = GetLayerTabControl()->GetPageCount(); 831cdf0e10cSrcweir sal_uInt16 nCurPage = 0; 832cdf0e10cSrcweir sal_uInt16 nPos; 833cdf0e10cSrcweir for( nPos = 0; nPos < nPageCount; nPos++ ) 834cdf0e10cSrcweir { 835cdf0e10cSrcweir sal_uInt16 nId = GetLayerTabControl()->GetPageId( nPos ); 836cdf0e10cSrcweir if( pLayer->GetName() == GetLayerTabControl()->GetPageText( nId ) ) 837cdf0e10cSrcweir { 838cdf0e10cSrcweir nCurPage = nId; 839cdf0e10cSrcweir break; 840cdf0e10cSrcweir } 841cdf0e10cSrcweir } 842cdf0e10cSrcweir 843cdf0e10cSrcweir pLayer->SetName( rLayerName ); 844cdf0e10cSrcweir pLayer->SetTitle( rLayerTitle ); 845cdf0e10cSrcweir pLayer->SetDescription( rLayerDesc ); 846cdf0e10cSrcweir mpDrawView->SetLayerVisible( rLayerName, bIsVisible ); 847cdf0e10cSrcweir mpDrawView->SetLayerLocked( rLayerName, bIsLocked); 848cdf0e10cSrcweir mpDrawView->SetLayerPrintable(rLayerName, bIsPrintable); 849cdf0e10cSrcweir 850cdf0e10cSrcweir GetDoc()->SetChanged(sal_True); 851cdf0e10cSrcweir 852cdf0e10cSrcweir GetLayerTabControl()->SetPageText(nCurPage, rLayerName); 853cdf0e10cSrcweir 854cdf0e10cSrcweir TabBarPageBits nBits = 0; 855cdf0e10cSrcweir 856cdf0e10cSrcweir if (!bIsVisible) 857cdf0e10cSrcweir { 858cdf0e10cSrcweir // Unsichtbare Layer werden anders dargestellt 859cdf0e10cSrcweir nBits = TPB_SPECIAL; 860cdf0e10cSrcweir } 861cdf0e10cSrcweir 862cdf0e10cSrcweir GetLayerTabControl()->SetPageBits(nCurPage, nBits); 863cdf0e10cSrcweir 864cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( 865cdf0e10cSrcweir SID_SWITCHLAYER, 866cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD); 867cdf0e10cSrcweir 868cdf0e10cSrcweir // Call Invalidate at the form shell. 869cdf0e10cSrcweir FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); 870cdf0e10cSrcweir if (pFormShell != NULL) 871cdf0e10cSrcweir pFormShell->Invalidate(); 872cdf0e10cSrcweir } 873cdf0e10cSrcweir } 874cdf0e10cSrcweir 875cdf0e10cSrcweir } // end of namespace sd 876