xref: /trunk/main/sfx2/inc/sfx2/sidebar/Layouter.hxx (revision 6a606da0)
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 SFX_SIDEBAR_LAYOUTER_HXX
23 #define SFX_SIDEBAR_LAYOUTER_HXX
24 
25 #include "sfx2/dllapi.h"
26 
27 class Window;
28 
29 namespace sfx2 { namespace sidebar {
30 
31 /** Collection of simple helper functions for layouting sidebar panels.
32 */
33 class SFX2_DLLPUBLIC Layouter
34 {
35 public:
36     /** Make the given control wider by the given value.  Negative
37         values would make the control smaller.
38         The height and the position of the control remain unchanged.
39     */
40     static void EnlargeControlHorizontally (
41         Window& rControl,
42         const sal_Int32 nDeltaX);
43 
44     static void SetWidth (
45         Window& rControl,
46         const sal_Int32 nWidth);
47 
48     static void SetRight (
49         Window& rControl,
50         const sal_Int32 nRight);
51 
52     /** Move the given control by the given value to the right.
53         A negative value would move the control to the left.
54         The y-position and the size of the control remain unchanged.
55     */
56     static void MoveControlHorizontally (
57         Window& rControl,
58         const sal_Int32 nDeltaX);
59 
60     static void SetHorizontalPosition (
61         Window& rControl,
62         const sal_Int32 nX);
63 
64     /** Set the WB_ELLIPSIS flag at the given control so that when it
65         can not be shown completely it is shortened more gracefully
66         then just cutting it off.  The ellipsis flag can not be set
67         via the resource file.
68     */
69     static void PrepareForLayouting (
70         Window& rControl);
71 
72     static sal_Int32 MapX (
73         const Window& rControl,
74         const sal_Int32 nValue);
75 
76     static sal_Int32 MapWidth (
77         const Window& rControl,
78         const sal_Int32 nValue);
79 };
80 
81 } } // end of namespace sfx2::sidebar
82 
83 #endif
84