Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / chart2 / source / controller / main / ShapeController.cxx
blob80203f179b83fb6335c49c16aa1c978152b16486
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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.h>
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>
29 #include <com/sun/star/frame/CommandGroup.hpp>
30 #include <com/sun/star/frame/XStorable.hpp>
32 #include <vcl/svapp.hxx>
33 #include <editeng/formatbreakitem.hxx>
34 #include <svx/dialogs.hrc>
35 #include <svx/drawitem.hxx>
36 #include <editeng/eeitem.hxx>
37 #include <editeng/hyphenzoneitem.hxx>
38 #include <editeng/orphitem.hxx>
39 #include <editeng/spltitem.hxx>
40 #include <svx/svxdlg.hxx>
41 #include <editeng/widwitem.hxx>
42 #include <tools/diagnose_ex.h>
44 #include <memory>
46 using namespace ::com::sun::star;
47 using namespace ::com::sun::star::frame;
49 using ::com::sun::star::uno::Reference;
50 using ::com::sun::star::uno::Sequence;
52 namespace chart
55 ShapeController::ShapeController( const Reference< uno::XComponentContext >& rxContext,
56 ChartController* pController )
57 :FeatureCommandDispatchBase( rxContext )
58 ,m_pChartController( pController )
62 ShapeController::~ShapeController()
66 // WeakComponentImplHelperBase
67 void ShapeController::disposing()
71 // XEventListener
72 void ShapeController::disposing( const lang::EventObject& /* Source */ )
76 FeatureState ShapeController::getState( const OUString& rCommand )
78 FeatureState aReturn;
79 aReturn.bEnabled = false;
80 aReturn.aState <<= false;
82 bool bWritable = false;
83 if ( m_pChartController )
85 Reference< frame::XStorable > xStorable( m_pChartController->getModel(), uno::UNO_QUERY );
86 if ( xStorable.is() )
88 bWritable = !xStorable->isReadonly();
92 SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rCommand );
93 if ( aIter != m_aSupportedFeatures.end() )
95 sal_uInt16 nFeatureId = aIter->second.nFeatureId;
96 switch ( nFeatureId )
98 case COMMAND_ID_FORMAT_LINE:
99 case COMMAND_ID_FORMAT_AREA:
100 case COMMAND_ID_TEXT_ATTRIBUTES:
101 case COMMAND_ID_TRANSFORM_DIALOG:
102 case COMMAND_ID_OBJECT_TITLE_DESCRIPTION:
103 case COMMAND_ID_RENAME_OBJECT:
105 aReturn.bEnabled = bWritable;
106 aReturn.aState <<= false;
108 break;
109 case COMMAND_ID_BRING_TO_FRONT:
110 case COMMAND_ID_FORWARD:
112 aReturn.bEnabled = ( bWritable && isForwardPossible() );
113 aReturn.aState <<= false;
115 break;
116 case COMMAND_ID_BACKWARD:
117 case COMMAND_ID_SEND_TO_BACK:
120 aReturn.bEnabled = ( bWritable && isBackwardPossible() );
121 aReturn.aState <<= false;
123 break;
124 case COMMAND_ID_FONT_DIALOG:
125 case COMMAND_ID_PARAGRAPH_DIALOG:
127 aReturn.bEnabled = bWritable;
128 aReturn.aState <<= false;
130 break;
131 default:
133 aReturn.bEnabled = false;
134 aReturn.aState <<= false;
136 break;
140 return aReturn;
143 void ShapeController::execute( const OUString& rCommand, const Sequence< beans::PropertyValue>& )
145 SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( rCommand );
146 if ( aIter != m_aSupportedFeatures.end() )
148 sal_uInt16 nFeatureId = aIter->second.nFeatureId;
149 switch ( nFeatureId )
151 case COMMAND_ID_FORMAT_LINE:
153 executeDispatch_FormatLine();
155 break;
156 case COMMAND_ID_FORMAT_AREA:
158 executeDispatch_FormatArea();
160 break;
161 case COMMAND_ID_TEXT_ATTRIBUTES:
163 executeDispatch_TextAttributes();
165 break;
166 case COMMAND_ID_TRANSFORM_DIALOG:
168 executeDispatch_TransformDialog();
170 break;
171 case COMMAND_ID_OBJECT_TITLE_DESCRIPTION:
173 executeDispatch_ObjectTitleDescription();
175 break;
176 case COMMAND_ID_RENAME_OBJECT:
178 executeDispatch_RenameObject();
180 break;
181 case COMMAND_ID_BRING_TO_FRONT:
182 case COMMAND_ID_FORWARD:
183 case COMMAND_ID_BACKWARD:
184 case COMMAND_ID_SEND_TO_BACK:
186 executeDispatch_ChangeZOrder( nFeatureId );
188 break;
189 case COMMAND_ID_FONT_DIALOG:
191 executeDispatch_FontDialog();
193 break;
194 case COMMAND_ID_PARAGRAPH_DIALOG:
196 executeDispatch_ParagraphDialog();
198 break;
199 default:
202 break;
207 void ShapeController::describeSupportedFeatures()
209 implDescribeSupportedFeature( ".uno:FormatLine", COMMAND_ID_FORMAT_LINE, CommandGroup::FORMAT );
210 implDescribeSupportedFeature( ".uno:FormatArea", COMMAND_ID_FORMAT_AREA, CommandGroup::FORMAT );
211 implDescribeSupportedFeature( ".uno:TextAttributes", COMMAND_ID_TEXT_ATTRIBUTES, CommandGroup::FORMAT );
212 implDescribeSupportedFeature( ".uno:TransformDialog", COMMAND_ID_TRANSFORM_DIALOG, CommandGroup::FORMAT );
213 implDescribeSupportedFeature( ".uno:ObjectTitleDescription", COMMAND_ID_OBJECT_TITLE_DESCRIPTION, CommandGroup::FORMAT );
214 implDescribeSupportedFeature( ".uno:RenameObject", COMMAND_ID_RENAME_OBJECT, CommandGroup::FORMAT );
215 implDescribeSupportedFeature( ".uno:BringToFront", COMMAND_ID_BRING_TO_FRONT, CommandGroup::FORMAT );
216 implDescribeSupportedFeature( ".uno:Forward", COMMAND_ID_FORWARD, CommandGroup::FORMAT );
217 implDescribeSupportedFeature( ".uno:Backward", COMMAND_ID_BACKWARD, CommandGroup::FORMAT );
218 implDescribeSupportedFeature( ".uno:SendToBack", COMMAND_ID_SEND_TO_BACK, CommandGroup::FORMAT );
219 implDescribeSupportedFeature( ".uno:FontDialog", COMMAND_ID_FONT_DIALOG, CommandGroup::EDIT );
220 implDescribeSupportedFeature( ".uno:ParagraphDialog", COMMAND_ID_PARAGRAPH_DIALOG, CommandGroup::EDIT );
223 IMPL_LINK( ShapeController, CheckNameHdl, AbstractSvxObjectNameDialog&, rDialog, bool )
225 OUString aName;
226 rDialog.GetName( aName );
228 if ( !aName.isEmpty() )
230 DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : nullptr );
231 if ( pDrawViewWrapper && pDrawViewWrapper->getNamedSdrObject( aName ) )
233 return false;
236 return true;
239 void ShapeController::executeDispatch_FormatLine()
241 SolarMutexGuard aGuard;
242 if ( m_pChartController )
244 VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() );
245 DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
246 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
247 if ( pChartWindow && pDrawModelWrapper && pDrawViewWrapper )
249 SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
250 SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() );
251 bool bHasMarked = pDrawViewWrapper->AreObjectsMarked();
252 if ( bHasMarked )
254 pDrawViewWrapper->MergeAttrFromMarked( aAttr, false );
256 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
257 if ( pFact )
259 ScopedVclPtr< SfxAbstractTabDialog > pDlg(
260 pFact->CreateSvxLineTabDialog( pChartWindow, &aAttr, &pDrawModelWrapper->getSdrModel(),
261 pSelectedObj, bHasMarked ) );
262 if ( pDlg->Execute() == RET_OK )
264 const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
265 if ( bHasMarked )
267 pDrawViewWrapper->SetAttrToMarked( *pOutAttr, false );
269 else
271 pDrawViewWrapper->SetDefaultAttr( *pOutAttr, false );
279 void ShapeController::executeDispatch_FormatArea()
281 SolarMutexGuard aGuard;
282 if ( m_pChartController )
284 VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() );
285 DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
286 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
287 if ( pChartWindow && pDrawModelWrapper && pDrawViewWrapper )
289 SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() );
290 bool bHasMarked = pDrawViewWrapper->AreObjectsMarked();
291 if ( bHasMarked )
293 pDrawViewWrapper->MergeAttrFromMarked( aAttr, false );
295 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
296 if ( pFact )
298 ScopedVclPtr< AbstractSvxAreaTabDialog > pDlg(
299 pFact->CreateSvxAreaTabDialog( pChartWindow, &aAttr, &pDrawModelWrapper->getSdrModel(), true ) );
300 if ( pDlg.get() )
302 if ( pDlg->Execute() == RET_OK )
304 const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
305 if ( bHasMarked )
307 pDrawViewWrapper->SetAttrToMarked( *pOutAttr, false );
309 else
311 pDrawViewWrapper->SetDefaultAttr( *pOutAttr, false );
320 void ShapeController::executeDispatch_TextAttributes()
322 SolarMutexGuard aGuard;
323 if ( m_pChartController )
325 VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() );
326 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
327 if ( pChartWindow && pDrawViewWrapper )
329 SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() );
330 bool bHasMarked = pDrawViewWrapper->AreObjectsMarked();
331 if ( bHasMarked )
333 pDrawViewWrapper->MergeAttrFromMarked( aAttr, false );
335 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
336 if ( pFact )
338 ScopedVclPtr< SfxAbstractTabDialog > pDlg(
339 pFact->CreateTextTabDialog( pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, &aAttr, pDrawViewWrapper ) );
340 if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
342 const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
343 if ( bHasMarked )
345 pDrawViewWrapper->SetAttributes( *pOutAttr );
347 else
349 pDrawViewWrapper->SetDefaultAttr( *pOutAttr, false );
357 void ShapeController::executeDispatch_TransformDialog()
359 SolarMutexGuard aGuard;
360 if ( m_pChartController )
362 VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() );
363 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
364 if ( pChartWindow && pDrawViewWrapper )
366 SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
367 if ( pSelectedObj && pSelectedObj->GetObjIdentifier() == OBJ_CAPTION )
369 // item set for caption
370 SfxItemSet aAttr( pDrawViewWrapper->GetModel()->GetItemPool() );
371 pDrawViewWrapper->GetAttributes( aAttr );
372 // item set for position and size
373 SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() );
374 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
375 if ( pFact )
377 ScopedVclPtr< SfxAbstractTabDialog > pDlg(
378 pFact->CreateCaptionDialog( pChartWindow, pDrawViewWrapper ) );
379 if ( pDlg.get() )
381 const sal_uInt16* pRange = pDlg->GetInputRanges( *aAttr.GetPool() );
382 SfxItemSet aCombAttr( *aAttr.GetPool(), pRange );
383 aCombAttr.Put( aAttr );
384 aCombAttr.Put( aGeoAttr );
385 pDlg->SetInputSet( &aCombAttr );
386 if ( pDlg->Execute() == RET_OK )
388 const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
389 pDrawViewWrapper->SetAttributes( *pOutAttr );
390 pDrawViewWrapper->SetGeoAttrToMarked( *pOutAttr );
395 else
397 SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() );
398 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
399 if ( pFact )
401 ScopedVclPtr< SfxAbstractTabDialog > pDlg(
402 pFact->CreateSvxTransformTabDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, &aGeoAttr, pDrawViewWrapper));
403 if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
405 const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
406 pDrawViewWrapper->SetGeoAttrToMarked( *pOutAttr );
414 void ShapeController::executeDispatch_ObjectTitleDescription()
416 SolarMutexGuard aGuard;
417 if ( m_pChartController )
419 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
420 if ( pDrawViewWrapper && pDrawViewWrapper->GetMarkedObjectCount() == 1 )
422 SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
423 if ( pSelectedObj )
425 OUString aTitle( pSelectedObj->GetTitle() );
426 OUString aDescription( pSelectedObj->GetDescription() );
427 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
428 if ( pFact )
430 VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() );
431 ScopedVclPtr< AbstractSvxObjectTitleDescDialog > pDlg(
432 pFact->CreateSvxObjectTitleDescDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, aTitle, aDescription ) );
433 if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
435 pDlg->GetTitle( aTitle );
436 pDlg->GetDescription( aDescription );
437 pSelectedObj->SetTitle( aTitle );
438 pSelectedObj->SetDescription( aDescription );
446 void ShapeController::executeDispatch_RenameObject()
448 SolarMutexGuard aGuard;
449 if ( m_pChartController )
451 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
452 if ( pDrawViewWrapper && pDrawViewWrapper->GetMarkedObjectCount() == 1 )
454 SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
455 if ( pSelectedObj )
457 OUString aName = pSelectedObj->GetName();
458 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
459 if ( pFact )
461 VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() );
462 ScopedVclPtr< AbstractSvxObjectNameDialog > pDlg(
463 pFact->CreateSvxObjectNameDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, aName));
464 pDlg->SetCheckNameHdl( LINK( this, ShapeController, CheckNameHdl ) );
465 if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) )
467 pDlg->GetName(aName);
468 if (pSelectedObj->GetName() == aName)
470 pSelectedObj->SetName( aName );
479 void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId )
481 SolarMutexGuard aGuard;
482 DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : nullptr );
483 if ( pDrawViewWrapper )
485 switch ( nId )
487 case COMMAND_ID_BRING_TO_FRONT:
489 if ( isForwardPossible() )
491 pDrawViewWrapper->PutMarkedToTop();
494 break;
495 case COMMAND_ID_FORWARD:
497 if ( isForwardPossible() )
499 pDrawViewWrapper->MovMarkedToTop();
502 break;
503 case COMMAND_ID_BACKWARD:
505 if ( isBackwardPossible() )
507 pDrawViewWrapper->MovMarkedToBtm();
510 break;
511 case COMMAND_ID_SEND_TO_BACK:
513 if ( isBackwardPossible() )
515 SdrObject* pFirstObj = getFirstAdditionalShape();
516 pDrawViewWrapper->PutMarkedBehindObj( pFirstObj );
519 break;
520 default:
523 break;
528 void ShapeController::executeDispatch_FontDialog()
530 SolarMutexGuard aGuard;
531 if ( m_pChartController )
533 VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() );
534 DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
535 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
536 if ( pChartWindow && pDrawModelWrapper && pDrawViewWrapper )
538 SfxItemSet aAttr( pDrawViewWrapper->GetModel()->GetItemPool() );
539 pDrawViewWrapper->GetAttributes( aAttr );
540 ViewElementListProvider aViewElementListProvider( pDrawModelWrapper );
541 ScopedVclPtrInstance< ShapeFontDialog > pDlg( pChartWindow, &aAttr, &aViewElementListProvider );
542 if ( pDlg->Execute() == RET_OK )
544 const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
545 pDrawViewWrapper->SetAttributes( *pOutAttr );
551 void ShapeController::executeDispatch_ParagraphDialog()
553 SolarMutexGuard aGuard;
554 if ( m_pChartController )
556 VclPtr<ChartWindow> pChartWindow( m_pChartController->GetChartWindow() );
557 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
558 if ( pChartWindow && pDrawViewWrapper )
560 SfxItemPool& rPool = pDrawViewWrapper->GetModel()->GetItemPool();
561 SfxItemSet aAttr( rPool );
562 pDrawViewWrapper->GetAttributes( aAttr );
564 SfxItemSet aNewAttr(
565 rPool,
566 svl::Items<
567 EE_ITEMS_START, EE_ITEMS_END,
568 SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_WIDOWS>{});
569 aNewAttr.Put( aAttr );
570 aNewAttr.Put( SvxHyphenZoneItem( false, SID_ATTR_PARA_HYPHENZONE ) );
571 aNewAttr.Put( SvxFormatBreakItem( SvxBreak::NONE, SID_ATTR_PARA_PAGEBREAK ) );
572 aNewAttr.Put( SvxFormatSplitItem( true, SID_ATTR_PARA_SPLIT) );
573 aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
574 aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
576 ScopedVclPtrInstance< ShapeParagraphDialog > pDlg( pChartWindow, &aNewAttr );
577 if ( pDlg->Execute() == RET_OK )
579 const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet();
580 pDrawViewWrapper->SetAttributes( *pOutAttr );
586 SdrObject* ShapeController::getFirstAdditionalShape()
588 SdrObject* pFirstObj = nullptr;
592 DrawModelWrapper* pDrawModelWrapper = ( m_pChartController ? m_pChartController->GetDrawModelWrapper() : nullptr );
593 if ( pDrawModelWrapper )
595 Reference< drawing::XShape > xFirstShape;
596 Reference< drawing::XDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() );
597 Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY_THROW );
598 Reference< drawing::XShapes > xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) );
599 sal_Int32 nCount = xDrawPageShapes->getCount();
600 for ( sal_Int32 i = 0; i < nCount; ++i )
602 Reference< drawing::XShape > xShape;
603 if ( xDrawPageShapes->getByIndex( i ) >>= xShape )
605 if ( xShape.is() && xShape != xChartRoot )
607 xFirstShape = xShape;
608 break;
612 if ( xFirstShape.is() )
614 pFirstObj = DrawViewWrapper::getSdrObject( xFirstShape );
618 catch ( const uno::Exception& )
620 DBG_UNHANDLED_EXCEPTION("chart2");
623 return pFirstObj;
626 SdrObject* ShapeController::getLastAdditionalShape()
628 SdrObject* pLastObj = nullptr;
632 DrawModelWrapper* pDrawModelWrapper = ( m_pChartController ? m_pChartController->GetDrawModelWrapper() : nullptr );
633 if ( pDrawModelWrapper )
635 Reference< drawing::XShape > xLastShape;
636 Reference< drawing::XDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() );
637 Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY_THROW );
638 Reference< drawing::XShapes > xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) );
639 sal_Int32 nCount = xDrawPageShapes->getCount();
640 for ( sal_Int32 i = nCount - 1; i >= 0; --i )
642 Reference< drawing::XShape > xShape;
643 if ( xDrawPageShapes->getByIndex( i ) >>= xShape )
645 if ( xShape.is() && xShape != xChartRoot )
647 xLastShape = xShape;
648 break;
652 if ( xLastShape.is() )
654 pLastObj = DrawViewWrapper::getSdrObject( xLastShape );
658 catch ( const uno::Exception& )
660 DBG_UNHANDLED_EXCEPTION("chart2");
663 return pLastObj;
666 bool ShapeController::isBackwardPossible()
668 if ( m_pChartController && m_pChartController->isAdditionalShapeSelected() )
670 SolarMutexGuard aGuard;
671 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
672 if ( pDrawViewWrapper )
674 SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
675 SdrObject* pFirstObj = getFirstAdditionalShape();
676 if ( pSelectedObj && pFirstObj && pSelectedObj != pFirstObj )
678 return true;
682 return false;
685 bool ShapeController::isForwardPossible()
687 if ( m_pChartController && m_pChartController->isAdditionalShapeSelected() )
689 SolarMutexGuard aGuard;
690 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
691 if ( pDrawViewWrapper )
693 SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject();
694 SdrObject* pLastObj = getLastAdditionalShape();
695 if ( pSelectedObj && pLastObj && pSelectedObj != pLastObj )
697 return true;
701 return false;
704 } // namespace chart
706 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */