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