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 controls. 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 Resize (void); 42 43 void SetPreviewSize (const Size& rSize); 44 45 sal_Int32 GetPreferredWidth (sal_Int32 nHeight); 46 sal_Int32 GetPreferredHeight (sal_Int32 nWidth); 47 48 /** Set the number of rows and columns according to the current number 49 of items. Call this method when new items have been inserted. 50 */ 51 void Rearrange (bool bForceRequestResize = false); 52 53 protected: 54 virtual void MouseButtonDown (const MouseEvent& rEvent); 55 56 private: 57 Link maRightMouseClickHandler; 58 Size maPreviewSize; 59 const int mnBorderWidth; 60 const int mnBorderHeight; 61 const int mnMaxColumnCount; 62 63 sal_uInt16 CalculateColumnCount (int nWidth) const; 64 sal_uInt16 CalculateRowCount (sal_uInt16 nColumnCount) const; 65 }; 66 67 } } // end of namespace sd::sidebar 68 69 #endif 70