xref: /AOO41X/main/svtools/source/toolpanel/tabitemdescriptor.hxx (revision 01aa44aa134af97080e2cf8e8bf3a0a4cd1cffe0)
1*01aa44aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*01aa44aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*01aa44aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*01aa44aaSAndrew Rist  * distributed with this work for additional information
6*01aa44aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*01aa44aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*01aa44aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*01aa44aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*01aa44aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*01aa44aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*01aa44aaSAndrew Rist  * software distributed under the License is distributed on an
15*01aa44aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*01aa44aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*01aa44aaSAndrew Rist  * specific language governing permissions and limitations
18*01aa44aaSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*01aa44aaSAndrew Rist  *************************************************************/
21*01aa44aaSAndrew Rist 
22*01aa44aaSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef TABITEMDESCRIPTOR_HXX
25cdf0e10cSrcweir #define TABITEMDESCRIPTOR_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "svtools/toolpanel/toolpanel.hxx"
28cdf0e10cSrcweir #include "svtools/toolpanel/tabitemcontent.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <tools/gen.hxx>
31cdf0e10cSrcweir #include <osl/diagnose.h>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <vector>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir //........................................................................
36cdf0e10cSrcweir namespace svt
37cdf0e10cSrcweir {
38cdf0e10cSrcweir //........................................................................
39cdf0e10cSrcweir 
40cdf0e10cSrcweir     //==================================================================================================================
41cdf0e10cSrcweir 	//= ItemDescriptor
42cdf0e10cSrcweir 	//==================================================================================================================
43cdf0e10cSrcweir     struct ItemDescriptor
44cdf0e10cSrcweir     {
45cdf0e10cSrcweir         PToolPanel      pPanel;
46cdf0e10cSrcweir         Rectangle       aCompleteArea;  // bounding area if the both text and icon are to be rendererd
47cdf0e10cSrcweir         Rectangle       aIconOnlyArea;  // bounding area if the icon is to be rendererd
48cdf0e10cSrcweir         Rectangle       aTextOnlyArea;  // bounding area if the text is to be rendererd
49cdf0e10cSrcweir         TabItemContent  eContent;
50cdf0e10cSrcweir             // content to be used for this particular item. Might differ from item content which has been set
51cdf0e10cSrcweir             // up for the complete control, in case not the complete content fits into the available space.
52cdf0e10cSrcweir 
ItemDescriptorsvt::ItemDescriptor53cdf0e10cSrcweir         ItemDescriptor()
54cdf0e10cSrcweir             :pPanel()
55cdf0e10cSrcweir             ,aCompleteArea()
56cdf0e10cSrcweir             ,aIconOnlyArea()
57cdf0e10cSrcweir             ,aTextOnlyArea()
58cdf0e10cSrcweir             ,eContent( TABITEM_IMAGE_AND_TEXT )
59cdf0e10cSrcweir         {
60cdf0e10cSrcweir         }
61cdf0e10cSrcweir 
GetRectsvt::ItemDescriptor62cdf0e10cSrcweir         const Rectangle& GetRect( const TabItemContent i_eItemContent ) const
63cdf0e10cSrcweir         {
64cdf0e10cSrcweir             OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "ItemDescriptor::GetRect: illegal value!" );
65cdf0e10cSrcweir 
66cdf0e10cSrcweir             return  ( i_eItemContent == TABITEM_IMAGE_AND_TEXT )
67cdf0e10cSrcweir                 ?   aCompleteArea
68cdf0e10cSrcweir                 :   (   ( i_eItemContent == TABITEM_TEXT_ONLY )
69cdf0e10cSrcweir                     ?   aTextOnlyArea
70cdf0e10cSrcweir                     :   aIconOnlyArea
71cdf0e10cSrcweir                     );
72cdf0e10cSrcweir         }
73cdf0e10cSrcweir 
GetCurrentRectsvt::ItemDescriptor74cdf0e10cSrcweir         const Rectangle& GetCurrentRect() const
75cdf0e10cSrcweir         {
76cdf0e10cSrcweir             return GetRect( eContent );
77cdf0e10cSrcweir         }
78cdf0e10cSrcweir     };
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     typedef ::std::vector< ItemDescriptor > ItemDescriptors;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 
83cdf0e10cSrcweir //........................................................................
84cdf0e10cSrcweir } // namespace svt
85cdf0e10cSrcweir //........................................................................
86cdf0e10cSrcweir 
87cdf0e10cSrcweir #endif // TABITEMDESCRIPTOR_HXX
88