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 SVX_PROPERTYPANEL_POSIZEPAGE_HXX 23 #define SVX_PROPERTYPANEL_POSIZEPAGE_HXX 24 25 #include <vcl/ctrl.hxx> 26 #include <sfx2/sidebar/SidebarPanelBase.hxx> 27 #include <sfx2/sidebar/ControllerItem.hxx> 28 #include <sfx2/sidebar/IContextChangeReceiver.hxx> 29 #include <boost/scoped_ptr.hpp> 30 #include <svx/rectenum.hxx> 31 #include <svl/poolitem.hxx> 32 #include <tools/fldunit.hxx> 33 #include <com/sun/star/ui/XSidebar.hpp> 34 35 class DialControl; 36 class SdrView; 37 class FixedText; 38 class MetricField; 39 class CheckBox; 40 class MetricBox; 41 42 43 namespace svx { namespace sidebar { 44 45 class SidebarDialControl; 46 47 class PosSizePropertyPanel 48 : public Control, 49 public ::sfx2::sidebar::IContextChangeReceiver, 50 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface 51 { 52 public: 53 static PosSizePropertyPanel* Create( 54 Window* pParent, 55 const cssu::Reference<css::frame::XFrame>& rxFrame, 56 SfxBindings* pBindings, 57 const cssu::Reference<css::ui::XSidebar>& rxSidebar); 58 59 virtual void DataChanged( 60 const DataChangedEvent& rEvent); 61 62 virtual void HandleContextChange( 63 const ::sfx2::sidebar::EnumContext aContext); 64 65 virtual void NotifyItemUpdate( 66 const sal_uInt16 nSId, 67 const SfxItemState eState, 68 const SfxPoolItem* pState); 69 70 SfxBindings* GetBindings(); 71 void ShowMenu (void); 72 73 private: 74 //Position 75 ::boost::scoped_ptr< FixedText > mpFtPosX; 76 ::boost::scoped_ptr< MetricField > mpMtrPosX; 77 ::boost::scoped_ptr< FixedText > mpFtPosY; 78 ::boost::scoped_ptr< MetricField > mpMtrPosY; 79 80 // size 81 ::boost::scoped_ptr< FixedText > mpFtWidth; 82 ::boost::scoped_ptr< MetricField > mpMtrWidth; 83 ::boost::scoped_ptr< FixedText > mpFtHeight; 84 ::boost::scoped_ptr< MetricField > mpMtrHeight; 85 ::boost::scoped_ptr< CheckBox > mpCbxScale; 86 87 //rotation 88 ::boost::scoped_ptr< FixedText > mpFtAngle; 89 ::boost::scoped_ptr< MetricBox > mpMtrAngle; 90 91 //rotation control 92 ::boost::scoped_ptr<SidebarDialControl> mpDial; 93 94 //flip 95 ::boost::scoped_ptr< FixedText > mpFtFlip; 96 ::boost::scoped_ptr< Window > mpFlipTbxBackground; 97 ::boost::scoped_ptr< ToolBox > mpFlipTbx; 98 99 // Internal variables 100 Rectangle maRect; 101 const SdrView* mpView; 102 sal_uInt32 mlOldWidth; 103 sal_uInt32 mlOldHeight; 104 RECT_POINT meRP; 105 Point maAnchorPos; //anchor position 106 long mlRotX; 107 long mlRotY; 108 Fraction maUIScale; 109 SfxMapUnit mePoolUnit; 110 FieldUnit meDlgUnit; 111 112 // Controller Items 113 ::sfx2::sidebar::ControllerItem maTransfPosXControl; 114 ::sfx2::sidebar::ControllerItem maTransfPosYControl; 115 ::sfx2::sidebar::ControllerItem maTransfWidthControl; 116 ::sfx2::sidebar::ControllerItem maTransfHeightControl; 117 118 ::sfx2::sidebar::ControllerItem maSvxAngleControl; 119 ::sfx2::sidebar::ControllerItem maRotXControl; 120 ::sfx2::sidebar::ControllerItem maRotYControl; 121 ::sfx2::sidebar::ControllerItem maProPosControl; 122 ::sfx2::sidebar::ControllerItem maProSizeControl; 123 ::sfx2::sidebar::ControllerItem maAutoWidthControl; 124 ::sfx2::sidebar::ControllerItem maAutoHeightControl; 125 ::sfx2::sidebar::ControllerItem m_aMetricCtl; 126 127 // images from ressource 128 Image maImgFlipHori; 129 Image maImgFlipVert; 130 131 cssu::Reference< css::frame::XFrame > mxFrame; 132 ::sfx2::sidebar::EnumContext maContext; 133 SfxBindings* mpBindings; 134 135 /// bitfield 136 bool mbMtrPosXMirror : 1; 137 bool mbSizeProtected : 1; 138 bool mbPositionProtected : 1; 139 bool mbAutoWidth : 1; 140 bool mbAutoHeight : 1; 141 bool mbAdjustEnabled : 1; 142 bool mbIsFlip : 1; 143 bool mbInDestructor : 1; 144 145 cssu::Reference<css::ui::XSidebar> mxSidebar; 146 147 DECL_LINK( ChangePosXHdl, void * ); 148 DECL_LINK( ChangePosYHdl, void * ); 149 DECL_LINK( ChangeWidthHdl, void * ); 150 DECL_LINK( ChangeHeightHdl, void * ); 151 DECL_LINK( ClickAutoHdl, void * ); 152 DECL_LINK( AngleModifiedHdl, void * ); 153 DECL_LINK( RotationHdl, void * ); 154 DECL_LINK( FlipHdl, ToolBox * ); 155 156 void SetupIcons(void); 157 void Initialize(); 158 void executePosX(); 159 void executePosY(); 160 void executeSize(); 161 162 // constructor/destuctor 163 PosSizePropertyPanel( 164 Window* pParent, 165 const cssu::Reference<css::frame::XFrame>& rxFrame, 166 SfxBindings* pBindings, 167 const cssu::Reference<css::ui::XSidebar>& rxSidebar); 168 virtual ~PosSizePropertyPanel(); 169 170 void MetricState( SfxItemState eState, const SfxPoolItem* pState ); 171 FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); 172 void DisableControls(); 173 }; 174 175 176 } } // end of namespace svx::sidebar 177 178 179 180 #endif // SVX_PROPERTYPANEL_POSIZEPAGE_HXX 181 182 // eof 183