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     virtual void Resize (void);
62 
63 private:
64     //ui controls
65     ::boost::scoped_ptr< FixedText >        mpFtCategory;
66     ::boost::scoped_ptr< ListBox >          mpLbCategory;
67     ::boost::scoped_ptr< Window >           mpTBCategoryBackground;
68     ::boost::scoped_ptr< ToolBox >          mpTBCategory;
69     ::boost::scoped_ptr< FixedText >        mpFtDecimals;
70     ::boost::scoped_ptr< NumericField >     mpEdDecimals;
71     ::boost::scoped_ptr< FixedText >        mpFtLeadZeroes;
72     ::boost::scoped_ptr< NumericField >     mpEdLeadZeroes;
73     ::boost::scoped_ptr< CheckBox >         mpBtnNegRed;
74     ::boost::scoped_ptr< CheckBox >         mpBtnThousand;
75 
76     ::sfx2::sidebar::ControllerItem         maNumFormatControl;
77     ::sfx2::sidebar::ControllerItem         maFormatControl;
78 
79     sal_uInt16                              mnCategorySelected;
80 
81     cssu::Reference<css::frame::XFrame>     mxFrame;
82     ::sfx2::sidebar::EnumContext            maContext;
83     SfxBindings*                            mpBindings;
84 
85     DECL_LINK(NumFormatHdl, ToolBox*);
86     DECL_LINK(NumFormatSelectHdl, ListBox*);
87     DECL_LINK(NumFormatValueHdl, void*);
88 
89     // constructor/destuctor
90     NumberFormatPropertyPanel(
91         Window* pParent,
92         const cssu::Reference<css::frame::XFrame>& rxFrame,
93         SfxBindings* pBindings);
94     virtual ~NumberFormatPropertyPanel();
95 
96     void Initialize();
97 };
98 
99 } } // end of namespace ::sc::sidebar
100 
101 #endif
102 
103 // eof
104