SlideSorterCacheDisplay.hxx (398d7a35) | SlideSorterCacheDisplay.hxx (69cb9f15) |
---|---|
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_SLIDE_SORTER_CACHE_DISPLAY_HXX 25#define SD_TASKPANE_SLIDE_SORTER_CACHE_DISPLAY_HXX 26 27// Uncomment the define below to activate the slide sorter cache display in | 20 *************************************************************/ 21 22 23 24#ifndef SD_TASKPANE_SLIDE_SORTER_CACHE_DISPLAY_HXX 25#define SD_TASKPANE_SLIDE_SORTER_CACHE_DISPLAY_HXX 26 27// Uncomment the define below to activate the slide sorter cache display in |
28// the task pane. Visible slide previews are displayed as large rectangles, 29// off-screen previews as smaller rectangles. The color shows the state: | 28// the task pane. Visible slide previews are displayed as large rectangles, 29// off-screen previews as smaller rectangles. The color shows the state: |
30// green for no action, different shades of yellow for a request being in | 30// green for no action, different shades of yellow for a request being in |
31// the queue, pink for currently being rendered. A diagonal line indicates | 31// the queue, pink for currently being rendered. A diagonal line indicates |
32// that the preview is not up-to-date. 33#ifdef DEBUG 34//#define USE_SLIDE_SORTER_CACHE_DISPLAY 35#endif 36 37 38#ifdef USE_SLIDE_SORTER_CACHE_DISPLAY 39#include <taskpane/TaskPaneTreeNode.hxx> --- 10 unchanged lines hidden (view full) --- 50 51namespace sd { namespace toolpanel { 52 53class TreeNode; 54 55/** This panel demonstrates how to create a panel for the task pane. 56*/ 57class SlideSorterCacheDisplay | 32// that the preview is not up-to-date. 33#ifdef DEBUG 34//#define USE_SLIDE_SORTER_CACHE_DISPLAY 35#endif 36 37 38#ifdef USE_SLIDE_SORTER_CACHE_DISPLAY 39#include <taskpane/TaskPaneTreeNode.hxx> --- 10 unchanged lines hidden (view full) --- 50 51namespace sd { namespace toolpanel { 52 53class TreeNode; 54 55/** This panel demonstrates how to create a panel for the task pane. 56*/ 57class SlideSorterCacheDisplay |
58 : public TreeNode | 58 : public TreeNode |
59{ 60public: | 59{ 60public: |
61 SlideSorterCacheDisplay (const SdDrawDocument* pDocument); 62 virtual ~SlideSorterCacheDisplay (void); | 61 SlideSorterCacheDisplay (const SdDrawDocument* pDocument); 62 virtual ~SlideSorterCacheDisplay (void); |
63 | 63 |
64 void SetParentWindow (::Window* pParentWindow); | 64 void SetParentWindow (::Window* pParentWindow); |
65 | 65 |
66 virtual void Paint (const Rectangle& rBoundingBox); 67 virtual void Resize (void); | 66 virtual void Paint (const Rectangle& rBoundingBox); 67 virtual void Resize (void); |
68 | 68 |
69 static SlideSorterCacheDisplay* Instance (const SdDrawDocument* pDocument); 70 71 void SetPageCount (sal_Int32 nPageCount); 72 enum PageStatus { 73 NONE, 74 IN_QUEUE_PRIORITY_0, 75 IN_QUEUE_PRIORITY_1, 76 IN_QUEUE_PRIORITY_2, 77 RENDERING 78 }; 79 void SetPageStatus (sal_Int32 nPageIndex, PageStatus eStatus); 80 void SetPageVisibility (sal_Int32 nPageIndex, bool bVisible); 81 void SetUpToDate (sal_Int32 nPageIndex, bool bUpToDate); | 69 static SlideSorterCacheDisplay* Instance (const SdDrawDocument* pDocument); |
82 | 70 |
83 virtual Size GetPreferredSize (void); 84 virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); 85 virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); 86 virtual ::Window* GetWindow (void); 87 virtual bool IsResizable (void); 88 virtual bool IsExpandable (void) const; 89 virtual bool IsExpanded (void) const; | 71 void SetPageCount (sal_Int32 nPageCount); 72 enum PageStatus { 73 NONE, 74 IN_QUEUE_PRIORITY_0, 75 IN_QUEUE_PRIORITY_1, 76 IN_QUEUE_PRIORITY_2, 77 RENDERING 78 }; 79 void SetPageStatus (sal_Int32 nPageIndex, PageStatus eStatus); 80 void SetPageVisibility (sal_Int32 nPageIndex, bool bVisible); 81 void SetUpToDate (sal_Int32 nPageIndex, bool bUpToDate); |
90 | 82 |
83 virtual Size GetPreferredSize (void); 84 virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh); 85 virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth); 86 virtual ::Window* GetWindow (void); 87 virtual bool IsResizable (void); 88 virtual bool IsExpandable (void) const; 89 virtual bool IsExpanded (void) const; 90 |
|
91private: | 91private: |
92 static ::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*> maDisplays; 93 static void AddInstance (const SdDrawDocument* pDocument, SlideSorterCacheDisplay* pControl); 94 static void RemoveInstance (SlideSorterCacheDisplay* pControl); | 92 static ::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*> maDisplays; 93 static void AddInstance (const SdDrawDocument* pDocument, SlideSorterCacheDisplay* pControl); 94 static void RemoveInstance (SlideSorterCacheDisplay* pControl); |
95 | 95 |
96 ::Window* mpWindow; 97 sal_Int32 mnPageCount; 98 sal_Int32 mnColumnCount; 99 sal_Int32 mnRowCount; 100 Size maCellSize; 101 sal_Int32 mnHorizontalBorder; 102 sal_Int32 mnVerticalBorder; 103 sal_Int32 mnHorizontalGap; 104 sal_Int32 mnVerticalGap; | 96 ::Window* mpWindow; 97 sal_Int32 mnPageCount; 98 sal_Int32 mnColumnCount; 99 sal_Int32 mnRowCount; 100 Size maCellSize; 101 sal_Int32 mnHorizontalBorder; 102 sal_Int32 mnVerticalBorder; 103 sal_Int32 mnHorizontalGap; 104 sal_Int32 mnVerticalGap; |
105 | 105 |
106 class PageDescriptor 107 { 108 public: 109 PageStatus meStatus; 110 bool mbVisible; 111 bool mbUpToDate; 112 }; 113 typedef ::std::vector<PageDescriptor> PageDescriptorList; 114 PageDescriptorList maPageDescriptors; | 106 class PageDescriptor 107 { 108 public: 109 PageStatus meStatus; 110 bool mbVisible; 111 bool mbUpToDate; 112 }; 113 typedef ::std::vector<PageDescriptor> PageDescriptorList; 114 PageDescriptorList maPageDescriptors; |
115 | 115 |
116 Rectangle GetPageBox (sal_Int32 nPageIndex); | 116 Rectangle GetPageBox (sal_Int32 nPageIndex); |
117 | 117 |
118 void ProvideSize (sal_Int32 nPageIndex); | 118 void ProvideSize (sal_Int32 nPageIndex); |
119 | 119 |
120 void PaintPage (sal_Int32 nPageIndex); | 120 void PaintPage (sal_Int32 nPageIndex); |
121}; 122 123} } // end of namespace ::sd::toolpanel 124 125namespace { 126 127void SscdSetStatus (const SdrPage* pPage, | 121}; 122 123} } // end of namespace ::sd::toolpanel 124 125namespace { 126 127void SscdSetStatus (const SdrPage* pPage, |
128 ::sd::toolpanel::SlideSorterCacheDisplay::PageStatus eStatus) | 128 ::sd::toolpanel::SlideSorterCacheDisplay::PageStatus eStatus) |
129{ | 129{ |
130 ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay 131 = ::sd::toolpanel::SlideSorterCacheDisplay::Instance( 132 dynamic_cast<SdDrawDocument*>(pPage->GetModel())); 133 if (pDisplay != NULL) 134 pDisplay->SetPageStatus((pPage->GetPageNum()-1)/2, eStatus); | 130 ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay 131 = ::sd::toolpanel::SlideSorterCacheDisplay::Instance( 132 dynamic_cast<SdDrawDocument*>(pPage->GetModel())); 133 if (pDisplay != NULL) 134 pDisplay->SetPageStatus((pPage->GetPageNum()-1)/2, eStatus); |
135} 136 137void SscdSetRequestClass (const SdrPage* pPage, sal_Int32 nClass) 138{ | 135} 136 137void SscdSetRequestClass (const SdrPage* pPage, sal_Int32 nClass) 138{ |
139 sd::toolpanel::SlideSorterCacheDisplay::PageStatus eStatus; 140 switch (nClass) 141 { 142 case 0: 143 eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::IN_QUEUE_PRIORITY_0; break; 144 case 1: 145 eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::IN_QUEUE_PRIORITY_1; break; 146 case 2: 147 eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::IN_QUEUE_PRIORITY_2; break; 148 default: 149 eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::NONE; break; 150 } 151 SscdSetStatus(pPage,eStatus); | 139 sd::toolpanel::SlideSorterCacheDisplay::PageStatus eStatus; 140 switch (nClass) 141 { 142 case 0: 143 eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::IN_QUEUE_PRIORITY_0; break; 144 case 1: 145 eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::IN_QUEUE_PRIORITY_1; break; 146 case 2: 147 eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::IN_QUEUE_PRIORITY_2; break; 148 default: 149 eStatus = ::sd::toolpanel::SlideSorterCacheDisplay::NONE; break; 150 } 151 SscdSetStatus(pPage,eStatus); |
152} 153 154void SscdSetVisibility (const SdrModel* pModel, sal_Int32 nIndex, bool bVisible) 155{ | 152} 153 154void SscdSetVisibility (const SdrModel* pModel, sal_Int32 nIndex, bool bVisible) 155{ |
156 ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay 157 = ::sd::toolpanel::SlideSorterCacheDisplay::Instance( 158 dynamic_cast<const SdDrawDocument*>(pModel)); 159 if (pDisplay != NULL) 160 pDisplay->SetPageVisibility(nIndex, bVisible); | 156 ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay 157 = ::sd::toolpanel::SlideSorterCacheDisplay::Instance( 158 dynamic_cast<const SdDrawDocument*>(pModel)); 159 if (pDisplay != NULL) 160 pDisplay->SetPageVisibility(nIndex, bVisible); |
161} 162 163 164 165void SscdSetUpToDate (const SdrPage* pPage, bool bUpToDate) 166{ | 161} 162 163 164 165void SscdSetUpToDate (const SdrPage* pPage, bool bUpToDate) 166{ |
167 ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay 168 = ::sd::toolpanel::SlideSorterCacheDisplay::Instance( 169 dynamic_cast<const SdDrawDocument*>(pPage->GetModel())); 170 if (pDisplay != NULL) 171 pDisplay->SetUpToDate((pPage->GetPageNum()-1)/2, bUpToDate); | 167 ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay 168 = ::sd::toolpanel::SlideSorterCacheDisplay::Instance( 169 dynamic_cast<const SdDrawDocument*>(pPage->GetModel())); 170 if (pDisplay != NULL) 171 pDisplay->SetUpToDate((pPage->GetPageNum()-1)/2, bUpToDate); |
172} 173 174 175 | 172} 173 174 175 |
176#define SSCD_SET_REQUEST_CLASS(Page,RequestClass) \ 177 SscdSetRequestClass(Page,RequestClass) 178#define SSCD_SET_STATUS(RequestData,Status) \ 179 SscdSetStatus(RequestData,::sd::toolpanel::SlideSorterCacheDisplay::Status) | 176#define SSCD_SET_REQUEST_CLASS(Page,RequestClass) \ 177 SscdSetRequestClass(Page,RequestClass) 178#define SSCD_SET_STATUS(RequestData,Status) \ 179 SscdSetStatus(RequestData,::sd::toolpanel::SlideSorterCacheDisplay::Status) |
180#define SSCD_SET_VISIBILITY(Model,Index,Visible) \ | 180#define SSCD_SET_VISIBILITY(Model,Index,Visible) \ |
181 SscdSetVisibility(Model,Index,Visible) | 181 SscdSetVisibility(Model,Index,Visible) |
182#define SSCD_SET_UPTODATE(Page,UpToDate) \ | 182#define SSCD_SET_UPTODATE(Page,UpToDate) \ |
183 SscdSetUpToDate(Page,UpToDate) | 183 SscdSetUpToDate(Page,UpToDate) |
184 185 186} 187 188#else 189 | 184 185 186} 187 188#else 189 |
190#define SSCD_SET_REQUEST_CLASS(Page,RequestClass) 191#define SSCD_SET_STATUS(RequestData,Status) 192#define SSCD_SET_VISIBILITY(Model,Index,Visible) 193#define SSCD_SET_UPTODATE(Page,UpToDate) | 190#define SSCD_SET_REQUEST_CLASS(Page,RequestClass) 191#define SSCD_SET_STATUS(RequestData,Status) 192#define SSCD_SET_VISIBILITY(Model,Index,Visible) 193#define SSCD_SET_UPTODATE(Page,UpToDate) |
194 195#endif 196 197#endif | 194 195#endif 196 197#endif |