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_ALIGNMENT_HXX
23 #define SC_PROPERTYPANEL_ALIGNMENT_HXX
24 
25 #include <sfx2/sidebar/ControllerItem.hxx>
26 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
27 #include <vcl/fixed.hxx>
28 #include <boost/scoped_ptr.hpp>
29 #include <editeng/svxenum.hxx>
30 
31 class ToolBox;
32 class MetricField;
33 class MetricBox;
34 class CheckBox;
35 namespace svx { namespace sidebar { class SidebarDialControl; }}
36 
37 namespace sc { namespace sidebar {
38 
39 class AlignmentPropertyPanel
40 :   public Control,
41     public ::sfx2::sidebar::IContextChangeReceiver,
42     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
43 {
44 public:
45     static AlignmentPropertyPanel* Create(
46         Window* pParent,
47         const cssu::Reference<css::frame::XFrame>& rxFrame,
48         SfxBindings* pBindings);
49 
50     virtual void DataChanged(
51         const DataChangedEvent& rEvent);
52 
53     virtual void HandleContextChange(
54         const ::sfx2::sidebar::EnumContext aContext);
55 
56     virtual void NotifyItemUpdate(
57         const sal_uInt16 nSId,
58         const SfxItemState eState,
59         const SfxPoolItem* pState,
60         const bool bIsEnabled);
61 
62     SfxBindings* GetBindings();
63 
64     virtual void Resize (void);
65 
66 private:
67     //ui controls
68 	::boost::scoped_ptr<Window> 			    mpTBHorizontalBackground;
69     ::boost::scoped_ptr< ToolBox >              mpTBHorizontal;
70 	::boost::scoped_ptr<Window> 			    mpTBVerticalBackground;
71     ::boost::scoped_ptr< ToolBox >              mpTBVertical;
72     ::boost::scoped_ptr< FixedText >            mpFTLeftIndent;
73     ::boost::scoped_ptr< MetricField >          mpMFLeftIndent;
74     ::boost::scoped_ptr< CheckBox >             mpCBXWrapText;
75     ::boost::scoped_ptr< CheckBox >             mpCBXMergeCell;
76     ::boost::scoped_ptr< FixedText >            mpFtRotate;
77     ::boost::scoped_ptr< svx::sidebar::SidebarDialControl > mpCtrlDial;
78     ::boost::scoped_ptr< MetricBox >            mpMtrAngle;
79     ::boost::scoped_ptr< CheckBox >             mpCbStacked;
80 
81     ::sfx2::sidebar::ControllerItem             maAlignHorControl;
82     ::sfx2::sidebar::ControllerItem             maAlignVerControl;
83     ::sfx2::sidebar::ControllerItem             maLeftIndentControl;
84     ::sfx2::sidebar::ControllerItem             maMergeCellControl;
85     ::sfx2::sidebar::ControllerItem             maWrapTextControl;
86     ::sfx2::sidebar::ControllerItem             maAngleControl;
87     ::sfx2::sidebar::ControllerItem             maStackControl;
88 
89     Image                                       maIMGAlignLeft;
90     Image                                       maIMGAlignCenter;
91     Image                                       maIMGAlignRight;
92     Image                                       maIMGAlignJust;
93     Image                                       maIMGAlignTop;
94     Image                                       maIMGAlignCenterV;
95     Image                                       maIMGAlignBottom;
96 
97     SvxCellHorJustify                           meHorAlignState;
98     SvxCellVerJustify                           meVerAlignState;
99 
100     /// bitfield
101     bool                                        mbMultiDisable : 1;
102 
103     cssu::Reference<css::frame::XFrame>         mxFrame;
104     ::sfx2::sidebar::EnumContext                maContext;
105     SfxBindings*                                mpBindings;
106 
107     DECL_LINK( TbxHorAlignSelectHdl, ToolBox* );
108     DECL_LINK( TbxVerAlignSelectHdl, ToolBox* );
109     DECL_LINK( MFLeftIndentMdyHdl, void * );
110     DECL_LINK( CBOXMergnCellClkHdl, void * );
111     DECL_LINK( CBOXWrapTextClkHdl, void * );
112     DECL_LINK( AngleModifiedHdl, void * );
113     DECL_LINK( RotationHdl, void * );
114     DECL_LINK( ClickStackHdl, void * );
115 
116     // constructor/destuctor
117     AlignmentPropertyPanel(
118         Window* pParent,
119         const cssu::Reference<css::frame::XFrame>& rxFrame,
120         SfxBindings* pBindings);
121     virtual ~AlignmentPropertyPanel();
122 
123     void Initialize();
124     void UpdateHorAlign();
125     void UpdateVerAlign();
126     void FormatDegrees(double& dTmp);
127 };
128 
129 } } // end of namespace ::sc::sidebar
130 
131 #endif
132 // eof
133