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: drviews3.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"
34 #include "DrawViewShell.hxx"
36 #include <sfx2/viewfrm.hxx>
37 #include <svx/eeitem.hxx>
38 #include <svx/tstpitem.hxx>
39 #include <svx/lrspitem.hxx>
40 #include <svx/protitem.hxx>
41 #include <svx/frmdiritem.hxx>
42 #include <svx/ruler.hxx>
43 #include <svx/numitem.hxx>
44 #ifndef _SVX_RULERITEM_HXX
45 #include <svx/rulritem.hxx>
47 #include <svx/zoomitem.hxx>
49 #include <svx/svxids.hrc>
51 #include <svx/svdpagv.hxx>
52 #include <sfx2/request.hxx>
53 #include <sfx2/dispatch.hxx>
54 #include <tools/urlobj.hxx>
55 #include <svtools/aeitem.hxx>
56 #include <svtools/eitem.hxx>
57 #include <svtools/rectitem.hxx>
58 #include <svtools/stritem.hxx>
59 #include <svx/svdoole2.hxx>
60 #include <svtools/itempool.hxx>
61 #include <svtools/ptitem.hxx>
62 #include <basic/sbstar.hxx>
63 #include <basic/sberrors.hxx>
64 #include <svx/fmshell.hxx>
65 #include <svx/f3dchild.hxx>
66 #include <svx/float3d.hxx>
67 #include "optsitem.hxx"
71 #include "strings.hrc"
72 #include "res_bmp.hrc"
74 #include "sdundogr.hxx"
75 #include "undopage.hxx"
79 #include "slideshow.hxx"
81 #include "FrameView.hxx"
85 #include "sdresid.hxx"
86 #include "drawview.hxx"
87 #include "drawdoc.hxx"
88 #include "DrawViewShell.hxx"
90 #include "DrawDocShell.hxx"
91 #include "headerfooterdlg.hxx"
92 #include "masterlayoutdlg.hxx"
94 #include "DrawDocShell.hxx"
95 #include "sdabstdlg.hxx"
96 #include <sfx2/ipclient.hxx>
97 #include "ViewShellBase.hxx"
98 #include "FormShellManager.hxx"
99 #include "LayerTabBar.hxx"
100 #include "sdabstdlg.hxx"
101 #include "sdpage.hxx"
102 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
103 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
104 #include <com/sun/star/drawing/framework/XConfiguration.hpp>
106 using namespace ::com::sun::star::uno
;
107 using namespace ::com::sun::star::drawing::framework
;
111 #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
112 #define SO2_DECL_SVINPLACEOBJECT_DEFINED
113 SO2_DECL_REF(SvInPlaceObject
)
118 /*************************************************************************
120 |* SfxRequests fuer Controller bearbeiten
122 \************************************************************************/
124 void DrawViewShell::ExecCtrl(SfxRequest
& rReq
)
126 // waehrend einer Diashow wird nichts ausser dem Seitenwechsel und dem
127 // Sprung zur Bookmark ausgefuehrt!
128 if( HasCurrentFunction(SID_PRESENTATION
) &&
129 rReq
.GetSlot() != SID_SWITCHPAGE
&&
130 rReq
.GetSlot() != SID_JUMPTOMARK
)
135 // End text edit mode for some requests.
136 USHORT nSlot
= rReq
.GetSlot();
139 case SID_OUTPUT_QUALITY_COLOR
:
140 case SID_OUTPUT_QUALITY_GRAYSCALE
:
141 case SID_OUTPUT_QUALITY_BLACKWHITE
:
142 case SID_OUTPUT_QUALITY_CONTRAST
:
146 if ( mpDrawView
->IsTextEdit() )
148 mpDrawView
->SdrEndTextEdit();
152 // USHORT nSlot = rReq.GetSlot();
155 case SID_SWITCHPAGE
: // BASIC
157 BOOL bWasBasic
= FALSE
;
159 // switch page in running slide show
160 if(SlideShow::IsRunning(GetViewShellBase()) && rReq
.GetArgs())
162 SFX_REQUEST_ARG(rReq
, pWhatPage
, SfxUInt32Item
, ID_VAL_WHATPAGE
, FALSE
);
163 SlideShow::GetSlideShow(GetViewShellBase())->jumpToPageNumber((sal_Int32
)((pWhatPage
->GetValue()-1)>>1));
167 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
168 USHORT nSelectedPage
= 0;
172 nSelectedPage
= maTabControl
.GetCurPageId() - 1;
174 else if (pArgs
->Count () == 2)
176 SFX_REQUEST_ARG (rReq
, pWhatPage
, SfxUInt32Item
, ID_VAL_WHATPAGE
, FALSE
);
177 SFX_REQUEST_ARG (rReq
, pWhatKind
, SfxUInt32Item
, ID_VAL_WHATKIND
, FALSE
);
179 sal_Int32 nWhatPage
= (sal_Int32
)pWhatPage
->GetValue ();
180 sal_Int32 nWhatKind
= (sal_Int32
)pWhatKind
->GetValue ();
181 if (! CHECK_RANGE (PK_STANDARD
, nWhatKind
, PK_HANDOUT
))
183 StarBASIC::FatalError (SbERR_BAD_PROP_VALUE
);
187 else if (meEditMode
!= EM_MASTERPAGE
)
189 if (! CHECK_RANGE (0, nWhatPage
, GetDoc()->GetSdPageCount((PageKind
)nWhatKind
)))
191 StarBASIC::FatalError (SbERR_BAD_PROP_VALUE
);
196 nSelectedPage
= (short) nWhatPage
;
197 mePageKind
= (PageKind
) nWhatKind
;
203 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
209 if( GetDocSh() && (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED
))
210 GetDocSh()->SetModified();
212 SwitchPage(nSelectedPage
);
214 if(HasCurrentFunction(SID_BEZIER_EDIT
))
215 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
224 case SID_SWITCHLAYER
: // BASIC
226 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
227 USHORT nCurPage
= GetLayerTabControl()->GetCurPageId ();
229 if( pArgs
&& pArgs
->Count () == 1)
231 SFX_REQUEST_ARG (rReq
, pWhatLayer
, SfxUInt32Item
, ID_VAL_WHATLAYER
, FALSE
);
233 nCurPage
= (short) pWhatLayer
->GetValue ();
236 mpDrawView
->SetActiveLayer( GetLayerTabControl()->GetPageText(nCurPage
) );
243 case SID_PAGEMODE
: // BASIC
246 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
248 if ( pArgs
&& pArgs
->Count () == 2)
250 SFX_REQUEST_ARG (rReq
, pIsActive
, SfxBoolItem
, ID_VAL_ISACTIVE
, FALSE
);
251 SFX_REQUEST_ARG (rReq
, pWhatKind
, SfxUInt32Item
, ID_VAL_WHATKIND
, FALSE
);
253 sal_Int32 nWhatKind
= (sal_Int32
)pWhatKind
->GetValue ();
254 if (CHECK_RANGE (PK_STANDARD
, nWhatKind
, PK_HANDOUT
))
256 mbIsLayerModeActive
= pIsActive
->GetValue ();
257 mePageKind
= (PageKind
) nWhatKind
;
261 // Default-Layer der Page einschalten
262 mpDrawView
->SetActiveLayer( String( SdResId(STR_LAYER_LAYOUT
) ) );
264 ChangeEditMode(EM_PAGE
, mbIsLayerModeActive
);
272 case SID_LAYERMODE
: // BASIC
274 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
276 if ( pArgs
&& pArgs
->Count () == 2)
278 SFX_REQUEST_ARG (rReq
, pWhatLayerMode
, SfxBoolItem
, ID_VAL_ISACTIVE
, FALSE
);
279 SFX_REQUEST_ARG (rReq
, pWhatLayer
, SfxUInt32Item
, ID_VAL_WHATLAYER
, FALSE
);
281 sal_Int32 nWhatLayer
= (sal_Int32
)pWhatLayer
->GetValue ();
282 if (CHECK_RANGE (EM_PAGE
, nWhatLayer
, EM_MASTERPAGE
))
284 mbIsLayerModeActive
= pWhatLayerMode
->GetValue ();
285 meEditMode
= (EditMode
) nWhatLayer
;
289 ChangeEditMode(meEditMode
, !mbIsLayerModeActive
);
297 case SID_HEADER_AND_FOOTER
:
298 case SID_INSERT_PAGE_NUMBER
:
299 case SID_INSERT_DATE_TIME
:
301 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
302 AbstractHeaderFooterDialog
* pDlg
= pFact
? pFact
->CreateHeaderFooterDialog( (::ViewShell
*)this, GetActiveWindow(), GetDoc(), mpActualPage
) : 0;
308 GetActiveWindow()->Invalidate();
309 UpdatePreview( mpActualPage
);
318 case SID_MASTER_LAYOUTS
:
320 SdPage
* pPage
= GetActualPage();
321 if (meEditMode
== EM_MASTERPAGE
)
322 // Use the master page of the current page.
323 pPage
= static_cast<SdPage
*>(&pPage
->TRG_GetMasterPage());
325 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
326 VclAbstractDialog
* pDlg
= pFact
? pFact
->CreateMasterLayoutDialog( GetActiveWindow(), GetDoc(), pPage
) : 0;
336 case SID_OBJECTRESIZE
:
338 /******************************************************************
339 * Der Server moechte die Clientgrosse verandern
340 ******************************************************************/
341 OSL_ASSERT (GetViewShell()!=NULL
);
342 SfxInPlaceClient
* pIPClient
= GetViewShell()->GetIPClient();
344 if ( pIPClient
&& pIPClient
->IsObjectInPlaceActive() )
346 const SfxRectangleItem
& rRect
=
347 (SfxRectangleItem
&)rReq
.GetArgs()->Get(SID_OBJECTRESIZE
);
348 Rectangle
aRect( GetActiveWindow()->PixelToLogic( rRect
.GetValue() ) );
350 if ( mpDrawView
->AreObjectsMarked() )
352 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
354 if (rMarkList
.GetMarkCount() == 1)
356 SdrMark
* pMark
= rMarkList
.GetMark(0);
357 SdrObject
* pObj
= pMark
->GetMarkedSdrObj();
359 SdrOle2Obj
* pOle2Obj
= dynamic_cast< SdrOle2Obj
* >( pObj
);
362 if( pOle2Obj
->GetObjRef().is() )
364 pOle2Obj
->SetLogicRect(aRect
);
377 USHORT nId
= Svx3DChildWindow::GetChildWindowId();
378 SfxViewFrame
* pFrame
= GetViewFrame();
382 // Save the current configuration of panes and views.
383 Reference
<XControllerManager
> xControllerManager (
384 GetViewShellBase().GetController(), UNO_QUERY_THROW
);
385 Reference
<XConfigurationController
> xConfigurationController (
386 xControllerManager
->getConfigurationController());
387 if ( ! xConfigurationController
.is())
388 throw RuntimeException();
389 Reference
<XConfiguration
> xConfiguration (
390 xConfigurationController
->getRequestedConfiguration());
391 if ( ! xConfiguration
.is())
392 throw RuntimeException();
394 SfxChildWindow
* pWindow
= pFrame
->GetChildWindow(nId
);
397 Svx3DWin
* p3DWin
= (Svx3DWin
*)(pWindow
->GetWindow());
399 p3DWin
->DocumentReload();
402 // Normale Weiterleitung an ViewFrame zur Ausfuehrung
403 GetViewFrame()->ExecuteSlot(rReq
);
405 // From here on we must cope with this object already being
406 // deleted. Do not call any methods or use data members.
407 ViewShellBase
* pBase
= ViewShellBase::GetViewShellBase(pFrame
);
408 OSL_ASSERT(pBase
!=NULL
);
410 // Restore the configuration.
411 xControllerManager
= Reference
<XControllerManager
>(
412 pBase
->GetController(), UNO_QUERY_THROW
);
413 xConfigurationController
= Reference
<XConfigurationController
>(
414 xControllerManager
->getConfigurationController());
415 if ( ! xConfigurationController
.is())
416 throw RuntimeException();
417 xConfigurationController
->restoreConfiguration(xConfiguration
);
419 catch (RuntimeException
&)
421 DBG_ASSERT(false, "caught exception while handline SID_RELOAD");
424 // We have to return immediately to avoid accessing this object.
432 SFX_REQUEST_ARG(rReq
, pBookmark
, SfxStringItem
, SID_JUMPTOMARK
, FALSE
);
436 UniString
sBookmark( INetURLObject::decode( pBookmark
->GetValue(), '%', INetURLObject::DECODE_WITH_CHARSET
) );
438 rtl::Reference
< sd::SlideShow
> xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
439 if(xSlideshow
.is() && xSlideshow
->isRunning())
441 xSlideshow
->jumpToBookmark(sBookmark
);
445 GotoBookmark( sBookmark
);
453 case SID_OUTPUT_QUALITY_COLOR
:
454 case SID_OUTPUT_QUALITY_GRAYSCALE
:
455 case SID_OUTPUT_QUALITY_BLACKWHITE
:
456 case SID_OUTPUT_QUALITY_CONTRAST
:
462 case SID_MAIL_SCROLLBODY_PAGEDOWN
:
468 case SID_ATTR_YEAR2000
:
470 FmFormShell
* pFormShell
= GetViewShellBase().GetFormShellManager()->GetFormShell();
471 if (pFormShell
!= NULL
)
473 const SfxPoolItem
* pItem
;
474 if (rReq
.GetArgs()->GetItemState(
475 SID_ATTR_YEAR2000
, TRUE
, &pItem
) == SFX_ITEM_SET
)
476 pFormShell
->SetY2KState (
477 static_cast<const SfxUInt16Item
*>(pItem
)->GetValue());
484 case SID_OPT_LOCALE_CHANGED
:
486 GetActiveWindow()->Invalidate();
487 UpdatePreview( mpActualPage
);
496 /*************************************************************************
498 |* SfxRequests fuer Lineale bearbeiten
500 \************************************************************************/
502 void DrawViewShell::ExecRuler(SfxRequest
& rReq
)
504 // waehrend einer Diashow wird nichts ausgefuehrt!
505 if(HasCurrentFunction(SID_PRESENTATION
))
510 const SfxItemSet
* pArgs
= rReq
.GetArgs();
511 const Point
aPagePos( GetActiveWindow()->GetViewOrigin() );
512 Size aPageSize
= mpActualPage
->GetSize();
513 Size aViewSize
= GetActiveWindow()->GetViewSize();
514 SdUndoGroup
* pUndoGroup
= NULL
;
516 if ( rReq
.GetSlot() == SID_ATTR_LONG_LRSPACE
||
517 rReq
.GetSlot() == SID_ATTR_LONG_ULSPACE
)
519 pUndoGroup
= new SdUndoGroup(GetDoc());
520 String
aString(SdResId(STR_UNDO_CHANGE_PAGEBORDER
));
521 pUndoGroup
->SetComment(aString
);
524 switch ( rReq
.GetSlot() )
526 case SID_ATTR_LONG_LRSPACE
:
528 const SvxLongLRSpaceItem
& rLRSpace
= (const SvxLongLRSpaceItem
&)
529 pArgs
->Get(GetPool().GetWhich(SID_ATTR_LONG_LRSPACE
));
531 if( mpDrawView
->IsTextEdit() )
533 Rectangle aRect
= maMarkRect
;
534 aRect
.SetPos(aRect
.TopLeft() + aPagePos
);
535 aRect
.Left() = rLRSpace
.GetLeft();
536 aRect
.Right() = aViewSize
.Width() - rLRSpace
.GetRight();
537 aRect
.SetPos(aRect
.TopLeft() - aPagePos
);
538 if ( aRect
!= maMarkRect
)
540 mpDrawView
->SetAllMarkedRect(aRect
);
541 maMarkRect
= mpDrawView
->GetAllMarkedRect();
542 Invalidate( SID_RULER_OBJECT
);
547 long nLeft
= Max(0L, rLRSpace
.GetLeft() - aPagePos
.X());
548 long nRight
= Max(0L, rLRSpace
.GetRight() + aPagePos
.X() +
549 aPageSize
.Width() - aViewSize
.Width());
551 USHORT nPageCnt
= GetDoc()->GetSdPageCount(mePageKind
);
553 for ( i
= 0; i
< nPageCnt
; i
++)
555 SdPage
* pPage
= GetDoc()->GetSdPage(i
, mePageKind
);
556 SdUndoAction
* pUndo
= new SdPageLRUndoAction(GetDoc(),
558 pPage
->GetLftBorder(),
559 pPage
->GetRgtBorder(),
561 pUndoGroup
->AddAction(pUndo
);
562 pPage
->SetLftBorder(nLeft
);
563 pPage
->SetRgtBorder(nRight
);
565 nPageCnt
= GetDoc()->GetMasterSdPageCount(mePageKind
);
567 for (i
= 0; i
< nPageCnt
; i
++)
569 SdPage
* pPage
= GetDoc()->GetMasterSdPage(i
, mePageKind
);
570 SdUndoAction
* pUndo
= new SdPageLRUndoAction(GetDoc(),
572 pPage
->GetLftBorder(),
573 pPage
->GetRgtBorder(),
575 pUndoGroup
->AddAction(pUndo
);
576 pPage
->SetLftBorder(nLeft
);
577 pPage
->SetRgtBorder(nRight
);
583 case SID_ATTR_LONG_ULSPACE
:
585 const SvxLongULSpaceItem
& rULSpace
= (const SvxLongULSpaceItem
&)
586 pArgs
->Get(GetPool().GetWhich(SID_ATTR_LONG_ULSPACE
));
588 if( mpDrawView
->IsTextEdit() )
590 Rectangle aRect
= maMarkRect
;
591 aRect
.SetPos(aRect
.TopLeft() + aPagePos
);
592 aRect
.Top() = rULSpace
.GetUpper();
593 aRect
.Bottom() = aViewSize
.Height() - rULSpace
.GetLower();
594 aRect
.SetPos(aRect
.TopLeft() - aPagePos
);
596 if ( aRect
!= maMarkRect
)
598 mpDrawView
->SetAllMarkedRect(aRect
);
599 maMarkRect
= mpDrawView
->GetAllMarkedRect();
600 Invalidate( SID_RULER_OBJECT
);
605 long nUpper
= Max(0L, rULSpace
.GetUpper() - aPagePos
.Y());
606 long nLower
= Max(0L, rULSpace
.GetLower() + aPagePos
.Y() +
607 aPageSize
.Height() - aViewSize
.Height());
609 USHORT nPageCnt
= GetDoc()->GetSdPageCount(mePageKind
);
611 for ( i
= 0; i
< nPageCnt
; i
++)
613 SdPage
* pPage
= GetDoc()->GetSdPage(i
, mePageKind
);
614 SdUndoAction
* pUndo
= new SdPageULUndoAction(GetDoc(),
616 pPage
->GetUppBorder(),
617 pPage
->GetLwrBorder(),
619 pUndoGroup
->AddAction(pUndo
);
620 pPage
->SetUppBorder(nUpper
);
621 pPage
->SetLwrBorder(nLower
);
623 nPageCnt
= GetDoc()->GetMasterSdPageCount(mePageKind
);
625 for (i
= 0; i
< nPageCnt
; i
++)
627 SdPage
* pPage
= GetDoc()->GetMasterSdPage(i
, mePageKind
);
628 SdUndoAction
* pUndo
= new SdPageULUndoAction(GetDoc(),
630 pPage
->GetUppBorder(),
631 pPage
->GetLwrBorder(),
633 pUndoGroup
->AddAction(pUndo
);
634 pPage
->SetUppBorder(nUpper
);
635 pPage
->SetLwrBorder(nLower
);
642 case SID_RULER_OBJECT
:
644 Rectangle aRect
= maMarkRect
;
645 aRect
.SetPos(aRect
.TopLeft() + aPagePos
);
647 const SvxObjectItem
& rOI
= (const SvxObjectItem
&)
648 pArgs
->Get(GetPool().GetWhich(SID_RULER_OBJECT
));
650 if ( rOI
.GetStartX() != rOI
.GetEndX() )
652 aRect
.Left() = rOI
.GetStartX();
653 aRect
.Right() = rOI
.GetEndX();
655 if ( rOI
.GetStartY() != rOI
.GetEndY() )
657 aRect
.Top() = rOI
.GetStartY();
658 aRect
.Bottom() = rOI
.GetEndY();
660 aRect
.SetPos(aRect
.TopLeft() - aPagePos
);
661 if ( aRect
!= maMarkRect
)
663 mpDrawView
->SetAllMarkedRect(aRect
);
664 maMarkRect
= mpDrawView
->GetAllMarkedRect();
665 Invalidate( SID_RULER_OBJECT
);
670 case SID_ATTR_TABSTOP
:
672 if( mpDrawView
->IsTextEdit() )
674 const SvxTabStopItem
& rItem
= (const SvxTabStopItem
&)
675 pArgs
->Get( EE_PARA_TABS
);
677 SfxItemSet
aEditAttr( GetPool(), EE_PARA_TABS
, EE_PARA_TABS
);
679 aEditAttr
.Put( rItem
);
680 mpDrawView
->SetAttributes( aEditAttr
);
682 // #91081# Invalidate is missing here
683 Invalidate(SID_ATTR_TABSTOP
);
688 case SID_ATTR_PARA_LRSPACE
:
690 if( mpDrawView
->IsTextEdit() )
692 USHORT nId
= SID_ATTR_PARA_LRSPACE
;
693 const SvxLRSpaceItem
& rItem
= (const SvxLRSpaceItem
&)
696 static const USHORT aWhichTable
[]=
698 EE_PARA_OUTLLEVEL
, EE_PARA_OUTLLEVEL
,
699 EE_PARA_LRSPACE
, EE_PARA_LRSPACE
,
700 EE_PARA_NUMBULLET
, EE_PARA_NUMBULLET
,
704 SfxItemSet
aEditAttr( GetDoc()->GetPool(),
706 mpDrawView
->GetAttributes( aEditAttr
);
708 nId
= EE_PARA_LRSPACE
;
709 SvxLRSpaceItem
aLRSpaceItem( rItem
.GetLeft(),
710 rItem
.GetRight(), rItem
.GetTxtLeft(),
711 rItem
.GetTxtFirstLineOfst(), nId
);
713 const INT16 nOutlineLevel
= ((const SfxInt16Item
&)aEditAttr
.Get( EE_PARA_OUTLLEVEL
)).GetValue();
714 const SvxLRSpaceItem
& rOrigLRSpaceItem
= (const SvxLRSpaceItem
&) aEditAttr
.Get( EE_PARA_LRSPACE
);
715 const SvxNumBulletItem
& rNumBulletItem
= (const SvxNumBulletItem
&) aEditAttr
.Get( EE_PARA_NUMBULLET
);
716 if( nOutlineLevel
!= -1 &&
717 rNumBulletItem
.GetNumRule() &&
718 rNumBulletItem
.GetNumRule()->GetLevelCount() > nOutlineLevel
)
720 const SvxNumberFormat
& rFormat
= rNumBulletItem
.GetNumRule()->GetLevel(nOutlineLevel
);
721 SvxNumberFormat
aFormat(rFormat
);
723 // left margin always controls LRSpace item
724 aLRSpaceItem
.SetTxtLeft(rItem
.GetTxtLeft() - aFormat
.GetAbsLSpace());
726 // negative first line indent goes to the number
727 // format, positive to the lrSpace item
728 if( rItem
.GetTxtFirstLineOfst() < 0 )
730 aFormat
.SetFirstLineOffset(
731 rItem
.GetTxtFirstLineOfst()
732 - rOrigLRSpaceItem
.GetTxtFirstLineOfst()
733 + aFormat
.GetCharTextDistance());
734 aLRSpaceItem
.SetTxtFirstLineOfst(0);
738 aFormat
.SetFirstLineOffset(0);
739 aLRSpaceItem
.SetTxtFirstLineOfst(
740 rItem
.GetTxtFirstLineOfst()
741 - aFormat
.GetFirstLineOffset()
742 + aFormat
.GetCharTextDistance());
745 if( rFormat
!= aFormat
)
748 SvxNumBulletItem
aNumBulletItem(rNumBulletItem
);
749 aNumBulletItem
.GetNumRule()->SetLevel(nOutlineLevel
,aFormat
);
750 aEditAttr
.Put( aNumBulletItem
);
751 aEditAttr
.Put( aLRSpaceItem
);
752 mpDrawView
->SetAttributes( aEditAttr
);
754 // #92557# Invalidate is missing here
755 Invalidate(SID_ATTR_PARA_LRSPACE
);
760 // only put lrSpace item
761 SfxItemSet
aEditAttrReduced( GetDoc()->GetPool(),
762 EE_PARA_LRSPACE
, EE_PARA_LRSPACE
);
763 aEditAttrReduced
.Put( aLRSpaceItem
);
764 mpDrawView
->SetAttributes( aEditAttrReduced
);
766 // #92557# Invalidate is missing here
767 Invalidate(SID_ATTR_PARA_LRSPACE
);
773 // Undo Gruppe dem Undo Manager uebergeben
774 GetViewFrame()->GetObjectShell()->GetUndoManager()->
775 AddUndoAction(pUndoGroup
);
778 /*************************************************************************
780 |* Statuswerte der Lineale bestimmen
782 \************************************************************************/
783 void DrawViewShell::GetRulerState(SfxItemSet
& rSet
)
787 if (mpDrawView
->GetSdrPageView())
789 aOrigin
= mpDrawView
->GetSdrPageView()->GetPageOrigin();
792 Size aViewSize
= GetActiveWindow()->GetViewSize();
794 const Point
aPagePos( GetActiveWindow()->GetViewOrigin() );
795 Size aPageSize
= mpActualPage
->GetSize();
797 Rectangle
aRect(aPagePos
, Point( aViewSize
.Width() - (aPagePos
.X() + aPageSize
.Width()),
798 aViewSize
.Height() - (aPagePos
.Y() + aPageSize
.Height())));
800 if( mpDrawView
->IsTextEdit() )
802 Point aPnt1
= GetActiveWindow()->GetWinViewPos();
803 Point aPnt2
= GetActiveWindow()->GetViewOrigin();
804 Rectangle aMinMaxRect
= Rectangle( aPnt1
, Size(ULONG_MAX
, ULONG_MAX
) );
805 rSet
.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX
, aMinMaxRect
) );
809 rSet
.Put( SfxRectangleItem(SID_RULER_LR_MIN_MAX
, aRect
) );
812 SvxLongLRSpaceItem
aLRSpace(aPagePos
.X() + mpActualPage
->GetLftBorder(),
813 aRect
.Right() + mpActualPage
->GetRgtBorder(),
814 GetPool().GetWhich(SID_ATTR_LONG_LRSPACE
));
815 SvxLongULSpaceItem
aULSpace(aPagePos
.Y() + mpActualPage
->GetUppBorder(),
816 aRect
.Bottom() + mpActualPage
->GetLwrBorder(),
817 GetPool().GetWhich(SID_ATTR_LONG_ULSPACE
));
818 rSet
.Put(SvxPagePosSizeItem(Point(0,0) - aPagePos
, aViewSize
.Width(),
819 aViewSize
.Height()));
820 SfxPointItem
aPointItem( SID_RULER_NULL_OFFSET
, aPagePos
+ aOrigin
);
822 SvxProtectItem
aProtect( SID_RULER_PROTECT
);
824 maMarkRect
= mpDrawView
->GetAllMarkedRect();
826 const sal_Bool bRTL
= GetDoc() && GetDoc()->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB
;
827 rSet
.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT
, bRTL
));
829 if( mpDrawView
->AreObjectsMarked() )
831 if( mpDrawView
->IsTextEdit() )
833 SdrObject
* pObj
= mpDrawView
->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj();
834 if( pObj
->GetObjInventor() == SdrInventor
)
836 SfxItemSet
aEditAttr( GetDoc()->GetPool() );
837 mpDrawView
->GetAttributes( aEditAttr
);
838 if( aEditAttr
.GetItemState( EE_PARA_TABS
) >= SFX_ITEM_AVAILABLE
)
840 const SvxTabStopItem
& rItem
= (const SvxTabStopItem
&) aEditAttr
.Get( EE_PARA_TABS
);
843 //Rectangle aRect = maMarkRect;
845 const SvxLRSpaceItem
& rLRSpaceItem
= (const SvxLRSpaceItem
&) aEditAttr
.Get( EE_PARA_LRSPACE
);
846 USHORT nId
= SID_ATTR_PARA_LRSPACE
;
847 SvxLRSpaceItem
aLRSpaceItem( rLRSpaceItem
.GetLeft(),
848 rLRSpaceItem
.GetRight(), rLRSpaceItem
.GetTxtLeft(),
849 rLRSpaceItem
.GetTxtFirstLineOfst(), nId
);
851 const INT16 nOutlineLevel
= ((const SfxInt16Item
&)aEditAttr
.Get( EE_PARA_OUTLLEVEL
)).GetValue();
852 const SvxNumBulletItem
& rNumBulletItem
= (const SvxNumBulletItem
&) aEditAttr
.Get( EE_PARA_NUMBULLET
);
853 if( nOutlineLevel
!= -1 &&
854 rNumBulletItem
.GetNumRule() &&
855 rNumBulletItem
.GetNumRule()->GetLevelCount() > nOutlineLevel
)
857 const SvxNumberFormat
& rFormat
= rNumBulletItem
.GetNumRule()->GetLevel(nOutlineLevel
);
858 aLRSpaceItem
.SetTxtLeft(rFormat
.GetAbsLSpace() + rLRSpaceItem
.GetTxtLeft());
859 aLRSpaceItem
.SetTxtFirstLineOfst(
860 rLRSpaceItem
.GetTxtFirstLineOfst() + rFormat
.GetFirstLineOffset()
861 - rFormat
.GetCharTextDistance());
864 rSet
.Put( aLRSpaceItem
);
866 Point
aPos( aPagePos
+ maMarkRect
.TopLeft() );
868 if ( aEditAttr
.GetItemState( SDRATTR_TEXT_LEFTDIST
) == SFX_ITEM_ON
)
870 const SdrTextLeftDistItem
& rTLDItem
= (const SdrTextLeftDistItem
&)
871 aEditAttr
.Get( SDRATTR_TEXT_LEFTDIST
);
872 long nLD
= rTLDItem
.GetValue();
876 aPointItem
.SetValue( aPos
);
878 aLRSpace
.SetLeft( aPagePos
.X() + maMarkRect
.Left() );
880 if ( aEditAttr
.GetItemState( SDRATTR_TEXT_LEFTDIST
) == SFX_ITEM_ON
)
882 const SdrTextLeftDistItem
& rTLDItem
= (const SdrTextLeftDistItem
&)
883 aEditAttr
.Get( SDRATTR_TEXT_LEFTDIST
);
884 long nLD
= rTLDItem
.GetValue();
885 aLRSpace
.SetLeft( aLRSpace
.GetLeft() + nLD
);
888 aLRSpace
.SetRight( aRect
.Right() + aPageSize
.Width() - maMarkRect
.Right() );
889 aULSpace
.SetUpper( aPagePos
.Y() + maMarkRect
.Top() );
890 aULSpace
.SetLower( aRect
.Bottom() + aPageSize
.Height() - maMarkRect
.Bottom() );
892 rSet
.DisableItem( SID_RULER_OBJECT
);
894 // Seitenraender werden gelocked
895 aProtect
.SetSizeProtect( TRUE
);
896 aProtect
.SetPosProtect( TRUE
);
899 if( aEditAttr
.GetItemState( EE_PARA_WRITINGDIR
) >= SFX_ITEM_AVAILABLE
)
901 const SvxFrameDirectionItem
& rItem
= (const SvxFrameDirectionItem
&) aEditAttr
.Get( EE_PARA_WRITINGDIR
);
902 rSet
.Put(SfxBoolItem(SID_RULER_TEXT_RIGHT_TO_LEFT
, rItem
.GetValue() == ::com::sun::star::text::WritingMode_RL_TB
));
908 rSet
.DisableItem( EE_PARA_TABS
);
909 rSet
.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT
);
911 if( mpDrawView
->IsResizeAllowed(TRUE
) )
913 Rectangle
aResizeRect( maMarkRect
);
915 aResizeRect
.SetPos(aResizeRect
.TopLeft() + aPagePos
);
916 SvxObjectItem
aObjItem(aResizeRect
.Left(), aResizeRect
.Right(),
917 aResizeRect
.Top(), aResizeRect
.Bottom());
919 rSet
.DisableItem( EE_PARA_TABS
);
923 rSet
.DisableItem( SID_RULER_OBJECT
);
929 rSet
.DisableItem( SID_RULER_OBJECT
);
930 rSet
.DisableItem( EE_PARA_TABS
);
931 // rSet.DisableItem( SID_RULER_TEXT_RIGHT_TO_LEFT );
934 rSet
.Put( aLRSpace
);
935 rSet
.Put( aULSpace
);
937 rSet
.Put( aPointItem
);
938 rSet
.Put( aProtect
);
941 /*************************************************************************
943 |* SfxRequests fuer StatusBar bearbeiten
945 \************************************************************************/
947 void DrawViewShell::ExecStatusBar(SfxRequest
& rReq
)
949 // waehrend einer Diashow wird nichts ausgefuehrt!
950 if(HasCurrentFunction(SID_PRESENTATION
))
955 switch ( rReq
.GetSlot() )
959 GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_TRANSFORM
, SFX_CALLMODE_ASYNCHRON
);
963 case SID_STATUS_LAYOUT
:
965 GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION_LAYOUT
, SFX_CALLMODE_ASYNCHRON
);
971 /*************************************************************************
973 |* Status der Snap-Objekt-Eintraege im Popup setzen
975 \************************************************************************/
977 void DrawViewShell::GetSnapItemState( SfxItemSet
&rSet
)
980 Point aMPos
= GetActiveWindow()->PixelToLogic(maMousePos
);
981 USHORT nHitLog
= (USHORT
) GetActiveWindow()->PixelToLogic(
982 Size(FuPoor::HITPIX
,0)).Width();
985 if ( mpDrawView
->PickHelpLine(aMPos
, nHitLog
, *GetActiveWindow(), nHelpLine
, pPV
) )
987 const SdrHelpLine
& rHelpLine
= (pPV
->GetHelpLines())[nHelpLine
];
989 if ( rHelpLine
.GetKind() == SDRHELPLINE_POINT
)
991 rSet
.Put( SfxStringItem( SID_SET_SNAPITEM
,
992 String( SdResId( STR_POPUP_EDIT_SNAPPOINT
))) );
993 rSet
.Put( SfxStringItem( SID_DELETE_SNAPITEM
,
994 String( SdResId( STR_POPUP_DELETE_SNAPPOINT
))) );
998 rSet
.Put( SfxStringItem( SID_SET_SNAPITEM
,
999 String( SdResId( STR_POPUP_EDIT_SNAPLINE
))) );
1000 rSet
.Put( SfxStringItem( SID_DELETE_SNAPITEM
,
1001 String( SdResId( STR_POPUP_DELETE_SNAPLINE
))) );
1007 /*************************************************************************
1011 \************************************************************************/
1013 void DrawViewShell::AddWindow (::sd::Window
* pWin
)
1015 mpDrawView
->AddWindowToPaintView(pWin
);
1018 /*************************************************************************
1022 \************************************************************************/
1024 void DrawViewShell::RemoveWindow(::sd::Window
* pWin
)
1026 mpDrawView
->DeleteWindowFromPaintView(pWin
);
1029 } // end of namespace sd