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 #ifndef SC_PROPERTYPANEL_NUMFORMAT_HXX
23 #define SC_PROPERTYPANEL_NUMFORMAT_HXX
24 
25 #include <sfx2/sidebar/ControllerItem.hxx>
26 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
27 #include <boost/scoped_ptr.hpp>
28 
29 class FixedText;
30 class ListBox;
31 class NumericField;
32 
33 namespace sc { namespace sidebar {
34 
35 class NumberFormatPropertyPanel
36 :   public Control,
37     public ::sfx2::sidebar::IContextChangeReceiver,
38     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
39 {
40 public:
41 public:
42     static NumberFormatPropertyPanel* Create(
43         Window* pParent,
44         const cssu::Reference<css::frame::XFrame>& rxFrame,
45         SfxBindings* pBindings);
46 
47     virtual void DataChanged(
48         const DataChangedEvent& rEvent);
49 
50     virtual void HandleContextChange(
51         const ::sfx2::sidebar::EnumContext aContext);
52 
53     virtual void NotifyItemUpdate(
54         const sal_uInt16 nSId,
55         const SfxItemState eState,
56         const SfxPoolItem* pState,
57         const bool bIsEnabled);
58 
59     SfxBindings* GetBindings();
60 
61 private:
62     //ui controls
63     ::boost::scoped_ptr< FixedText >        mpFtCategory;
64     ::boost::scoped_ptr< ListBox >          mpLbCategory;
65     ::boost::scoped_ptr< Window >           mpTBCategoryBackground;
66     ::boost::scoped_ptr< ToolBox >          mpTBCategory;
67     ::boost::scoped_ptr< FixedText >        mpFtDecimals;
68     ::boost::scoped_ptr< NumericField >     mpEdDecimals;
69     ::boost::scoped_ptr< FixedText >        mpFtLeadZeroes;
70     ::boost::scoped_ptr< NumericField >     mpEdLeadZeroes;
71     ::boost::scoped_ptr< CheckBox >         mpBtnNegRed;
72     ::boost::scoped_ptr< CheckBox >         mpBtnThousand;
73 
74     ::sfx2::sidebar::ControllerItem         maNumFormatControl;
75     ::sfx2::sidebar::ControllerItem         maFormatControl;
76 
77     sal_uInt16                              mnCategorySelected;
78 
79     cssu::Reference<css::frame::XFrame>     mxFrame;
80     ::sfx2::sidebar::EnumContext            maContext;
81     SfxBindings*                            mpBindings;
82 
83     DECL_LINK(NumFormatHdl, ToolBox*);
84     DECL_LINK(NumFormatSelectHdl, ListBox*);
85     DECL_LINK(NumFormatValueHdl, void*);
86 
87     // constructor/destuctor
88     NumberFormatPropertyPanel(
89         Window* pParent,
90         const cssu::Reference<css::frame::XFrame>& rxFrame,
91         SfxBindings* pBindings);
92     virtual ~NumberFormatPropertyPanel();
93 
94     void Initialize();
95 };
96 
97 } } // end of namespace ::sc::sidebar
98 
99 #endif
100 
101 // eof
102