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 #include "precompiled_sfx2.hxx" 23 #include "sfx2/sidebar/Layouter.hxx" 24 25 #include <vcl/window.hxx> 26 #include <vcl/fixed.hxx> 27 #include <vcl/outdev.hxx> 28 29 namespace sfx2 { namespace sidebar { 30 31 void Layouter::EnlargeControlHorizontally ( 32 Window& rControl, 33 const sal_Int32 nDeltaX) 34 { 35 Size aSize (rControl.GetSizePixel()); 36 aSize.Width() += nDeltaX; 37 rControl.SetSizePixel(aSize); 38 39 } 40 41 42 43 44 void Layouter::SetWidth ( 45 Window& rControl, 46 const sal_Int32 nWidth) 47 { 48 rControl.SetPosSizePixel( 49 0,0, 50 nWidth,0, 51 WINDOW_POSSIZE_WIDTH); 52 } 53 54 55 56 57 void Layouter::SetRight ( 58 Window& rControl, 59 const sal_Int32 nRight) 60 { 61 rControl.SetPosSizePixel( 62 0,0, 63 nRight-rControl.GetPosPixel().X(),0, 64 WINDOW_POSSIZE_WIDTH); 65 } 66 67 68 69 70 void Layouter::MoveControlHorizontally ( 71 Window& rControl, 72 const sal_Int32 nDeltaX) 73 { 74 Point aPosition (rControl.GetPosPixel()); 75 aPosition.Move(nDeltaX, 0); 76 rControl.SetPosPixel(aPosition); 77 } 78 79 80 81 82 void Layouter::SetHorizontalPosition ( 83 Window& rControl, 84 const sal_Int32 nX) 85 { 86 rControl.SetPosPixel(Point(nX, rControl.GetPosPixel().Y())); 87 } 88 89 90 91 92 void Layouter::PrepareForLayouting ( 93 Window& rControl) 94 { 95 // rControl.SetStyle(rControl.GetStyle() | WB_PATHELLIPSIS | WB_INFO); 96 } 97 98 99 100 101 sal_Int32 Layouter::MapX ( 102 const Window& rControl, 103 const sal_Int32 nValue) 104 { 105 return rControl.LogicToPixel(Point(nValue,0), MAP_APPFONT).X(); 106 } 107 108 109 110 111 sal_Int32 Layouter::MapWidth ( 112 const Window& rControl, 113 const sal_Int32 nValue) 114 { 115 return rControl.LogicToPixel(Point(nValue,0), MAP_APPFONT).X(); 116 } 117 118 } } // end of namespace sfx2::sidebar 119