1/**************************************************************
| 1/**************************************************************
|
2 *
| 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
| 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 *
| 10 *
|
11 * http://www.apache.org/licenses/LICENSE-2.0
| 11 * http://www.apache.org/licenses/LICENSE-2.0
|
12 *
| 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.
| 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 *
| 19 *
|
20 *************************************************************/ 21 22 23 24#ifndef SD_TASKPANE_SUB_TOOL_PANEL_HXX 25#define SD_TASKPANE_SUB_TOOL_PANEL_HXX 26 27#include "taskpane/TaskPaneTreeNode.hxx" 28 29#include <vcl/ctrl.hxx> 30#include <vcl/scrbar.hxx> 31#include <memory> 32#include <vector> 33 34 35class Window; 36 37namespace sd { namespace toolpanel { 38
| 20 *************************************************************/ 21 22 23 24#ifndef SD_TASKPANE_SUB_TOOL_PANEL_HXX 25#define SD_TASKPANE_SUB_TOOL_PANEL_HXX 26 27#include "taskpane/TaskPaneTreeNode.hxx" 28 29#include <vcl/ctrl.hxx> 30#include <vcl/scrbar.hxx> 31#include <memory> 32#include <vector> 33 34 35class Window; 36 37namespace sd { namespace toolpanel { 38
|
39/** The sub tool panel is in function similar to the tool panel. It 40 differes in two points. First, it is a control that can be used 41 as element in a tool panel and thus is actually a nested tool 42 panel.
| 39/** The sub tool panel is in function similar to the tool panel. It 40 differs in two points. First, it is a control that can be used 41 as element in a tool panel and thus is actually a nested tool 42 panel.
|
43
| 43
|
44 <p>Secondly, it formats its elements differently. The actual controls 45 are placed one below the other with a title bar above each control. 46 Clicking on the title bar expands or collapses the control. When there 47 is not enough space then scroll bars are shown.</p>
| 44 <p>Secondly, it formats its elements differently. The actual controls 45 are placed one below the other with a title bar above each control. 46 Clicking on the title bar expands or collapses the control. When there 47 is not enough space then scroll bars are shown.</p>
|
48
| 48
|
49 <p>To avoid flickering when painting the sub tool panel the background 50 is made transparent and painting it is done by this class. While 51 layouting its children it remembers the gaps between children and stores 52 them in maStripeList. In Paint() those gaps as well as the border 53 around all children are painted in the background color.</p>
| 49 <p>To avoid flickering when painting the sub tool panel the background 50 is made transparent and painting it is done by this class. While 51 layouting its children it remembers the gaps between children and stores 52 them in maStripeList. In Paint() those gaps as well as the border 53 around all children are painted in the background color.</p>
|
54*/ 55class SubToolPanel
| 54*/ 55class SubToolPanel
|
56 : public Control, 57 public TreeNode
| 56 : public Control, 57 public TreeNode
|
58{ 59public:
| 58{ 59public:
|
60 /** Create a new sub tool panel with the given window as its 61 parent. This will usually be a child window. 62 */ 63 SubToolPanel (Window& i_rParentWindow); 64 virtual ~SubToolPanel (void);
| 60 /** Create a new sub tool panel with the given window as its 61 parent. This will usually be a child window. 62 */ 63 SubToolPanel (Window& i_rParentWindow); 64 virtual ~SubToolPanel (void);
|
65
| 65
|
66 virtual void Paint (const Rectangle& rRect);
| 66 virtual void Paint (const Rectangle& rRect);
|
67
| 67
|
68 /** Initiate a rearrangement of the controls and title bars. 69 */ 70 virtual void Resize (void);
| 68 /** Initiate a rearrangement of the controls and title bars. 69 */ 70 virtual void Resize (void);
|
71
| 71
|
72 virtual void RequestResize (void);
| 72 virtual void RequestResize (void);
|
73
| 73
|
74 virtual Size GetPreferredSize (void); 75 virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight); 76 virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); 77 virtual bool IsResizable (void); 78 virtual ::Window* GetWindow (void); 79 virtual sal_Int32 GetMinimumWidth (void);
| 74 virtual Size GetPreferredSize (void); 75 virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight); 76 virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); 77 virtual bool IsResizable (void); 78 virtual ::Window* GetWindow (void); 79 virtual sal_Int32 GetMinimumWidth (void);
|
80
| 80
|
81 virtual void ExpandControl ( 82 TreeNode* pControl, 83 bool bExpansionState);
| 81 virtual void ExpandControl ( 82 TreeNode* pControl, 83 bool bExpansionState);
|
84
| 84
|
85 virtual ::com::sun::star::uno::Reference< 86 ::com::sun::star::accessibility::XAccessible> CreateAccessibleObject ( 87 const ::com::sun::star::uno::Reference< 88 ::com::sun::star::accessibility::XAccessible>& rxParent);
| 85 virtual ::com::sun::star::uno::Reference< 86 ::com::sun::star::accessibility::XAccessible> CreateAccessibleObject ( 87 const ::com::sun::star::uno::Reference< 88 ::com::sun::star::accessibility::XAccessible>& rxParent);
|
89 90 using Window::GetWindow; 91private:
| 89 90 using Window::GetWindow; 91private:
|
92 ::Window maWindowFiller; 93 bool mbIsRearrangePending; 94 bool mbIsLayoutPending; 95 sal_uInt32 mnChildrenWidth; 96 /// Border above top-most and below bottom-most control. 97 const int mnVerticalBorder; 98 /// Gap between two controls. 99 const int mnVerticalGap; 100 /// Border at the left and right of the controls. 101 const int mnHorizontalBorder; 102 /** List of horizontal stripes that is created from the gaps between 103 children when they are layouted. The stripes are painted in Paint() 104 to fill the space around the children. 105 */ 106 typedef ::std::vector< ::std::pair<int,int> > StripeList; 107 StripeList maStripeList;
| 92 ::Window maWindowFiller; 93 bool mbIsRearrangePending; 94 bool mbIsLayoutPending; 95 sal_uInt32 mnChildrenWidth; 96 /// Border above top-most and below bottom-most control. 97 const int mnVerticalBorder; 98 /// Gap between two controls. 99 const int mnVerticalGap; 100 /// Border at the left and right of the controls. 101 const int mnHorizontalBorder; 102 /** List of horizontal stripes that is created from the gaps between 103 children when they are layouted. The stripes are painted in Paint() 104 to fill the space around the children. 105 */ 106 typedef ::std::vector< ::std::pair<int,int> > StripeList; 107 StripeList maStripeList;
|
108
| 108
|
109 /** Calculate position, size, and visibility of the controls. 110 Call this method after the list of controls, their expansion 111 state, or the size of the sub panel has changed. 112 */ 113 void Rearrange (void);
| 109 /** Calculate position, size, and visibility of the controls. 110 Call this method after the list of controls, their expansion 111 state, or the size of the sub panel has changed. 112 */ 113 void Rearrange (void);
|
114
| 114
|
115 /** Determine the minimal size that is necessary to show the controls 116 one over the other. It may be smaller than the available area. 117 */ 118 Size GetRequiredSize (void);
| 115 /** Determine the minimal size that is necessary to show the controls 116 one over the other. It may be smaller than the available area. 117 */ 118 Size GetRequiredSize (void);
|
119
| 119
|
120 /** Place the child windows one above the other and return the size of 121 the bounding box. 122 */ 123 sal_Int32 LayoutChildren (void);
| 120 /** Place the child windows one above the other and return the size of 121 the bounding box. 122 */ 123 sal_Int32 LayoutChildren (void);
|
124
| 124
|
125 DECL_LINK(WindowEventListener, VclSimpleEvent*);
| 125 DECL_LINK(WindowEventListener, VclSimpleEvent*);
|
126}; 127 128} } // end of namespace ::sd::toolpanel 129 130#endif
| 126}; 127 128} } // end of namespace ::sd::toolpanel 129 130#endif
|