1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "ShapeController.hxx"
21 #include "ShapeController.hrc"
22 #include "ChartController.hxx"
23 #include "ChartWindow.hxx"
24 #include "ViewElementListProvider.hxx"
25 #include "dlg_ShapeFont.hxx"
26 #include "dlg_ShapeParagraph.hxx"
27 #include "chartview/DrawModelWrapper.hxx"
30 #include <com/sun/star/frame/XStorable.hpp>
32 #include <osl/mutex.hxx>
33 #include <vcl/msgbox.hxx>
34 #include <vcl/svapp.hxx>
35 #include <editeng/formatbreakitem.hxx>
36 #include <svx/dialogs.hrc>
37 #include <svx/drawitem.hxx>
38 #include <editeng/eeitem.hxx>
39 #include <editeng/hyphenzoneitem.hxx>
40 #include <editeng/orphitem.hxx>
41 #include <editeng/spltitem.hxx>
42 #include <svx/svxdlg.hxx>
43 #include <editeng/widwitem.hxx>
45 #include <boost/scoped_ptr.hpp>
47 using namespace ::com::sun::star
;
48 using namespace ::com::sun::star::frame
;
50 using ::com::sun::star::uno::Reference
;
51 using ::com::sun::star::uno::Sequence
;
56 ShapeController::ShapeController( const Reference
< uno::XComponentContext
>& rxContext
,
57 ChartController
* pController
)
58 :FeatureCommandDispatchBase( rxContext
)
59 ,m_pChartController( pController
)
63 ShapeController::~ShapeController()
67 void ShapeController::initialize()
69 FeatureCommandDispatchBase::initialize();
72 // WeakComponentImplHelperBase
73 void ShapeController::disposing()
78 void ShapeController::disposing( const lang::EventObject
& /* Source */ )
79 throw (uno::RuntimeException
, std::exception
)
83 FeatureState
ShapeController::getState( const OUString
& rCommand
)
86 aReturn
.bEnabled
= false;
87 aReturn
.aState
<<= false;
89 bool bWritable
= false;
90 if ( m_pChartController
)
92 Reference
< frame::XStorable
> xStorable( m_pChartController
->getModel(), uno::UNO_QUERY
);
95 bWritable
= !xStorable
->isReadonly();
99 SupportedFeatures::const_iterator aIter
= m_aSupportedFeatures
.find( rCommand
);
100 if ( aIter
!= m_aSupportedFeatures
.end() )
102 sal_uInt16 nFeatureId
= aIter
->second
.nFeatureId
;
103 switch ( nFeatureId
)
105 case COMMAND_ID_FORMAT_LINE
:
106 case COMMAND_ID_FORMAT_AREA
:
107 case COMMAND_ID_TEXT_ATTRIBUTES
:
108 case COMMAND_ID_TRANSFORM_DIALOG
:
109 case COMMAND_ID_OBJECT_TITLE_DESCRIPTION
:
110 case COMMAND_ID_RENAME_OBJECT
:
112 aReturn
.bEnabled
= bWritable
;
113 aReturn
.aState
<<= false;
116 case COMMAND_ID_BRING_TO_FRONT
:
117 case COMMAND_ID_FORWARD
:
119 aReturn
.bEnabled
= ( bWritable
&& isForwardPossible() );
120 aReturn
.aState
<<= false;
123 case COMMAND_ID_BACKWARD
:
124 case COMMAND_ID_SEND_TO_BACK
:
127 aReturn
.bEnabled
= ( bWritable
&& isBackwardPossible() );
128 aReturn
.aState
<<= false;
131 case COMMAND_ID_FONT_DIALOG
:
132 case COMMAND_ID_PARAGRAPH_DIALOG
:
134 aReturn
.bEnabled
= bWritable
;
135 aReturn
.aState
<<= false;
140 aReturn
.bEnabled
= false;
141 aReturn
.aState
<<= false;
150 void ShapeController::execute( const OUString
& rCommand
, const Sequence
< beans::PropertyValue
>& rArgs
)
154 SupportedFeatures::const_iterator aIter
= m_aSupportedFeatures
.find( rCommand
);
155 if ( aIter
!= m_aSupportedFeatures
.end() )
157 sal_uInt16 nFeatureId
= aIter
->second
.nFeatureId
;
158 switch ( nFeatureId
)
160 case COMMAND_ID_FORMAT_LINE
:
162 executeDispatch_FormatLine();
165 case COMMAND_ID_FORMAT_AREA
:
167 executeDispatch_FormatArea();
170 case COMMAND_ID_TEXT_ATTRIBUTES
:
172 executeDispatch_TextAttributes();
175 case COMMAND_ID_TRANSFORM_DIALOG
:
177 executeDispatch_TransformDialog();
180 case COMMAND_ID_OBJECT_TITLE_DESCRIPTION
:
182 executeDispatch_ObjectTitleDescription();
185 case COMMAND_ID_RENAME_OBJECT
:
187 executeDispatch_RenameObject();
190 case COMMAND_ID_BRING_TO_FRONT
:
191 case COMMAND_ID_FORWARD
:
192 case COMMAND_ID_BACKWARD
:
193 case COMMAND_ID_SEND_TO_BACK
:
195 executeDispatch_ChangeZOrder( nFeatureId
);
198 case COMMAND_ID_FONT_DIALOG
:
200 executeDispatch_FontDialog();
203 case COMMAND_ID_PARAGRAPH_DIALOG
:
205 executeDispatch_ParagraphDialog();
216 void ShapeController::describeSupportedFeatures()
218 implDescribeSupportedFeature( ".uno:FormatLine", COMMAND_ID_FORMAT_LINE
, CommandGroup::FORMAT
);
219 implDescribeSupportedFeature( ".uno:FormatArea", COMMAND_ID_FORMAT_AREA
, CommandGroup::FORMAT
);
220 implDescribeSupportedFeature( ".uno:TextAttributes", COMMAND_ID_TEXT_ATTRIBUTES
, CommandGroup::FORMAT
);
221 implDescribeSupportedFeature( ".uno:TransformDialog", COMMAND_ID_TRANSFORM_DIALOG
, CommandGroup::FORMAT
);
222 implDescribeSupportedFeature( ".uno:ObjectTitleDescription", COMMAND_ID_OBJECT_TITLE_DESCRIPTION
, CommandGroup::FORMAT
);
223 implDescribeSupportedFeature( ".uno:RenameObject", COMMAND_ID_RENAME_OBJECT
, CommandGroup::FORMAT
);
224 implDescribeSupportedFeature( ".uno:BringToFront", COMMAND_ID_BRING_TO_FRONT
, CommandGroup::FORMAT
);
225 implDescribeSupportedFeature( ".uno:Forward", COMMAND_ID_FORWARD
, CommandGroup::FORMAT
);
226 implDescribeSupportedFeature( ".uno:Backward", COMMAND_ID_BACKWARD
, CommandGroup::FORMAT
);
227 implDescribeSupportedFeature( ".uno:SendToBack", COMMAND_ID_SEND_TO_BACK
, CommandGroup::FORMAT
);
228 implDescribeSupportedFeature( ".uno:FontDialog", COMMAND_ID_FONT_DIALOG
, CommandGroup::EDIT
);
229 implDescribeSupportedFeature( ".uno:ParagraphDialog", COMMAND_ID_PARAGRAPH_DIALOG
, CommandGroup::EDIT
);
232 IMPL_LINK( ShapeController
, CheckNameHdl
, AbstractSvxNameDialog
*, pDialog
)
237 pDialog
->GetName( aName
);
239 if ( !aName
.isEmpty() )
241 DrawViewWrapper
* pDrawViewWrapper
= ( m_pChartController
? m_pChartController
->GetDrawViewWrapper() : NULL
);
242 if ( pDrawViewWrapper
&& pDrawViewWrapper
->getNamedSdrObject( aName
) )
250 void ShapeController::executeDispatch_FormatLine()
252 SolarMutexGuard aGuard
;
253 if ( m_pChartController
)
255 vcl::Window
* pParent
= dynamic_cast< vcl::Window
* >( m_pChartController
->m_pChartWindow
.get() );
256 DrawModelWrapper
* pDrawModelWrapper
= m_pChartController
->GetDrawModelWrapper();
257 DrawViewWrapper
* pDrawViewWrapper
= m_pChartController
->GetDrawViewWrapper();
258 if ( pParent
&& pDrawModelWrapper
&& pDrawViewWrapper
)
260 SdrObject
* pSelectedObj
= pDrawViewWrapper
->getSelectedObject();
261 SfxItemSet
aAttr( pDrawViewWrapper
->GetDefaultAttr() );
262 bool bHasMarked
= pDrawViewWrapper
->AreObjectsMarked();
265 pDrawViewWrapper
->MergeAttrFromMarked( aAttr
, false );
267 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
270 boost::scoped_ptr
< SfxAbstractTabDialog
> pDlg(
271 pFact
->CreateSvxLineTabDialog( pParent
, &aAttr
, &pDrawModelWrapper
->getSdrModel(),
272 pSelectedObj
, bHasMarked
) );
273 if ( pDlg
->Execute() == RET_OK
)
275 const SfxItemSet
* pOutAttr
= pDlg
->GetOutputItemSet();
278 pDrawViewWrapper
->SetAttrToMarked( *pOutAttr
, false );
282 pDrawViewWrapper
->SetDefaultAttr( *pOutAttr
, false );
290 void ShapeController::executeDispatch_FormatArea()
292 SolarMutexGuard aGuard
;
293 if ( m_pChartController
)
295 vcl::Window
* pParent
= dynamic_cast< vcl::Window
* >( m_pChartController
->m_pChartWindow
.get() );
296 DrawModelWrapper
* pDrawModelWrapper
= m_pChartController
->GetDrawModelWrapper();
297 DrawViewWrapper
* pDrawViewWrapper
= m_pChartController
->GetDrawViewWrapper();
298 if ( pParent
&& pDrawModelWrapper
&& pDrawViewWrapper
)
300 SfxItemSet
aAttr( pDrawViewWrapper
->GetDefaultAttr() );
301 bool bHasMarked
= pDrawViewWrapper
->AreObjectsMarked();
304 pDrawViewWrapper
->MergeAttrFromMarked( aAttr
, false );
306 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
309 ::boost::scoped_ptr
< AbstractSvxAreaTabDialog
> pDlg(
310 pFact
->CreateSvxAreaTabDialog( pParent
, &aAttr
, &pDrawModelWrapper
->getSdrModel(), true ) );
313 SfxItemPool
& rItemPool
= pDrawViewWrapper
->GetModel()->GetItemPool();
314 SfxItemSet
aSet( rItemPool
, rItemPool
.GetFirstWhich(), rItemPool
.GetLastWhich() );
315 if ( pDlg
->Execute() == RET_OK
)
317 const SfxItemSet
* pOutAttr
= pDlg
->GetOutputItemSet();
320 pDrawViewWrapper
->SetAttrToMarked( *pOutAttr
, false );
324 pDrawViewWrapper
->SetDefaultAttr( *pOutAttr
, false );
333 void ShapeController::executeDispatch_TextAttributes()
335 SolarMutexGuard aGuard
;
336 if ( m_pChartController
)
338 vcl::Window
* pParent
= dynamic_cast< vcl::Window
* >( m_pChartController
->m_pChartWindow
.get() );
339 DrawViewWrapper
* pDrawViewWrapper
= m_pChartController
->GetDrawViewWrapper();
340 if ( pParent
&& pDrawViewWrapper
)
342 SfxItemSet
aAttr( pDrawViewWrapper
->GetDefaultAttr() );
343 bool bHasMarked
= pDrawViewWrapper
->AreObjectsMarked();
346 pDrawViewWrapper
->MergeAttrFromMarked( aAttr
, false );
348 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
351 ::boost::scoped_ptr
< SfxAbstractTabDialog
> pDlg(
352 pFact
->CreateTextTabDialog( pParent
, &aAttr
, pDrawViewWrapper
) );
353 if ( pDlg
.get() && ( pDlg
->Execute() == RET_OK
) )
355 const SfxItemSet
* pOutAttr
= pDlg
->GetOutputItemSet();
358 pDrawViewWrapper
->SetAttributes( *pOutAttr
);
362 pDrawViewWrapper
->SetDefaultAttr( *pOutAttr
, false );
370 void ShapeController::executeDispatch_TransformDialog()
372 SolarMutexGuard aGuard
;
373 if ( m_pChartController
)
375 vcl::Window
* pParent
= dynamic_cast< vcl::Window
* >( m_pChartController
->m_pChartWindow
.get() );
376 DrawViewWrapper
* pDrawViewWrapper
= m_pChartController
->GetDrawViewWrapper();
377 if ( pParent
&& pDrawViewWrapper
)
379 SdrObject
* pSelectedObj
= pDrawViewWrapper
->getSelectedObject();
380 if ( pSelectedObj
&& pSelectedObj
->GetObjIdentifier() == OBJ_CAPTION
)
382 // item set for caption
383 SfxItemSet
aAttr( pDrawViewWrapper
->GetModel()->GetItemPool() );
384 pDrawViewWrapper
->GetAttributes( aAttr
);
385 // item set for position and size
386 SfxItemSet
aGeoAttr( pDrawViewWrapper
->GetGeoAttrFromMarked() );
387 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
390 ::boost::scoped_ptr
< SfxAbstractTabDialog
> pDlg(
391 pFact
->CreateCaptionDialog( pParent
, pDrawViewWrapper
) );
394 const sal_uInt16
* pRange
= pDlg
->GetInputRanges( *aAttr
.GetPool() );
395 SfxItemSet
aCombAttr( *aAttr
.GetPool(), pRange
);
396 aCombAttr
.Put( aAttr
);
397 aCombAttr
.Put( aGeoAttr
);
398 pDlg
->SetInputSet( &aCombAttr
);
399 if ( pDlg
->Execute() == RET_OK
)
401 const SfxItemSet
* pOutAttr
= pDlg
->GetOutputItemSet();
402 pDrawViewWrapper
->SetAttributes( *pOutAttr
);
403 pDrawViewWrapper
->SetGeoAttrToMarked( *pOutAttr
);
410 SfxItemSet
aGeoAttr( pDrawViewWrapper
->GetGeoAttrFromMarked() );
411 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
414 ::boost::scoped_ptr
< SfxAbstractTabDialog
> pDlg(
415 pFact
->CreateSvxTransformTabDialog( pParent
, &aGeoAttr
, pDrawViewWrapper
) );
416 if ( pDlg
.get() && ( pDlg
->Execute() == RET_OK
) )
418 const SfxItemSet
* pOutAttr
= pDlg
->GetOutputItemSet();
419 pDrawViewWrapper
->SetGeoAttrToMarked( *pOutAttr
);
427 void ShapeController::executeDispatch_ObjectTitleDescription()
429 SolarMutexGuard aGuard
;
430 if ( m_pChartController
)
432 DrawViewWrapper
* pDrawViewWrapper
= m_pChartController
->GetDrawViewWrapper();
433 if ( pDrawViewWrapper
&& pDrawViewWrapper
->GetMarkedObjectCount() == 1 )
435 SdrObject
* pSelectedObj
= pDrawViewWrapper
->getSelectedObject();
438 OUString
aTitle( pSelectedObj
->GetTitle() );
439 OUString
aDescription( pSelectedObj
->GetDescription() );
440 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
443 ::boost::scoped_ptr
< AbstractSvxObjectTitleDescDialog
> pDlg(
444 pFact
->CreateSvxObjectTitleDescDialog( NULL
, aTitle
, aDescription
) );
445 if ( pDlg
.get() && ( pDlg
->Execute() == RET_OK
) )
447 pDlg
->GetTitle( aTitle
);
448 pDlg
->GetDescription( aDescription
);
449 pSelectedObj
->SetTitle( aTitle
);
450 pSelectedObj
->SetDescription( aDescription
);
458 void ShapeController::executeDispatch_RenameObject()
460 SolarMutexGuard aGuard
;
461 if ( m_pChartController
)
463 DrawViewWrapper
* pDrawViewWrapper
= m_pChartController
->GetDrawViewWrapper();
464 if ( pDrawViewWrapper
&& pDrawViewWrapper
->GetMarkedObjectCount() == 1 )
466 SdrObject
* pSelectedObj
= pDrawViewWrapper
->getSelectedObject();
469 OUString aName
= pSelectedObj
->GetName();
470 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
473 ::boost::scoped_ptr
< AbstractSvxObjectNameDialog
> pDlg(
474 pFact
->CreateSvxObjectNameDialog( NULL
, aName
) );
475 pDlg
->SetCheckNameHdl( LINK( this, ShapeController
, CheckNameHdl
) );
476 if ( pDlg
.get() && ( pDlg
->Execute() == RET_OK
) )
478 pDlg
->GetName(aName
);
479 if (pSelectedObj
->GetName().equals(aName
))
481 pSelectedObj
->SetName( aName
);
490 void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId
)
492 SolarMutexGuard aGuard
;
493 DrawViewWrapper
* pDrawViewWrapper
= ( m_pChartController
? m_pChartController
->GetDrawViewWrapper() : NULL
);
494 if ( pDrawViewWrapper
)
498 case COMMAND_ID_BRING_TO_FRONT
:
500 if ( isForwardPossible() )
502 pDrawViewWrapper
->PutMarkedToTop();
506 case COMMAND_ID_FORWARD
:
508 if ( isForwardPossible() )
510 pDrawViewWrapper
->MovMarkedToTop();
514 case COMMAND_ID_BACKWARD
:
516 if ( isBackwardPossible() )
518 pDrawViewWrapper
->MovMarkedToBtm();
522 case COMMAND_ID_SEND_TO_BACK
:
524 if ( isBackwardPossible() )
526 SdrObject
* pFirstObj
= getFirstAdditionalShape();
527 pDrawViewWrapper
->PutMarkedBehindObj( pFirstObj
);
539 void ShapeController::executeDispatch_FontDialog()
541 SolarMutexGuard aGuard
;
542 if ( m_pChartController
)
544 vcl::Window
* pParent
= dynamic_cast< vcl::Window
* >( m_pChartController
->m_pChartWindow
.get() );
545 DrawModelWrapper
* pDrawModelWrapper
= m_pChartController
->GetDrawModelWrapper();
546 DrawViewWrapper
* pDrawViewWrapper
= m_pChartController
->GetDrawViewWrapper();
547 if ( pParent
&& pDrawModelWrapper
&& pDrawViewWrapper
)
549 SfxItemSet
aAttr( pDrawViewWrapper
->GetModel()->GetItemPool() );
550 pDrawViewWrapper
->GetAttributes( aAttr
);
551 ViewElementListProvider
aViewElementListProvider( pDrawModelWrapper
);
552 ScopedVclPtrInstance
< ShapeFontDialog
> pDlg( pParent
, &aAttr
, &aViewElementListProvider
);
553 if ( pDlg
->Execute() == RET_OK
)
555 const SfxItemSet
* pOutAttr
= pDlg
->GetOutputItemSet();
556 pDrawViewWrapper
->SetAttributes( *pOutAttr
);
562 void ShapeController::executeDispatch_ParagraphDialog()
564 SolarMutexGuard aGuard
;
565 if ( m_pChartController
)
567 vcl::Window
* pParent
= dynamic_cast< vcl::Window
* >( m_pChartController
->m_pChartWindow
.get() );
568 DrawViewWrapper
* pDrawViewWrapper
= m_pChartController
->GetDrawViewWrapper();
569 if ( pParent
&& pDrawViewWrapper
)
571 SfxItemPool
& rPool
= pDrawViewWrapper
->GetModel()->GetItemPool();
572 SfxItemSet
aAttr( rPool
);
573 pDrawViewWrapper
->GetAttributes( aAttr
);
575 SfxItemSet
aNewAttr( rPool
,
576 EE_ITEMS_START
, EE_ITEMS_END
,
577 SID_ATTR_PARA_HYPHENZONE
, SID_ATTR_PARA_HYPHENZONE
,
578 SID_ATTR_PARA_PAGEBREAK
, SID_ATTR_PARA_PAGEBREAK
,
579 SID_ATTR_PARA_SPLIT
, SID_ATTR_PARA_SPLIT
,
580 SID_ATTR_PARA_WIDOWS
, SID_ATTR_PARA_WIDOWS
,
581 SID_ATTR_PARA_ORPHANS
, SID_ATTR_PARA_ORPHANS
,
583 aNewAttr
.Put( aAttr
);
584 aNewAttr
.Put( SvxHyphenZoneItem( false, SID_ATTR_PARA_HYPHENZONE
) );
585 aNewAttr
.Put( SvxFormatBreakItem( SVX_BREAK_NONE
, SID_ATTR_PARA_PAGEBREAK
) );
586 aNewAttr
.Put( SvxFormatSplitItem( true, SID_ATTR_PARA_SPLIT
) );
587 aNewAttr
.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS
) );
588 aNewAttr
.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS
) );
590 ScopedVclPtrInstance
< ShapeParagraphDialog
> pDlg( pParent
, &aNewAttr
);
591 if ( pDlg
->Execute() == RET_OK
)
593 const SfxItemSet
* pOutAttr
= pDlg
->GetOutputItemSet();
594 pDrawViewWrapper
->SetAttributes( *pOutAttr
);
600 SdrObject
* ShapeController::getFirstAdditionalShape()
602 SdrObject
* pFirstObj
= NULL
;
606 DrawModelWrapper
* pDrawModelWrapper
= ( m_pChartController
? m_pChartController
->GetDrawModelWrapper() : NULL
);
607 if ( pDrawModelWrapper
)
609 Reference
< drawing::XShape
> xFirstShape
;
610 Reference
< drawing::XDrawPage
> xDrawPage( pDrawModelWrapper
->getMainDrawPage() );
611 Reference
< drawing::XShapes
> xDrawPageShapes( xDrawPage
, uno::UNO_QUERY_THROW
);
612 Reference
< drawing::XShapes
> xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage
) );
613 sal_Int32 nCount
= xDrawPageShapes
->getCount();
614 for ( sal_Int32 i
= 0; i
< nCount
; ++i
)
616 Reference
< drawing::XShape
> xShape
;
617 if ( xDrawPageShapes
->getByIndex( i
) >>= xShape
)
619 if ( xShape
.is() && xShape
!= xChartRoot
)
621 xFirstShape
= xShape
;
626 if ( xFirstShape
.is() )
628 pFirstObj
= DrawViewWrapper::getSdrObject( xFirstShape
);
632 catch ( const uno::Exception
& ex
)
634 ASSERT_EXCEPTION( ex
);
640 SdrObject
* ShapeController::getLastAdditionalShape()
642 SdrObject
* pLastObj
= NULL
;
646 DrawModelWrapper
* pDrawModelWrapper
= ( m_pChartController
? m_pChartController
->GetDrawModelWrapper() : NULL
);
647 if ( pDrawModelWrapper
)
649 Reference
< drawing::XShape
> xLastShape
;
650 Reference
< drawing::XDrawPage
> xDrawPage( pDrawModelWrapper
->getMainDrawPage() );
651 Reference
< drawing::XShapes
> xDrawPageShapes( xDrawPage
, uno::UNO_QUERY_THROW
);
652 Reference
< drawing::XShapes
> xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage
) );
653 sal_Int32 nCount
= xDrawPageShapes
->getCount();
654 for ( sal_Int32 i
= nCount
- 1; i
>= 0; --i
)
656 Reference
< drawing::XShape
> xShape
;
657 if ( xDrawPageShapes
->getByIndex( i
) >>= xShape
)
659 if ( xShape
.is() && xShape
!= xChartRoot
)
666 if ( xLastShape
.is() )
668 pLastObj
= DrawViewWrapper::getSdrObject( xLastShape
);
672 catch ( const uno::Exception
& ex
)
674 ASSERT_EXCEPTION( ex
);
680 bool ShapeController::isBackwardPossible()
682 if ( m_pChartController
&& m_pChartController
->m_aSelection
.isAdditionalShapeSelected() )
684 SolarMutexGuard aGuard
;
685 DrawViewWrapper
* pDrawViewWrapper
= m_pChartController
->GetDrawViewWrapper();
686 if ( pDrawViewWrapper
)
688 SdrObject
* pSelectedObj
= pDrawViewWrapper
->getSelectedObject();
689 SdrObject
* pFirstObj
= getFirstAdditionalShape();
690 if ( pSelectedObj
&& pFirstObj
&& pSelectedObj
!= pFirstObj
)
699 bool ShapeController::isForwardPossible()
701 if ( m_pChartController
&& m_pChartController
->m_aSelection
.isAdditionalShapeSelected() )
703 SolarMutexGuard aGuard
;
704 DrawViewWrapper
* pDrawViewWrapper
= m_pChartController
->GetDrawViewWrapper();
705 if ( pDrawViewWrapper
)
707 SdrObject
* pSelectedObj
= pDrawViewWrapper
->getSelectedObject();
708 SdrObject
* pLastObj
= getLastAdditionalShape();
709 if ( pSelectedObj
&& pLastObj
&& pSelectedObj
!= pLastObj
)
720 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */