1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drviewsb.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
33 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
34 #include <comphelper/processfactory.hxx>
35 #include <svx/svdlayer.hxx>
37 #include <svx/svxids.hrc>
40 #include <svx/hyprlink.hxx>
41 #include <sfx2/viewfrm.hxx>
42 #include <svx/hlnkitem.hxx>
43 #include <tools/urlobj.hxx>
44 #include <svx/eeitem.hxx>
46 #include <svx/flditem.hxx>
48 #include <vcl/msgbox.hxx>
49 #include <sfx2/request.hxx>
50 #include <sfx2/dispatch.hxx>
51 #include <svx/svdorect.hxx>
52 #include <sfx2/docfile.hxx>
53 #include <basic/sbstar.hxx>
54 #include <basic/sberrors.hxx>
55 #include <svx/fmshell.hxx>
56 #include <svx/svxdlg.hxx>
57 #include <svx/dialogs.hrc>
58 #include <svtools/useroptions.hxx>
61 #include "strings.hrc"
62 #include "res_bmp.hrc"
64 #include "Outliner.hxx"
68 #include "drawdoc.hxx"
69 #include "DrawDocShell.hxx"
70 #include "sdresid.hxx"
72 #include "DrawViewShell.hxx"
73 #include "drawview.hxx"
74 #include "unmodpg.hxx"
75 #include "undolayer.hxx"
76 #include "ViewShellBase.hxx"
77 #include "FormShellManager.hxx"
78 #include "LayerTabBar.hxx"
79 #include "sdabstdlg.hxx"
80 #include "SlideSorterViewShell.hxx"
81 #include "SlideSorter.hxx"
82 #include "controller/SlideSorterController.hxx"
84 #define RET_DELETE 100
88 /*************************************************************************
90 |* SfxRequests fuer temporaere Funktionen
92 \************************************************************************/
94 void DrawViewShell::FuTemp02(SfxRequest
& rReq
)
96 USHORT nSId
= rReq
.GetSlot();
101 if ( mpDrawView
->IsTextEdit() )
103 mpDrawView
->SdrEndTextEdit();
106 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
107 USHORT nLayerCnt
= rLayerAdmin
.GetLayerCount();
108 USHORT nLayer
= nLayerCnt
- 2 + 1;
109 String
aLayerName ( SdResId(STR_LAYER
) ), aLayerTitle
, aLayerDesc
;
110 aLayerName
+= String::CreateFromInt32( (sal_Int32
)nLayer
);
111 BOOL bIsVisible
= FALSE
;
112 BOOL bIsLocked
= FALSE
;
113 BOOL bIsPrintable
= FALSE
;
115 const SfxItemSet
* pArgs
= rReq
.GetArgs();
119 SfxItemSet
aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START
, ATTR_LAYER_END
);
121 aNewAttr
.Put( SdAttrLayerName( aLayerName
) );
122 aNewAttr
.Put( SdAttrLayerTitle() );
123 aNewAttr
.Put( SdAttrLayerDesc() );
124 aNewAttr
.Put( SdAttrLayerVisible() );
125 aNewAttr
.Put( SdAttrLayerPrintable() );
126 aNewAttr
.Put( SdAttrLayerLocked() );
127 aNewAttr
.Put( SdAttrLayerThisPage() );
129 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
130 AbstractSdInsertLayerDlg
* pDlg
= pFact
? pFact
->CreateSdInsertLayerDlg(NULL
, aNewAttr
, true, String( SdResId( STR_INSERTLAYER
) ) ) : 0;
133 pDlg
->SetHelpId( SID_INSERTLAYER
);
135 // Ueberpruefung auf schon vorhandene Namen
137 while( bLoop
&& pDlg
->Execute() == RET_OK
)
139 pDlg
->GetAttr( aNewAttr
);
140 aLayerName
= ((SdAttrLayerName
&) aNewAttr
.Get (ATTR_LAYER_NAME
)).GetValue ();
142 if( rLayerAdmin
.GetLayer( aLayerName
, FALSE
)
143 || aLayerName
.Len()==0 )
145 // Name ist schon vorhanden
146 WarningBox
aWarningBox (
149 String(SdResId( STR_WARN_NAME_DUPLICATE
)));
150 aWarningBox
.Execute();
155 if( bLoop
) // wurde abgebrochen
165 //pDlg->GetAttr( aNewAttr );
166 //aLayerName = ((SdAttrLayerName &) aNewAttr.Get (ATTR_LAYER_NAME)).GetValue ();
167 aLayerTitle
= ((SdAttrLayerTitle
&) aNewAttr
.Get (ATTR_LAYER_TITLE
)).GetValue ();
168 aLayerDesc
= ((SdAttrLayerDesc
&) aNewAttr
.Get (ATTR_LAYER_DESC
)).GetValue ();
169 bIsVisible
= ((SdAttrLayerVisible
&) aNewAttr
.Get (ATTR_LAYER_VISIBLE
)).GetValue ();
170 bIsLocked
= ((SdAttrLayerLocked
&) aNewAttr
.Get (ATTR_LAYER_LOCKED
)).GetValue () ;
171 bIsPrintable
= ((SdAttrLayerPrintable
&) aNewAttr
.Get (ATTR_LAYER_PRINTABLE
)).GetValue () ;
177 else if (pArgs
->Count () != 4)
179 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
186 SFX_REQUEST_ARG (rReq
, pLayerName
, SfxStringItem
, ID_VAL_LAYERNAME
, FALSE
);
187 SFX_REQUEST_ARG (rReq
, pIsVisible
, SfxBoolItem
, ID_VAL_ISVISIBLE
, FALSE
);
188 SFX_REQUEST_ARG (rReq
, pIsLocked
, SfxBoolItem
, ID_VAL_ISLOCKED
, FALSE
);
189 SFX_REQUEST_ARG (rReq
, pIsPrintable
, SfxBoolItem
, ID_VAL_ISPRINTABLE
, FALSE
);
191 aLayerName
= pLayerName
->GetValue ();
192 bIsVisible
= pIsVisible
->GetValue ();
193 bIsLocked
= pIsLocked
->GetValue ();
194 bIsPrintable
= pIsPrintable
->GetValue ();
197 String aPrevLayer
= mpDrawView
->GetActiveLayer();
200 USHORT nPrevLayer
= 0;
201 nLayerCnt
= rLayerAdmin
.GetLayerCount();
203 for ( nLayer
= 0; nLayer
< nLayerCnt
; nLayer
++ )
205 pLayer
= rLayerAdmin
.GetLayer(nLayer
);
206 aName
= pLayer
->GetName();
208 if ( aPrevLayer
== aName
)
210 // nPrevLayer = nLayer;
211 nPrevLayer
= Max(nLayer
, (USHORT
) 4);
215 mpDrawView
->InsertNewLayer(aLayerName
, nPrevLayer
+ 1);
216 pLayer
= rLayerAdmin
.GetLayer(aLayerName
, FALSE
);
219 pLayer
->SetTitle( aLayerTitle
);
220 pLayer
->SetDescription( aLayerDesc
);
223 mpDrawView
->SetLayerVisible( aLayerName
, bIsVisible
);
224 mpDrawView
->SetLayerLocked( aLayerName
, bIsLocked
);
225 mpDrawView
->SetLayerPrintable(aLayerName
, bIsPrintable
);
227 mpDrawView
->SetActiveLayer(aLayerName
);
231 GetDoc()->SetChanged(TRUE
);
233 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHLAYER
,
234 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
241 case SID_MODIFYLAYER
:
243 if ( mpDrawView
->IsTextEdit() )
245 mpDrawView
->SdrEndTextEdit();
248 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
249 USHORT nCurPage
= GetLayerTabControl()->GetCurPageId();
250 String
aLayerName( GetLayerTabControl()->GetPageText(nCurPage
) );
251 SdrLayer
* pLayer
= rLayerAdmin
.GetLayer(aLayerName
, FALSE
);
253 String
aLayerTitle( pLayer
->GetTitle() );
254 String
aLayerDesc( pLayer
->GetDescription() );
256 String
aOldLayerName( aLayerName
);
257 String
aOldLayerTitle( aLayerTitle
);
258 String
aOldLayerDesc( aLayerDesc
);
260 BOOL bIsVisible
, bIsLocked
, bIsPrintable
;
261 BOOL bOldIsVisible
= bIsVisible
= mpDrawView
->IsLayerVisible(aLayerName
);
262 BOOL bOldIsLocked
= bIsLocked
= mpDrawView
->IsLayerLocked(aLayerName
);
263 BOOL bOldIsPrintable
= bIsPrintable
= mpDrawView
->IsLayerPrintable(aLayerName
);
266 const SfxItemSet
* pArgs
= rReq
.GetArgs();
267 // darf der Layer geloescht werden ?
270 String
aLayoutLayer ( SdResId(STR_LAYER_LAYOUT
) );
271 String
aControlsLayer ( SdResId(STR_LAYER_CONTROLS
) );
272 String
aMeasureLinesLayer ( SdResId(STR_LAYER_MEASURELINES
) );
273 String
aBackgroundLayer( SdResId(STR_LAYER_BCKGRND
) );
274 String
aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ
) );
276 if( aLayerName
== aLayoutLayer
|| aLayerName
== aControlsLayer
||
277 aLayerName
== aMeasureLinesLayer
||
278 aLayerName
== aBackgroundLayer
|| aLayerName
== aBackgroundObjLayer
)
285 SfxItemSet
aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START
, ATTR_LAYER_END
);
287 aNewAttr
.Put( SdAttrLayerName( aLayerName
) );
288 aNewAttr
.Put( SdAttrLayerTitle( aLayerTitle
) );
289 aNewAttr
.Put( SdAttrLayerDesc( aLayerDesc
) );
290 aNewAttr
.Put( SdAttrLayerVisible( bIsVisible
) );
291 aNewAttr
.Put( SdAttrLayerLocked( bIsLocked
) );
292 aNewAttr
.Put( SdAttrLayerPrintable( bIsPrintable
) );
293 aNewAttr
.Put( SdAttrLayerThisPage() );
295 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
296 AbstractSdInsertLayerDlg
* pDlg
= pFact
? pFact
->CreateSdInsertLayerDlg(NULL
, aNewAttr
, bDelete
, String( SdResId( STR_MODIFYLAYER
) ) ) : 0;
299 pDlg
->SetHelpId( SID_MODIFYLAYER
);
301 // Ueberpruefung auf schon vorhandene Namen
304 while( bLoop
&& ( (nRet
= pDlg
->Execute()) == RET_OK
) )
306 pDlg
->GetAttr( aNewAttr
);
307 aLayerName
= ((SdAttrLayerName
&) aNewAttr
.Get (ATTR_LAYER_NAME
)).GetValue ();
309 if( (rLayerAdmin
.GetLayer( aLayerName
, FALSE
) &&
310 aLayerName
!= aOldLayerName
) || aLayerName
.Len()==0 )
312 // Name ist schon vorhanden
313 WarningBox
aWarningBox (
316 String( SdResId( STR_WARN_NAME_DUPLICATE
)));
317 aWarningBox
.Execute();
325 aLayerTitle
= ((SdAttrLayerTitle
&) aNewAttr
.Get (ATTR_LAYER_TITLE
)).GetValue ();
326 aLayerDesc
= ((SdAttrLayerDesc
&) aNewAttr
.Get (ATTR_LAYER_DESC
)).GetValue ();
327 bIsVisible
= ((const SdAttrLayerVisible
&) aNewAttr
.Get (ATTR_LAYER_VISIBLE
)).GetValue ();
328 bIsLocked
= ((const SdAttrLayerLocked
&) aNewAttr
.Get (ATTR_LAYER_LOCKED
)).GetValue ();
329 bIsPrintable
= ((const SdAttrLayerLocked
&) aNewAttr
.Get (ATTR_LAYER_PRINTABLE
)).GetValue ();
342 else if (pArgs
->Count () == 4)
344 SFX_REQUEST_ARG (rReq
, pLayerName
, SfxStringItem
, ID_VAL_LAYERNAME
, FALSE
);
345 SFX_REQUEST_ARG (rReq
, pIsVisible
, SfxBoolItem
, ID_VAL_ISVISIBLE
, FALSE
);
346 SFX_REQUEST_ARG (rReq
, pIsLocked
, SfxBoolItem
, ID_VAL_ISLOCKED
, FALSE
);
347 SFX_REQUEST_ARG (rReq
, pIsPrintable
, SfxBoolItem
, ID_VAL_ISPRINTABLE
, FALSE
);
349 aLayerName
= pLayerName
->GetValue ();
350 bIsVisible
= pIsVisible
->GetValue ();
351 bIsLocked
= pIsLocked
->GetValue ();
352 bIsPrintable
= pIsPrintable
->GetValue ();
356 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
362 SfxUndoManager
* pManager
= GetDoc()->GetDocSh()->GetUndoManager();
363 SdLayerModifyUndoAction
* pAction
= new SdLayerModifyUndoAction(
381 pManager
->AddUndoAction( pAction
);
383 ModifyLayer( pLayer
, aLayerName
, aLayerTitle
, aLayerDesc
, bIsVisible
, bIsLocked
, bIsPrintable
);
390 case SID_RENAMELAYER
:
392 if ( mpDrawView
->IsTextEdit() )
394 mpDrawView
->SdrEndTextEdit();
397 GetLayerTabControl()->StartEditMode(
398 GetLayerTabControl()->GetCurPageId() );
405 case SID_EDIT_HYPERLINK
:
407 GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG
);
414 case SID_OPEN_HYPERLINK
:
416 OutlinerView
* pOutView
= mpDrawView
->GetTextEditOutlinerView();
419 const SvxFieldItem
* pFieldItem
= pOutView
->GetFieldAtSelection();
422 const SvxFieldData
* pField
= pFieldItem
->GetField();
423 if( pField
&& pField
->ISA( SvxURLField
) )
425 const SvxURLField
* pURLField
= static_cast< const SvxURLField
* >( pField
);
427 SfxStringItem
aUrl( SID_FILE_NAME
, pURLField
->GetURL() );
428 SfxStringItem
aTarget( SID_TARGETNAME
, pURLField
->GetTargetFrame() );
431 SfxViewFrame
* pFrame
= GetViewFrame();
432 SfxMedium
* pMed
= pFrame
->GetObjectShell()->GetMedium();
434 aReferName
= pMed
->GetName();
436 SfxFrameItem
aFrm( SID_DOCFRAME
, pFrame
);
437 SfxStringItem
aReferer( SID_REFERER
, aReferName
);
439 SfxBoolItem
aNewView( SID_OPEN_NEW_VIEW
, FALSE
);
440 SfxBoolItem
aBrowsing( SID_BROWSE
, TRUE
);
442 SfxViewFrame
* pViewFrm
= SfxViewFrame::Current();
444 pViewFrm
->GetDispatcher()->Execute( SID_OPENDOC
,
445 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
,
448 &aNewView
, &aBrowsing
,
458 case SID_HYPERLINK_SETLINK
:
460 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
464 SvxHyperlinkItem
* pHLItem
=
465 (SvxHyperlinkItem
*) &pReqArgs
->Get(SID_HYPERLINK_SETLINK
);
467 if (pHLItem
->GetInsertMode() == HLINK_FIELD
)
469 InsertURLField(pHLItem
->GetURL(), pHLItem
->GetName(),
470 pHLItem
->GetTargetFrame(), NULL
);
472 else if (pHLItem
->GetInsertMode() == HLINK_BUTTON
)
474 InsertURLButton(pHLItem
->GetURL(), pHLItem
->GetName(),
475 pHLItem
->GetTargetFrame(), NULL
);
477 else if (pHLItem
->GetInsertMode() == HLINK_DEFAULT
)
479 OutlinerView
* pOlView
= mpDrawView
->GetTextEditOutlinerView();
483 InsertURLField(pHLItem
->GetURL(), pHLItem
->GetName(),
484 pHLItem
->GetTargetFrame(), NULL
);
488 InsertURLButton(pHLItem
->GetURL(), pHLItem
->GetName(),
489 pHLItem
->GetTargetFrame(), NULL
);
499 case SID_INSERT_FLD_DATE_FIX
:
500 case SID_INSERT_FLD_DATE_VAR
:
501 case SID_INSERT_FLD_TIME_FIX
:
502 case SID_INSERT_FLD_TIME_VAR
:
503 case SID_INSERT_FLD_AUTHOR
:
504 case SID_INSERT_FLD_PAGE
:
505 case SID_INSERT_FLD_PAGES
:
506 case SID_INSERT_FLD_FILE
:
509 SvxFieldItem
* pFieldItem
= 0;
513 case SID_INSERT_FLD_DATE_FIX
:
514 pFieldItem
= new SvxFieldItem(
515 SvxDateField( Date(), SVXDATETYPE_FIX
), EE_FEATURE_FIELD
);
518 case SID_INSERT_FLD_DATE_VAR
:
519 pFieldItem
= new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD
);
522 case SID_INSERT_FLD_TIME_FIX
:
523 pFieldItem
= new SvxFieldItem(
524 SvxExtTimeField( Time(), SVXTIMETYPE_FIX
), EE_FEATURE_FIELD
);
527 case SID_INSERT_FLD_TIME_VAR
:
528 pFieldItem
= new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD
);
531 case SID_INSERT_FLD_AUTHOR
:
533 SvtUserOptions aUserOptions
;
534 pFieldItem
= new SvxFieldItem(
536 aUserOptions
.GetFirstName(), aUserOptions
.GetLastName(), aUserOptions
.GetID() ), EE_FEATURE_FIELD
);
540 case SID_INSERT_FLD_PAGE
:
542 pFieldItem
= new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD
);
547 case SID_INSERT_FLD_PAGES
:
549 pFieldItem
= new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD
);
554 case SID_INSERT_FLD_FILE
:
557 if( GetDocSh()->HasName() )
558 aName
= GetDocSh()->GetMedium()->GetName();
560 // aName = GetDocSh()->GetName();
561 pFieldItem
= new SvxFieldItem( SvxExtFileField( aName
), EE_FEATURE_FIELD
);
566 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
570 const SvxFieldItem
* pOldFldItem
= pOLV
->GetFieldAtSelection();
572 if( pOldFldItem
&& ( pOldFldItem
->GetField()->ISA( SvxURLField
) ||
573 pOldFldItem
->GetField()->ISA( SvxDateField
) ||
574 pOldFldItem
->GetField()->ISA( SvxTimeField
) ||
575 pOldFldItem
->GetField()->ISA( SvxExtTimeField
) ||
576 pOldFldItem
->GetField()->ISA( SvxExtFileField
) ||
577 pOldFldItem
->GetField()->ISA( SvxAuthorField
) ||
578 pOldFldItem
->GetField()->ISA( SvxPageField
) ) )
580 // Feld selektieren, so dass es beim Insert geloescht wird
581 ESelection aSel
= pOLV
->GetSelection();
582 if( aSel
.nStartPos
== aSel
.nEndPos
)
584 pOLV
->SetSelection( aSel
);
588 pOLV
->InsertField( *pFieldItem
);
592 Outliner
* pOutl
= GetDoc()->GetInternalOutliner();
593 pOutl
->Init( OUTLINERMODE_TEXTOBJECT
);
594 USHORT nOutlMode
= pOutl
->GetMode();
595 pOutl
->SetStyleSheet( 0, NULL
);
596 pOutl
->QuickInsertField( *pFieldItem
, ESelection() );
597 OutlinerParaObject
* pOutlParaObject
= pOutl
->CreateParaObject();
599 SdrRectObj
* pRectObj
= new SdrRectObj( OBJ_TEXT
);
600 pRectObj
->SetMergedItem(SdrTextAutoGrowWidthItem(TRUE
));
602 pOutl
->UpdateFields();
603 pOutl
->SetUpdateMode( TRUE
);
604 Size
aSize( pOutl
->CalcTextSize() );
605 aSize
.Width() *= nMul
;
606 pOutl
->SetUpdateMode( FALSE
);
609 Rectangle
aRect( aPos
, GetActiveWindow()->GetOutputSizePixel() );
610 aPos
= aRect
.Center();
611 aPos
= GetActiveWindow()->PixelToLogic(aPos
);
612 aPos
.X() -= aSize
.Width() / 2;
613 aPos
.Y() -= aSize
.Height() / 2;
615 Rectangle
aLogicRect(aPos
, aSize
);
616 pRectObj
->SetLogicRect(aLogicRect
);
617 pRectObj
->SetOutlinerParaObject( pOutlParaObject
);
618 mpDrawView
->InsertObjectAtView(pRectObj
, *mpDrawView
->GetSdrPageView());
619 pOutl
->Init( nOutlMode
);
629 case SID_MODIFY_FIELD
:
631 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
635 const SvxFieldItem
* pFldItem
= pOLV
->GetFieldAtSelection();
637 if( pFldItem
&& (pFldItem
->GetField()->ISA( SvxDateField
) ||
638 pFldItem
->GetField()->ISA( SvxAuthorField
) ||
639 pFldItem
->GetField()->ISA( SvxExtFileField
) ||
640 pFldItem
->GetField()->ISA( SvxExtTimeField
) ) )
643 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
644 AbstractSdModifyFieldDlg
* pDlg
= pFact
? pFact
->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem
->GetField(), pOLV
->GetAttribs() ) : 0;
645 if( pDlg
&& pDlg
->Execute() == RET_OK
)
648 // To make a correct SetAttribs() call at the utlinerView
649 // it is necessary to split the actions here
650 SvxFieldData
* pField
= pDlg
->GetField();
651 ESelection aSel
= pOLV
->GetSelection();
652 sal_Bool
bSelectionWasModified(sal_False
);
656 SvxFieldItem
aFieldItem( *pField
, EE_FEATURE_FIELD
);
658 if( aSel
.nStartPos
== aSel
.nEndPos
)
660 bSelectionWasModified
= sal_True
;
662 pOLV
->SetSelection( aSel
);
665 pOLV
->InsertField( aFieldItem
);
667 // #108538# select again for eventual SetAttribs call
668 pOLV
->SetSelection( aSel
);
671 SfxItemSet
aSet( pDlg
->GetItemSet() );
675 pOLV
->SetAttribs( aSet
);
677 ::Outliner
* pOutliner
= pOLV
->GetOutliner();
679 pOutliner
->UpdateFields();
684 // #108538# restore selection to original
685 if(bSelectionWasModified
)
688 pOLV
->SetSelection( aSel
);
703 case SID_OPEN_XML_FILTERSETTINGS
:
707 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
);
713 catch( ::com::sun::star::uno::RuntimeException
& )
724 // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
725 // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp03 (drviewsb)
733 bool DrawViewShell::RenameSlide( USHORT nPageId
, const String
& rName
)
736 if( GetDoc()->GetPageByName( rName
, bOutDummy
) != SDRPAGE_NOTFOUND
)
739 SdPage
* pPageToRename
= NULL
;
740 PageKind ePageKind
= GetPageKind();
742 if( GetEditMode() == EM_PAGE
)
744 pPageToRename
= GetDoc()->GetSdPage( nPageId
- 1, ePageKind
);
747 SdPage
* pUndoPage
= pPageToRename
;
748 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
749 BYTE nBackground
= rLayerAdmin
.GetLayerID( String( SdResId( STR_LAYER_BCKGRND
)), FALSE
);
750 BYTE nBgObj
= rLayerAdmin
.GetLayerID( String( SdResId( STR_LAYER_BCKGRNDOBJ
)), FALSE
);
751 SetOfByte aVisibleLayers
= mpActualPage
->TRG_GetMasterPageVisibleLayers();
754 SfxUndoManager
* pManager
= GetDoc()->GetDocSh()->GetUndoManager();
755 ModifyPageUndoAction
* pAction
= new ModifyPageUndoAction(
756 pManager
, GetDoc(), pUndoPage
, rName
, pUndoPage
->GetAutoLayout(),
757 aVisibleLayers
.IsSet( nBackground
),
758 aVisibleLayers
.IsSet( nBgObj
));
759 pManager
->AddUndoAction( pAction
);
762 pPageToRename
->SetName( rName
);
764 if( ePageKind
== PK_STANDARD
)
766 // also rename notes-page
767 SdPage
* pNotesPage
= GetDoc()->GetSdPage( nPageId
- 1, PK_NOTES
);
768 pNotesPage
->SetName( rName
);
773 // rename MasterPage -> rename LayoutTemplate
774 pPageToRename
= GetDoc()->GetMasterSdPage( nPageId
- 1, ePageKind
);
775 GetDoc()->RenameLayoutTemplate( pPageToRename
->GetLayoutName(), rName
);
778 bool bSuccess
= ( FALSE
!= rName
.Equals( pPageToRename
->GetName()));
782 // user edited page names may be changed by the page so update control
783 maTabControl
.SetPageText( nPageId
, rName
);
785 // set document to modified state
786 GetDoc()->SetChanged( TRUE
);
788 // inform navigator about change
789 SfxBoolItem
aItem( SID_NAVIGATOR_INIT
, TRUE
);
790 GetViewFrame()->GetDispatcher()->Execute(
791 SID_NAVIGATOR_INIT
, SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
, &aItem
, 0L );
793 // Tell the slide sorter about the name change (necessary for
795 slidesorter::SlideSorterViewShell
* pSlideSorterViewShell
796 = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
797 if (pSlideSorterViewShell
!= NULL
)
799 pSlideSorterViewShell
->GetSlideSorter().GetController().PageNameHasChanged(
810 IMPL_LINK( DrawViewShell
, RenameSlideHdl
, AbstractSvxNameDialog
*, pDialog
)
816 pDialog
->GetName( aNewName
);
818 SdPage
* pCurrentPage
= GetDoc()->GetSdPage( maTabControl
.GetCurPageId() - 1, GetPageKind() );
820 return pCurrentPage
&& ( aNewName
.Equals( pCurrentPage
->GetName() ) || GetDocSh()->IsNewPageNameValid( aNewName
) );
826 void DrawViewShell::ModifyLayer (
828 const String
& rLayerName
,
829 const String
& rLayerTitle
,
830 const String
& rLayerDesc
,
837 const USHORT nPageCount
= GetLayerTabControl()->GetPageCount();
840 for( nPos
= 0; nPos
< nPageCount
; nPos
++ )
842 USHORT nId
= GetLayerTabControl()->GetPageId( nPos
);
843 if( pLayer
->GetName() == GetLayerTabControl()->GetPageText( nId
) )
850 pLayer
->SetName( rLayerName
);
851 pLayer
->SetTitle( rLayerTitle
);
852 pLayer
->SetDescription( rLayerDesc
);
853 mpDrawView
->SetLayerVisible( rLayerName
, bIsVisible
);
854 mpDrawView
->SetLayerLocked( rLayerName
, bIsLocked
);
855 mpDrawView
->SetLayerPrintable(rLayerName
, bIsPrintable
);
857 GetDoc()->SetChanged(TRUE
);
859 GetLayerTabControl()->SetPageText(nCurPage
, rLayerName
);
861 TabBarPageBits nBits
= 0;
865 // Unsichtbare Layer werden anders dargestellt
869 GetLayerTabControl()->SetPageBits(nCurPage
, nBits
);
871 GetViewFrame()->GetDispatcher()->Execute(
873 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
875 // Call Invalidate at the form shell.
876 FmFormShell
* pFormShell
= GetViewShellBase().GetFormShellManager()->GetFormShell();
877 if (pFormShell
!= NULL
)
878 pFormShell
->Invalidate();
882 } // end of namespace sd