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 
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     // images
78     Image                                   maImgNumber;
79     Image                                   maImgPercent;
80     Image                                   maImgCurrency;
81     Image                                   maImgDate;
82     Image                                   maImgText;
83 
84     sal_uInt16                              mnCategorySelected;
85 
86     cssu::Reference<css::frame::XFrame>     mxFrame;
87     ::sfx2::sidebar::EnumContext            maContext;
88     SfxBindings*                            mpBindings;
89 
90     DECL_LINK(NumFormatHdl, ToolBox*);
91     DECL_LINK(NumFormatSelectHdl, ListBox*);
92     DECL_LINK(NumFormatValueHdl, void*);
93 
94     // constructor/destuctor
95     NumberFormatPropertyPanel(
96         Window* pParent,
97         const cssu::Reference<css::frame::XFrame>& rxFrame,
98         SfxBindings* pBindings);
99     virtual ~NumberFormatPropertyPanel();
100 
101     void Initialize();
102 };
103 
104 } } // end of namespace ::sc::sidebar
105 
106 #endif SC_PROPERTYPANEL_NUMFORMAT_HXX
107 
108 // eof
109