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 SD_SIDEBAR_PANELS_PREVIEW_VALUE_SET_HXX 23 #define SD_SIDEBAR_PANELS_PREVIEW_VALUE_SET_HXX 24 25 #include <svtools/valueset.hxx> 26 27 28 namespace sd { namespace sidebar { 29 30 31 /** Adapt the svtools valueset to the needs of the master page controlls. 32 */ 33 class PreviewValueSet 34 : public ValueSet 35 { 36 public: 37 PreviewValueSet (::Window* pParent); 38 ~PreviewValueSet (void); 39 40 void SetRightMouseClickHandler (const Link& rLink); 41 virtual void Paint (const Rectangle& rRect); 42 virtual void Resize (void); 43 44 void SetPreviewSize (const Size& rSize); 45 46 sal_Int32 GetPreferredWidth (sal_Int32 nHeight); 47 sal_Int32 GetPreferredHeight (sal_Int32 nWidth); 48 49 /** Set the number of rows and columns according to the current number 50 of items. Call this method when new items have been inserted. 51 */ 52 void Rearrange (bool bForceRequestResize = false); 53 54 protected: 55 virtual void MouseButtonDown (const MouseEvent& rEvent); 56 57 private: 58 Link maRightMouseClickHandler; 59 Size maPreviewSize; 60 const int mnBorderWidth; 61 const int mnBorderHeight; 62 const int mnMaxColumnCount; 63 64 sal_uInt16 CalculateColumnCount (int nWidth) const; 65 sal_uInt16 CalculateRowCount (sal_uInt16 nColumnCount) const; 66 }; 67 68 } } // end of namespace sd::sidebar 69 70 #endif 71