1*6a606da0SAndre Fischer /************************************************************** 2*6a606da0SAndre Fischer * 3*6a606da0SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 4*6a606da0SAndre Fischer * or more contributor license agreements. See the NOTICE file 5*6a606da0SAndre Fischer * distributed with this work for additional information 6*6a606da0SAndre Fischer * regarding copyright ownership. The ASF licenses this file 7*6a606da0SAndre Fischer * to you under the Apache License, Version 2.0 (the 8*6a606da0SAndre Fischer * "License"); you may not use this file except in compliance 9*6a606da0SAndre Fischer * with the License. You may obtain a copy of the License at 10*6a606da0SAndre Fischer * 11*6a606da0SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 12*6a606da0SAndre Fischer * 13*6a606da0SAndre Fischer * Unless required by applicable law or agreed to in writing, 14*6a606da0SAndre Fischer * software distributed under the License is distributed on an 15*6a606da0SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6a606da0SAndre Fischer * KIND, either express or implied. See the License for the 17*6a606da0SAndre Fischer * specific language governing permissions and limitations 18*6a606da0SAndre Fischer * under the License. 19*6a606da0SAndre Fischer * 20*6a606da0SAndre Fischer *************************************************************/ 21*6a606da0SAndre Fischer 22*6a606da0SAndre Fischer #include "precompiled_sfx2.hxx" 23*6a606da0SAndre Fischer #include "sfx2/sidebar/Layouter.hxx" 24*6a606da0SAndre Fischer 25*6a606da0SAndre Fischer #include <vcl/window.hxx> 26*6a606da0SAndre Fischer #include <vcl/fixed.hxx> 27*6a606da0SAndre Fischer #include <vcl/outdev.hxx> 28*6a606da0SAndre Fischer 29*6a606da0SAndre Fischer namespace sfx2 { namespace sidebar { 30*6a606da0SAndre Fischer 31*6a606da0SAndre Fischer void Layouter::EnlargeControlHorizontally ( 32*6a606da0SAndre Fischer Window& rControl, 33*6a606da0SAndre Fischer const sal_Int32 nDeltaX) 34*6a606da0SAndre Fischer { 35*6a606da0SAndre Fischer Size aSize (rControl.GetSizePixel()); 36*6a606da0SAndre Fischer aSize.Width() += nDeltaX; 37*6a606da0SAndre Fischer rControl.SetSizePixel(aSize); 38*6a606da0SAndre Fischer 39*6a606da0SAndre Fischer } 40*6a606da0SAndre Fischer 41*6a606da0SAndre Fischer 42*6a606da0SAndre Fischer 43*6a606da0SAndre Fischer 44*6a606da0SAndre Fischer void Layouter::SetWidth ( 45*6a606da0SAndre Fischer Window& rControl, 46*6a606da0SAndre Fischer const sal_Int32 nWidth) 47*6a606da0SAndre Fischer { 48*6a606da0SAndre Fischer rControl.SetPosSizePixel( 49*6a606da0SAndre Fischer 0,0, 50*6a606da0SAndre Fischer nWidth,0, 51*6a606da0SAndre Fischer WINDOW_POSSIZE_WIDTH); 52*6a606da0SAndre Fischer } 53*6a606da0SAndre Fischer 54*6a606da0SAndre Fischer 55*6a606da0SAndre Fischer 56*6a606da0SAndre Fischer 57*6a606da0SAndre Fischer void Layouter::SetRight ( 58*6a606da0SAndre Fischer Window& rControl, 59*6a606da0SAndre Fischer const sal_Int32 nRight) 60*6a606da0SAndre Fischer { 61*6a606da0SAndre Fischer rControl.SetPosSizePixel( 62*6a606da0SAndre Fischer 0,0, 63*6a606da0SAndre Fischer nRight-rControl.GetPosPixel().X(),0, 64*6a606da0SAndre Fischer WINDOW_POSSIZE_WIDTH); 65*6a606da0SAndre Fischer } 66*6a606da0SAndre Fischer 67*6a606da0SAndre Fischer 68*6a606da0SAndre Fischer 69*6a606da0SAndre Fischer 70*6a606da0SAndre Fischer void Layouter::MoveControlHorizontally ( 71*6a606da0SAndre Fischer Window& rControl, 72*6a606da0SAndre Fischer const sal_Int32 nDeltaX) 73*6a606da0SAndre Fischer { 74*6a606da0SAndre Fischer Point aPosition (rControl.GetPosPixel()); 75*6a606da0SAndre Fischer aPosition.Move(nDeltaX, 0); 76*6a606da0SAndre Fischer rControl.SetPosPixel(aPosition); 77*6a606da0SAndre Fischer } 78*6a606da0SAndre Fischer 79*6a606da0SAndre Fischer 80*6a606da0SAndre Fischer 81*6a606da0SAndre Fischer 82*6a606da0SAndre Fischer void Layouter::SetHorizontalPosition ( 83*6a606da0SAndre Fischer Window& rControl, 84*6a606da0SAndre Fischer const sal_Int32 nX) 85*6a606da0SAndre Fischer { 86*6a606da0SAndre Fischer rControl.SetPosPixel(Point(nX, rControl.GetPosPixel().Y())); 87*6a606da0SAndre Fischer } 88*6a606da0SAndre Fischer 89*6a606da0SAndre Fischer 90*6a606da0SAndre Fischer 91*6a606da0SAndre Fischer 92*6a606da0SAndre Fischer void Layouter::PrepareForLayouting ( 93*6a606da0SAndre Fischer Window& rControl) 94*6a606da0SAndre Fischer { 95*6a606da0SAndre Fischer // rControl.SetStyle(rControl.GetStyle() | WB_PATHELLIPSIS | WB_INFO); 96*6a606da0SAndre Fischer } 97*6a606da0SAndre Fischer 98*6a606da0SAndre Fischer 99*6a606da0SAndre Fischer 100*6a606da0SAndre Fischer 101*6a606da0SAndre Fischer sal_Int32 Layouter::MapX ( 102*6a606da0SAndre Fischer const Window& rControl, 103*6a606da0SAndre Fischer const sal_Int32 nValue) 104*6a606da0SAndre Fischer { 105*6a606da0SAndre Fischer return rControl.LogicToPixel(Point(nValue,0), MAP_APPFONT).X(); 106*6a606da0SAndre Fischer } 107*6a606da0SAndre Fischer 108*6a606da0SAndre Fischer 109*6a606da0SAndre Fischer 110*6a606da0SAndre Fischer 111*6a606da0SAndre Fischer sal_Int32 Layouter::MapWidth ( 112*6a606da0SAndre Fischer const Window& rControl, 113*6a606da0SAndre Fischer const sal_Int32 nValue) 114*6a606da0SAndre Fischer { 115*6a606da0SAndre Fischer return rControl.LogicToPixel(Point(nValue,0), MAP_APPFONT).X(); 116*6a606da0SAndre Fischer } 117*6a606da0SAndre Fischer 118*6a606da0SAndre Fischer } } // end of namespace sfx2::sidebar 119