1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PreviewValueSet.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_TOOLPANEL_PREVIEW_VALUE_SET_HXX
32 #define SD_TOOLPANEL_PREVIEW_VALUE_SET_HXX
34 #include <svtools/valueset.hxx>
37 namespace sd
{ namespace toolpanel
{
41 namespace sd
{ namespace toolpanel
{ namespace controls
{
44 /** Adapt the svtools valueset to the needs of the master page controlls.
50 PreviewValueSet (TreeNode
* pParent
);
51 ~PreviewValueSet (void);
53 void SetRightMouseClickHandler (const Link
& rLink
);
54 virtual void Paint (const Rectangle
& rRect
);
55 virtual void Resize (void);
57 /** When a request for the display of a context menu is made to this
58 method then that request is forwarded via the ContextMenuCallback.
59 This way the owning class can handle the context menu without having
60 to be derived from this class.
61 Use SetContextMenuCallback to set or rest the handler.
63 virtual void Command (const CommandEvent
& rEvent
);
65 void SetPreviewSize (const Size
& rSize
);
67 sal_Int32
GetPreferredWidth (sal_Int32 nHeight
);
68 sal_Int32
GetPreferredHeight (sal_Int32 nWidth
);
70 /** Set the number of rows and columns according to the current number
71 of items. Call this method when new items have been inserted.
73 void Rearrange (bool bForceRequestResize
= false);
75 /** Set the callback function to which requests for context menus are
76 forewarded. Call with an empty Link to reset the callback
79 void SetContextMenuCallback (const Link
& rLink
);
82 virtual void MouseButtonDown (const MouseEvent
& rEvent
);
85 Link maRightMouseClickHandler
;
86 Link maContextMenuCallback
;
89 const int mnBorderWidth
;
90 const int mnBorderHeight
;
91 const int mnMaxColumnCount
;
93 USHORT
CalculateColumnCount (int nWidth
) const;
94 USHORT
CalculateRowCount (USHORT nColumnCount
) const;
97 } } } // end of namespace ::sd::toolpanel::controls