fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / main / DrawCommandDispatch.cxx
blob274791694edb7dae2c4a945c3c15fa9b6e83129d
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 "DrawCommandDispatch.hxx"
21 #include "DrawCommandDispatch.hrc"
22 #include "ChartController.hxx"
23 #include "DrawViewWrapper.hxx"
24 #include "chartview/DrawModelWrapper.hxx"
25 #include "macros.hxx"
27 #include <osl/mutex.hxx>
28 #include <vcl/svapp.hxx>
29 #include <svl/itempool.hxx>
30 #include <editeng/adjustitem.hxx>
31 #include <svx/dialogs.hrc>
32 #include <svx/dialmgr.hxx>
33 #include <svx/fmmodel.hxx>
34 #include <svx/gallery.hxx>
35 #include <svx/svdoashp.hxx>
36 #include <svx/svdocapt.hxx>
37 #include <svx/svdopath.hxx>
38 #include <svx/svdpage.hxx>
39 #include <svx/unoapi.hxx>
40 #include <svx/xlnedit.hxx>
41 #include <svx/xlnedwit.hxx>
42 #include <svx/xlnwtit.hxx>
43 #include <svx/xtable.hxx>
44 #include <basegfx/polygon/b2dpolygon.hxx>
46 #include <boost/ref.hpp>
48 using namespace ::com::sun::star;
49 using namespace ::com::sun::star::frame;
51 using ::com::sun::star::uno::Reference;
52 using ::com::sun::star::uno::Sequence;
54 namespace
57 // comparing two PropertyValue instances
58 struct PropertyValueCompare : public ::std::binary_function< beans::PropertyValue, OUString, bool >
60 bool operator() ( const beans::PropertyValue& rPropValue, const OUString& rName ) const
62 return rPropValue.Name.equals( rName );
66 } // anonymous namespace
68 namespace chart
71 DrawCommandDispatch::DrawCommandDispatch( const Reference< uno::XComponentContext >& rxContext,
72 ChartController* pController )
73 :FeatureCommandDispatchBase( rxContext )
74 ,m_pChartController( pController )
78 DrawCommandDispatch::~DrawCommandDispatch()
82 void DrawCommandDispatch::initialize()
84 FeatureCommandDispatchBase::initialize();
87 bool DrawCommandDispatch::isFeatureSupported( const OUString& rCommandURL )
89 sal_uInt16 nFeatureId = 0;
90 OUString aBaseCommand;
91 OUString aCustomShapeType;
92 return parseCommandURL( rCommandURL, &nFeatureId, &aBaseCommand, &aCustomShapeType );
95 ::basegfx::B2DPolyPolygon getPolygon( sal_uInt16 nResId, SdrModel& rModel )
97 ::basegfx::B2DPolyPolygon aReturn;
98 XLineEndListRef pLineEndList = rModel.GetLineEndList();
99 if ( pLineEndList.is() )
101 OUString aName( SVX_RESSTR( nResId ) );
102 long nCount = pLineEndList->Count();
103 for ( long nIndex = 0; nIndex < nCount; ++nIndex )
105 XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nIndex );
106 if ( pEntry->GetName() == aName )
108 aReturn = pEntry->GetLineEnd();
109 break;
113 return aReturn;
116 void DrawCommandDispatch::setAttributes( SdrObject* pObj )
118 if ( m_pChartController )
120 DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
121 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
122 if ( pDrawModelWrapper && pDrawViewWrapper && pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_CUSTOMSHAPE )
124 bool bAttributesAppliedFromGallery = false;
125 if ( GalleryExplorer::GetSdrObjCount( GALLERY_THEME_POWERPOINT ) )
127 ::std::vector< OUString > aObjList;
128 if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) )
130 for ( sal_uInt16 i = 0; i < aObjList.size(); ++i )
132 if ( aObjList[ i ].equalsIgnoreAsciiCase( m_aCustomShapeType ) )
134 FmFormModel aModel;
135 SfxItemPool& rPool = aModel.GetItemPool();
136 rPool.FreezeIdRanges();
137 if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aModel ) )
139 const SdrObject* pSourceObj = aModel.GetPage( 0 )->GetObj( 0 );
140 if ( pSourceObj )
142 const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
143 SfxItemSet aDest( pObj->GetModel()->GetItemPool(), // ranges from SdrAttrObj
144 SDRATTR_START, SDRATTR_SHADOW_LAST,
145 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
146 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
147 // Graphic Attributes
148 SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
149 // 3d Properties
150 SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
151 // CustomShape properties
152 SDRATTR_CUSTOMSHAPE_FIRST, SDRATTR_CUSTOMSHAPE_LAST,
153 // range from SdrTextObj
154 EE_ITEMS_START, EE_ITEMS_END,
155 // end
156 0, 0);
157 aDest.Set( rSource );
158 pObj->SetMergedItemSet( aDest );
159 sal_Int32 nAngle = pSourceObj->GetRotateAngle();
160 if ( nAngle )
162 double a = nAngle * F_PI18000;
163 pObj->NbcRotate( pObj->GetSnapRect().Center(), nAngle, sin( a ), cos( a ) );
165 bAttributesAppliedFromGallery = true;
168 break;
173 if ( !bAttributesAppliedFromGallery )
175 pObj->SetMergedItem( SvxAdjustItem( SVX_ADJUST_CENTER, 0 ) );
176 pObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
177 pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
178 pObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( false ) );
180 SdrObjCustomShape* pShape(dynamic_cast< SdrObjCustomShape* >( pObj ));
181 assert(pShape);
182 if(pShape)
184 pShape->MergeDefaultAttributes( &m_aCustomShapeType );
191 void DrawCommandDispatch::setLineEnds( SfxItemSet& rAttr )
193 if ( m_nFeatureId == COMMAND_ID_LINE_ARROW_END && m_pChartController )
195 DrawModelWrapper* pDrawModelWrapper = m_pChartController->GetDrawModelWrapper();
196 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
197 if ( pDrawModelWrapper && pDrawViewWrapper )
199 ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, pDrawModelWrapper->getSdrModel() ) );
200 if ( !aArrow.count() )
202 ::basegfx::B2DPolygon aNewArrow;
203 aNewArrow.append( ::basegfx::B2DPoint( 10.0, 0.0 ) );
204 aNewArrow.append( ::basegfx::B2DPoint( 0.0, 30.0) );
205 aNewArrow.append( ::basegfx::B2DPoint( 20.0, 30.0 ) );
206 aNewArrow.setClosed( true );
207 aArrow.append( aNewArrow );
210 SfxItemSet aSet( pDrawViewWrapper->GetModel()->GetItemPool() );
211 pDrawViewWrapper->GetAttributes( aSet );
213 long nWidth = 300; // (1/100th mm)
214 if ( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE )
216 long nValue = static_cast<const XLineWidthItem&>( aSet.Get( XATTR_LINEWIDTH ) ).GetValue();
217 if ( nValue > 0 )
219 nWidth = nValue * 3;
223 rAttr.Put( XLineEndItem( SVX_RESSTR( RID_SVXSTR_ARROW ), aArrow ) );
224 rAttr.Put( XLineEndWidthItem( nWidth ) );
229 // WeakComponentImplHelperBase
230 void DrawCommandDispatch::disposing()
234 // XEventListener
235 void DrawCommandDispatch::disposing( const lang::EventObject& /* Source */ )
236 throw (uno::RuntimeException, std::exception)
240 FeatureState DrawCommandDispatch::getState( const OUString& rCommand )
242 FeatureState aReturn;
243 aReturn.bEnabled = false;
244 aReturn.aState <<= false;
246 sal_uInt16 nFeatureId = 0;
247 OUString aBaseCommand;
248 OUString aCustomShapeType;
249 if ( parseCommandURL( rCommand, &nFeatureId, &aBaseCommand, &aCustomShapeType ) )
251 switch ( nFeatureId )
253 case COMMAND_ID_OBJECT_SELECT:
254 case COMMAND_ID_DRAW_LINE:
255 case COMMAND_ID_LINE_ARROW_END:
256 case COMMAND_ID_DRAW_RECT:
257 case COMMAND_ID_DRAW_ELLIPSE:
258 case COMMAND_ID_DRAW_FREELINE_NOFILL:
259 case COMMAND_ID_DRAW_TEXT:
260 case COMMAND_ID_DRAW_CAPTION:
261 case COMMAND_ID_DRAWTBX_CS_BASIC:
262 case COMMAND_ID_DRAWTBX_CS_SYMBOL:
263 case COMMAND_ID_DRAWTBX_CS_ARROW:
264 case COMMAND_ID_DRAWTBX_CS_FLOWCHART:
265 case COMMAND_ID_DRAWTBX_CS_CALLOUT:
266 case COMMAND_ID_DRAWTBX_CS_STAR:
268 aReturn.bEnabled = true;
269 aReturn.aState <<= false;
271 break;
272 default:
274 aReturn.bEnabled = false;
275 aReturn.aState <<= false;
277 break;
281 return aReturn;
284 void DrawCommandDispatch::execute( const OUString& rCommand, const Sequence< beans::PropertyValue>& rArgs )
286 (void)rArgs;
288 ChartDrawMode eDrawMode = CHARTDRAW_SELECT;
289 SdrObjKind eKind = OBJ_NONE;
291 sal_uInt16 nFeatureId = 0;
292 OUString aBaseCommand;
293 OUString aCustomShapeType;
294 if ( parseCommandURL( rCommand, &nFeatureId, &aBaseCommand, &aCustomShapeType ) )
296 bool bCreate = false;
297 m_nFeatureId = nFeatureId;
298 m_aCustomShapeType = aCustomShapeType;
300 switch ( nFeatureId )
302 case COMMAND_ID_OBJECT_SELECT:
304 eDrawMode = CHARTDRAW_SELECT;
305 eKind = OBJ_NONE;
307 break;
308 case COMMAND_ID_DRAW_LINE:
309 case COMMAND_ID_LINE_ARROW_END:
311 eDrawMode = CHARTDRAW_INSERT;
312 eKind = OBJ_LINE;
314 break;
315 case COMMAND_ID_DRAW_RECT:
317 eDrawMode = CHARTDRAW_INSERT;
318 eKind = OBJ_RECT;
320 break;
321 case COMMAND_ID_DRAW_ELLIPSE:
323 eDrawMode = CHARTDRAW_INSERT;
324 eKind = OBJ_CIRC;
326 break;
327 case COMMAND_ID_DRAW_FREELINE_NOFILL:
329 eDrawMode = CHARTDRAW_INSERT;
330 eKind = OBJ_FREELINE;
332 break;
333 case COMMAND_ID_DRAW_TEXT:
335 eDrawMode = CHARTDRAW_INSERT;
336 eKind = OBJ_TEXT;
337 bCreate = true;
339 break;
340 case COMMAND_ID_DRAW_CAPTION:
342 eDrawMode = CHARTDRAW_INSERT;
343 eKind = OBJ_CAPTION;
345 break;
346 case COMMAND_ID_DRAWTBX_CS_BASIC:
347 case COMMAND_ID_DRAWTBX_CS_SYMBOL:
348 case COMMAND_ID_DRAWTBX_CS_ARROW:
349 case COMMAND_ID_DRAWTBX_CS_FLOWCHART:
350 case COMMAND_ID_DRAWTBX_CS_CALLOUT:
351 case COMMAND_ID_DRAWTBX_CS_STAR:
353 eDrawMode = CHARTDRAW_INSERT;
354 eKind = OBJ_CUSTOMSHAPE;
356 break;
357 default:
359 eDrawMode = CHARTDRAW_SELECT;
360 eKind = OBJ_NONE;
362 break;
365 if ( m_pChartController )
367 DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper();
368 if ( pDrawViewWrapper )
370 SolarMutexGuard aGuard;
371 m_pChartController->setDrawMode( eDrawMode );
372 setInsertObj( sal::static_int_cast< sal_uInt16 >( eKind ) );
373 if ( bCreate )
375 pDrawViewWrapper->SetCreateMode();
378 const OUString sKeyModifier( "KeyModifier" );
379 const beans::PropertyValue* pIter = rArgs.getConstArray();
380 const beans::PropertyValue* pEnd = pIter + rArgs.getLength();
381 const beans::PropertyValue* pKeyModifier = ::std::find_if(
382 pIter, pEnd, ::std::bind2nd( PropertyValueCompare(), boost::cref( sKeyModifier ) ) );
383 sal_Int16 nKeyModifier = 0;
384 if ( pKeyModifier != pEnd && pKeyModifier && ( pKeyModifier->Value >>= nKeyModifier ) && nKeyModifier == KEY_MOD1 )
386 if ( eDrawMode == CHARTDRAW_INSERT )
388 SdrObject* pObj = createDefaultObject( nFeatureId );
389 if ( pObj )
391 SdrPageView* pPageView = pDrawViewWrapper->GetSdrPageView();
392 pDrawViewWrapper->InsertObjectAtView( pObj, *pPageView );
393 Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
394 if ( xShape.is() )
396 m_pChartController->m_aSelection.setSelection( xShape );
397 m_pChartController->m_aSelection.applySelection( pDrawViewWrapper );
399 if ( nFeatureId == COMMAND_ID_DRAW_TEXT )
401 m_pChartController->StartTextEdit();
411 void DrawCommandDispatch::describeSupportedFeatures()
413 implDescribeSupportedFeature( ".uno:SelectObject", COMMAND_ID_OBJECT_SELECT, CommandGroup::INSERT );
414 implDescribeSupportedFeature( ".uno:Line", COMMAND_ID_DRAW_LINE, CommandGroup::INSERT );
415 implDescribeSupportedFeature( ".uno:LineArrowEnd", COMMAND_ID_LINE_ARROW_END, CommandGroup::INSERT );
416 implDescribeSupportedFeature( ".uno:Rect", COMMAND_ID_DRAW_RECT, CommandGroup::INSERT );
417 implDescribeSupportedFeature( ".uno:Ellipse", COMMAND_ID_DRAW_ELLIPSE, CommandGroup::INSERT );
418 implDescribeSupportedFeature( ".uno:Freeline_Unfilled", COMMAND_ID_DRAW_FREELINE_NOFILL, CommandGroup::INSERT );
419 implDescribeSupportedFeature( ".uno:DrawText", COMMAND_ID_DRAW_TEXT, CommandGroup::INSERT );
420 implDescribeSupportedFeature( ".uno:DrawCaption", COMMAND_ID_DRAW_CAPTION, CommandGroup::INSERT );
421 implDescribeSupportedFeature( ".uno:BasicShapes", COMMAND_ID_DRAWTBX_CS_BASIC, CommandGroup::INSERT );
422 implDescribeSupportedFeature( ".uno:SymbolShapes", COMMAND_ID_DRAWTBX_CS_SYMBOL, CommandGroup::INSERT );
423 implDescribeSupportedFeature( ".uno:ArrowShapes", COMMAND_ID_DRAWTBX_CS_ARROW, CommandGroup::INSERT );
424 implDescribeSupportedFeature( ".uno:FlowChartShapes", COMMAND_ID_DRAWTBX_CS_FLOWCHART, CommandGroup::INSERT );
425 implDescribeSupportedFeature( ".uno:CalloutShapes", COMMAND_ID_DRAWTBX_CS_CALLOUT, CommandGroup::INSERT );
426 implDescribeSupportedFeature( ".uno:StarShapes", COMMAND_ID_DRAWTBX_CS_STAR, CommandGroup::INSERT );
429 void DrawCommandDispatch::setInsertObj( sal_uInt16 eObj )
431 DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL );
432 if ( pDrawViewWrapper )
434 pDrawViewWrapper->SetCurrentObj( eObj /*, Inventor */);
438 SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
440 SdrObject* pObj = NULL;
441 DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL );
442 DrawModelWrapper* pDrawModelWrapper = ( m_pChartController ? m_pChartController->GetDrawModelWrapper() : NULL );
444 if ( pDrawViewWrapper && pDrawModelWrapper )
446 Reference< drawing::XDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() );
447 SdrPage* pPage = GetSdrPageFromXDrawPage( xDrawPage );
448 if ( pPage )
450 SolarMutexGuard aGuard;
451 pObj = SdrObjFactory::MakeNewObject( pDrawViewWrapper->GetCurrentObjInventor(),
452 pDrawViewWrapper->GetCurrentObjIdentifier(), pPage );
453 if ( pObj )
455 long nDefaultObjectSizeWidth = 4000;
456 long nDefaultObjectSizeHeight = 2500;
457 Size aObjectSize( nDefaultObjectSizeWidth, nDefaultObjectSizeHeight );
458 Rectangle aPageRect( Rectangle( Point( 0, 0 ), pPage->GetSize() ) );
459 Point aObjectPos = aPageRect.Center();
460 aObjectPos.X() -= aObjectSize.Width() / 2;
461 aObjectPos.Y() -= aObjectSize.Height() / 2;
462 Rectangle aRect( aObjectPos, aObjectSize );
464 switch ( nID )
466 case COMMAND_ID_DRAW_LINE:
467 case COMMAND_ID_LINE_ARROW_END:
469 if ( pObj->ISA( SdrPathObj ) )
471 Point aStart = aRect.TopLeft();
472 Point aEnd = aRect.BottomRight();
473 sal_Int32 nYMiddle( ( aRect.Top() + aRect.Bottom() ) / 2 );
474 basegfx::B2DPolygon aPoly;
475 aPoly.append( basegfx::B2DPoint( aStart.X(), nYMiddle ) );
476 aPoly.append( basegfx::B2DPoint( aEnd.X(), nYMiddle ) );
477 dynamic_cast<SdrPathObj&>(*pObj).SetPathPoly(basegfx::B2DPolyPolygon(aPoly));
478 SfxItemSet aSet( pDrawModelWrapper->GetItemPool() );
479 setLineEnds( aSet );
480 pObj->SetMergedItemSet( aSet );
483 break;
484 case COMMAND_ID_DRAW_FREELINE_NOFILL:
486 if ( pObj->ISA( SdrPathObj ) )
488 basegfx::B2DPolygon aInnerPoly;
489 aInnerPoly.append( basegfx::B2DPoint( aRect.Left(), aRect.Bottom() ) );
490 aInnerPoly.appendBezierSegment(
491 basegfx::B2DPoint( aRect.Left(), aRect.Top() ),
492 basegfx::B2DPoint( aRect.Center().X(), aRect.Top() ),
493 basegfx::B2DPoint( aRect.Center().X(), aRect.Center().Y() ) );
494 aInnerPoly.appendBezierSegment(
495 basegfx::B2DPoint( aRect.Center().X(), aRect.Bottom() ),
496 basegfx::B2DPoint( aRect.Right(), aRect.Bottom() ),
497 basegfx::B2DPoint( aRect.Right(), aRect.Top() ) );
498 basegfx::B2DPolyPolygon aPoly;
499 aPoly.append( aInnerPoly );
500 dynamic_cast<SdrPathObj&>(*pObj).SetPathPoly(aPoly);
503 break;
504 case COMMAND_ID_DRAW_TEXT:
505 case COMMAND_ID_DRAW_TEXT_VERTICAL:
507 if ( pObj->ISA( SdrTextObj ) )
509 SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
510 if ( pTextObj )
512 pTextObj->SetLogicRect( aRect );
513 bool bVertical = ( nID == COMMAND_ID_DRAW_TEXT_VERTICAL );
514 pTextObj->SetVerticalWriting( bVertical );
515 if ( bVertical )
517 SfxItemSet aSet( pDrawModelWrapper->GetItemPool() );
518 aSet.Put( makeSdrTextAutoGrowWidthItem( true ) );
519 aSet.Put( makeSdrTextAutoGrowHeightItem( false ) );
520 aSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_TOP ) );
521 aSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_RIGHT ) );
522 pTextObj->SetMergedItemSet( aSet );
527 break;
528 case COMMAND_ID_DRAW_CAPTION:
529 case COMMAND_ID_DRAW_CAPTION_VERTICAL:
531 if ( pObj->ISA( SdrCaptionObj ) )
533 bool bIsVertical( COMMAND_ID_DRAW_CAPTION_VERTICAL == nID );
534 SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
535 if ( pTextObj )
537 pTextObj->SetVerticalWriting( bIsVertical );
539 if ( bIsVertical )
541 SfxItemSet aSet( pObj->GetMergedItemSet() );
542 aSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
543 aSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_RIGHT ) );
544 pObj->SetMergedItemSet( aSet );
546 SdrCaptionObj* pCaptionObj = dynamic_cast< SdrCaptionObj* >( pObj );
547 if ( pCaptionObj )
549 pCaptionObj->SetLogicRect( aRect );
550 pCaptionObj->SetTailPos(
551 aRect.TopLeft() - Point( aRect.GetWidth() / 2, aRect.GetHeight() / 2 ) );
555 break;
556 default:
558 pObj->SetLogicRect( aRect );
559 SfxItemSet aSet( pDrawModelWrapper->GetItemPool() );
560 setAttributes( pObj );
561 pObj->SetMergedItemSet( aSet );
563 break;
569 return pObj;
572 bool DrawCommandDispatch::parseCommandURL( const OUString& rCommandURL, sal_uInt16* pnFeatureId,
573 OUString* pBaseCommand, OUString* pCustomShapeType )
575 bool bFound = true;
576 sal_uInt16 nFeatureId = 0;
577 OUString aBaseCommand;
578 OUString aType;
580 sal_Int32 nIndex = 1;
581 OUString aToken = rCommandURL.getToken( 0, '.', nIndex );
582 if ( nIndex == -1 || aToken.isEmpty() )
584 aBaseCommand = rCommandURL;
585 SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( aBaseCommand );
586 if ( aIter != m_aSupportedFeatures.end() )
588 nFeatureId = aIter->second.nFeatureId;
590 switch ( nFeatureId )
592 case COMMAND_ID_DRAWTBX_CS_BASIC:
594 aType = "diamond";
596 break;
597 case COMMAND_ID_DRAWTBX_CS_SYMBOL:
599 aType = "smiley";
601 break;
602 case COMMAND_ID_DRAWTBX_CS_ARROW:
604 aType = "left-right-arrow";
606 break;
607 case COMMAND_ID_DRAWTBX_CS_FLOWCHART:
609 aType = "flowchart-internal-storage";
611 break;
612 case COMMAND_ID_DRAWTBX_CS_CALLOUT:
614 aType = "round-rectangular-callout";
616 break;
617 case COMMAND_ID_DRAWTBX_CS_STAR:
619 aType = "star5";
621 break;
622 default:
625 break;
628 else
630 bFound = false;
633 else
635 aBaseCommand = rCommandURL.copy( 0, nIndex - 1 );
636 SupportedFeatures::const_iterator aIter = m_aSupportedFeatures.find( aBaseCommand );
637 if ( aIter != m_aSupportedFeatures.end() )
639 nFeatureId = aIter->second.nFeatureId;
640 aType = rCommandURL.getToken( 0, '.', nIndex );
642 else
644 bFound = false;
648 *pnFeatureId = nFeatureId;
649 *pBaseCommand = aBaseCommand;
650 *pCustomShapeType = aType;
652 return bFound;
655 } // namespace chart
657 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */