1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef CHART2_DRAWCOMMANDDISPATCH_HXX
24 #define CHART2_DRAWCOMMANDDISPATCH_HXX
25 
26 #include "FeatureCommandDispatchBase.hxx"
27 
28 #include <tools/solar.h>
29 
30 class SfxItemSet;
31 class SdrObject;
32 
33 //.............................................................................
34 namespace chart
35 {
36 //.............................................................................
37 
38 class ChartController;
39 
40 /** This is a CommandDispatch implementation for drawing objects.
41  */
42 class DrawCommandDispatch: public FeatureCommandDispatchBase
43 {
44 public:
45     DrawCommandDispatch( const ::com::sun::star::uno::Reference<
46         ::com::sun::star::uno::XComponentContext >& rxContext, ChartController* pController );
47 	virtual ~DrawCommandDispatch();
48 
49     // late initialisation, especially for adding as listener
50     virtual void initialize();
51 
52     virtual bool isFeatureSupported( const ::rtl::OUString& rCommandURL );
53 
54     void setAttributes( SdrObject* pObj );
55     void setLineEnds( SfxItemSet& rAttr );
56 
57 protected:
58     // WeakComponentImplHelperBase
59     virtual void SAL_CALL disposing();
60 
61     // XEventListener
62     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
63         throw (::com::sun::star::uno::RuntimeException);
64 
65 	// state of a feature
66     virtual FeatureState getState( const ::rtl::OUString& rCommand );
67 
68     // execute a feature
69     virtual void execute( const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs );
70 
71     // all the features which should be handled by this class
72     virtual void describeSupportedFeatures();
73 
74 private:
75     void setInsertObj( sal_uInt16 eObj );
76     SdrObject* createDefaultObject( const sal_uInt16 nID );
77 
78     bool parseCommandURL( const ::rtl::OUString& rCommandURL, sal_uInt16* pnFeatureId, ::rtl::OUString* pBaseCommand, ::rtl::OUString* pCustomShapeType );
79 
80     ChartController* m_pChartController;
81     ::rtl::OUString m_aCustomShapeType;
82 };
83 
84 //.............................................................................
85 } //  namespace chart
86 //.............................................................................
87 
88 // CHART2_DRAWCOMMANDDISPATCH_HXX
89 #endif
90