16a606da0SAndre Fischer /**************************************************************
26a606da0SAndre Fischer *
36a606da0SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one
46a606da0SAndre Fischer * or more contributor license agreements. See the NOTICE file
56a606da0SAndre Fischer * distributed with this work for additional information
66a606da0SAndre Fischer * regarding copyright ownership. The ASF licenses this file
76a606da0SAndre Fischer * to you under the Apache License, Version 2.0 (the
86a606da0SAndre Fischer * "License"); you may not use this file except in compliance
96a606da0SAndre Fischer * with the License. You may obtain a copy of the License at
106a606da0SAndre Fischer *
116a606da0SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0
126a606da0SAndre Fischer *
136a606da0SAndre Fischer * Unless required by applicable law or agreed to in writing,
146a606da0SAndre Fischer * software distributed under the License is distributed on an
156a606da0SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
166a606da0SAndre Fischer * KIND, either express or implied. See the License for the
176a606da0SAndre Fischer * specific language governing permissions and limitations
186a606da0SAndre Fischer * under the License.
196a606da0SAndre Fischer *
206a606da0SAndre Fischer *************************************************************/
216a606da0SAndre Fischer
226a606da0SAndre Fischer #include "precompiled_sfx2.hxx"
236a606da0SAndre Fischer #include "sfx2/sidebar/Layouter.hxx"
246a606da0SAndre Fischer
256a606da0SAndre Fischer #include <vcl/window.hxx>
266a606da0SAndre Fischer #include <vcl/fixed.hxx>
276a606da0SAndre Fischer #include <vcl/outdev.hxx>
286a606da0SAndre Fischer
296a606da0SAndre Fischer namespace sfx2 { namespace sidebar {
306a606da0SAndre Fischer
EnlargeControlHorizontally(Window & rControl,const sal_Int32 nDeltaX)316a606da0SAndre Fischer void Layouter::EnlargeControlHorizontally (
326a606da0SAndre Fischer Window& rControl,
336a606da0SAndre Fischer const sal_Int32 nDeltaX)
346a606da0SAndre Fischer {
356a606da0SAndre Fischer Size aSize (rControl.GetSizePixel());
366a606da0SAndre Fischer aSize.Width() += nDeltaX;
376a606da0SAndre Fischer rControl.SetSizePixel(aSize);
386a606da0SAndre Fischer
396a606da0SAndre Fischer }
406a606da0SAndre Fischer
416a606da0SAndre Fischer
426a606da0SAndre Fischer
436a606da0SAndre Fischer
SetWidth(Window & rControl,const sal_Int32 nWidth)446a606da0SAndre Fischer void Layouter::SetWidth (
456a606da0SAndre Fischer Window& rControl,
466a606da0SAndre Fischer const sal_Int32 nWidth)
476a606da0SAndre Fischer {
486a606da0SAndre Fischer rControl.SetPosSizePixel(
496a606da0SAndre Fischer 0,0,
506a606da0SAndre Fischer nWidth,0,
516a606da0SAndre Fischer WINDOW_POSSIZE_WIDTH);
526a606da0SAndre Fischer }
536a606da0SAndre Fischer
546a606da0SAndre Fischer
556a606da0SAndre Fischer
566a606da0SAndre Fischer
SetRight(Window & rControl,const sal_Int32 nRight)576a606da0SAndre Fischer void Layouter::SetRight (
586a606da0SAndre Fischer Window& rControl,
596a606da0SAndre Fischer const sal_Int32 nRight)
606a606da0SAndre Fischer {
616a606da0SAndre Fischer rControl.SetPosSizePixel(
626a606da0SAndre Fischer 0,0,
636a606da0SAndre Fischer nRight-rControl.GetPosPixel().X(),0,
646a606da0SAndre Fischer WINDOW_POSSIZE_WIDTH);
656a606da0SAndre Fischer }
666a606da0SAndre Fischer
676a606da0SAndre Fischer
686a606da0SAndre Fischer
696a606da0SAndre Fischer
MoveControlHorizontally(Window & rControl,const sal_Int32 nDeltaX)706a606da0SAndre Fischer void Layouter::MoveControlHorizontally (
716a606da0SAndre Fischer Window& rControl,
726a606da0SAndre Fischer const sal_Int32 nDeltaX)
736a606da0SAndre Fischer {
746a606da0SAndre Fischer Point aPosition (rControl.GetPosPixel());
756a606da0SAndre Fischer aPosition.Move(nDeltaX, 0);
766a606da0SAndre Fischer rControl.SetPosPixel(aPosition);
776a606da0SAndre Fischer }
786a606da0SAndre Fischer
796a606da0SAndre Fischer
806a606da0SAndre Fischer
816a606da0SAndre Fischer
SetHorizontalPosition(Window & rControl,const sal_Int32 nX)826a606da0SAndre Fischer void Layouter::SetHorizontalPosition (
836a606da0SAndre Fischer Window& rControl,
846a606da0SAndre Fischer const sal_Int32 nX)
856a606da0SAndre Fischer {
866a606da0SAndre Fischer rControl.SetPosPixel(Point(nX, rControl.GetPosPixel().Y()));
876a606da0SAndre Fischer }
886a606da0SAndre Fischer
896a606da0SAndre Fischer
906a606da0SAndre Fischer
916a606da0SAndre Fischer
PrepareForLayouting(Window &)926a606da0SAndre Fischer void Layouter::PrepareForLayouting (
93*8f2ce5deSPavel Janík Window& /* rControl */)
946a606da0SAndre Fischer {
956a606da0SAndre Fischer // rControl.SetStyle(rControl.GetStyle() | WB_PATHELLIPSIS | WB_INFO);
966a606da0SAndre Fischer }
976a606da0SAndre Fischer
986a606da0SAndre Fischer
996a606da0SAndre Fischer
1006a606da0SAndre Fischer
MapX(const Window & rControl,const sal_Int32 nValue)1016a606da0SAndre Fischer sal_Int32 Layouter::MapX (
1026a606da0SAndre Fischer const Window& rControl,
1036a606da0SAndre Fischer const sal_Int32 nValue)
1046a606da0SAndre Fischer {
1056a606da0SAndre Fischer return rControl.LogicToPixel(Point(nValue,0), MAP_APPFONT).X();
1066a606da0SAndre Fischer }
1076a606da0SAndre Fischer
1086a606da0SAndre Fischer
1096a606da0SAndre Fischer
1106a606da0SAndre Fischer
MapWidth(const Window & rControl,const sal_Int32 nValue)1116a606da0SAndre Fischer sal_Int32 Layouter::MapWidth (
1126a606da0SAndre Fischer const Window& rControl,
1136a606da0SAndre Fischer const sal_Int32 nValue)
1146a606da0SAndre Fischer {
1156a606da0SAndre Fischer return rControl.LogicToPixel(Point(nValue,0), MAP_APPFONT).X();
1166a606da0SAndre Fischer }
1176a606da0SAndre Fischer
1186a606da0SAndre Fischer } } // end of namespace sfx2::sidebar
119