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 
23 
24 #ifndef TABITEMDESCRIPTOR_HXX
25 #define TABITEMDESCRIPTOR_HXX
26 
27 #include "svtools/toolpanel/toolpanel.hxx"
28 #include "svtools/toolpanel/tabitemcontent.hxx"
29 
30 #include <tools/gen.hxx>
31 #include <osl/diagnose.h>
32 
33 #include <vector>
34 
35 //........................................................................
36 namespace svt
37 {
38 //........................................................................
39 
40     //==================================================================================================================
41 	//= ItemDescriptor
42 	//==================================================================================================================
43     struct ItemDescriptor
44     {
45         PToolPanel      pPanel;
46         Rectangle       aCompleteArea;  // bounding area if the both text and icon are to be rendererd
47         Rectangle       aIconOnlyArea;  // bounding area if the icon is to be rendererd
48         Rectangle       aTextOnlyArea;  // bounding area if the text is to be rendererd
49         TabItemContent  eContent;
50             // content to be used for this particular item. Might differ from item content which has been set
51             // up for the complete control, in case not the complete content fits into the available space.
52 
ItemDescriptorsvt::ItemDescriptor53         ItemDescriptor()
54             :pPanel()
55             ,aCompleteArea()
56             ,aIconOnlyArea()
57             ,aTextOnlyArea()
58             ,eContent( TABITEM_IMAGE_AND_TEXT )
59         {
60         }
61 
GetRectsvt::ItemDescriptor62         const Rectangle& GetRect( const TabItemContent i_eItemContent ) const
63         {
64             OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "ItemDescriptor::GetRect: illegal value!" );
65 
66             return  ( i_eItemContent == TABITEM_IMAGE_AND_TEXT )
67                 ?   aCompleteArea
68                 :   (   ( i_eItemContent == TABITEM_TEXT_ONLY )
69                     ?   aTextOnlyArea
70                     :   aIconOnlyArea
71                     );
72         }
73 
GetCurrentRectsvt::ItemDescriptor74         const Rectangle& GetCurrentRect() const
75         {
76             return GetRect( eContent );
77         }
78     };
79 
80     typedef ::std::vector< ItemDescriptor > ItemDescriptors;
81 
82 
83 //........................................................................
84 } // namespace svt
85 //........................................................................
86 
87 #endif // TABITEMDESCRIPTOR_HXX
88