xref: /trunk/main/chart2/source/controller/main/DrawCommandDispatch.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 
64     // state of a feature
65     virtual FeatureState getState( const ::rtl::OUString& rCommand );
66 
67     // execute a feature
68     virtual void execute( const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs );
69 
70     // all the features which should be handled by this class
71     virtual void describeSupportedFeatures();
72 
73 private:
74     void setInsertObj( sal_uInt16 eObj );
75     SdrObject* createDefaultObject( const sal_uInt16 nID );
76 
77     bool parseCommandURL( const ::rtl::OUString& rCommandURL, sal_uInt16* pnFeatureId, ::rtl::OUString* pBaseCommand, ::rtl::OUString* pCustomShapeType );
78 
79     ChartController* m_pChartController;
80     ::rtl::OUString m_aCustomShapeType;
81 };
82 
83 //.............................................................................
84 } //  namespace chart
85 //.............................................................................
86 
87 // CHART2_DRAWCOMMANDDISPATCH_HXX
88 #endif
89