1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _SV_TOOLBOX_H 29*cdf0e10cSrcweir #define _SV_TOOLBOX_H 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <tools/gen.hxx> 32*cdf0e10cSrcweir #include <tools/string.hxx> 33*cdf0e10cSrcweir #include <vcl/sv.h> 34*cdf0e10cSrcweir #include <vcl/image.hxx> 35*cdf0e10cSrcweir #include <vcl/toolbox.hxx> 36*cdf0e10cSrcweir #include <vcl/controllayout.hxx> 37*cdf0e10cSrcweir #include <vcl/ImageListProvider.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include <vector> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #define TB_DROPDOWNARROWWIDTH 11 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #define TB_MENUBUTTON_SIZE 12 44*cdf0e10cSrcweir #define TB_MENUBUTTON_OFFSET 2 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir #define TB_SMALLIMAGESIZE 16 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir #define TB_LARGEIMAGESIZE 26 49*cdf0e10cSrcweir #define TB_LARGEIMAGESIZE_INDUSTRIAL 24 50*cdf0e10cSrcweir #define TB_LARGEIMAGESIZE_CRYSTAL 22 51*cdf0e10cSrcweir #define TB_LARGEIMAGESIZE_OXYGEN 22 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir class Window; 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir // ---------------- 56*cdf0e10cSrcweir // - ImplToolItem - 57*cdf0e10cSrcweir // ---------------- 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir struct ImplToolItem 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir Window* mpWindow; 62*cdf0e10cSrcweir void* mpUserData; 63*cdf0e10cSrcweir Image maImage; 64*cdf0e10cSrcweir Image maHighImage; 65*cdf0e10cSrcweir long mnImageAngle; 66*cdf0e10cSrcweir bool mbMirrorMode; 67*cdf0e10cSrcweir XubString maText; 68*cdf0e10cSrcweir XubString maQuickHelpText; 69*cdf0e10cSrcweir XubString maHelpText; 70*cdf0e10cSrcweir String maCommandStr; 71*cdf0e10cSrcweir rtl::OString maHelpId; 72*cdf0e10cSrcweir Rectangle maRect; 73*cdf0e10cSrcweir Rectangle maCalcRect; 74*cdf0e10cSrcweir // the overall horizontal item size, including one or more of [image size + textlength + dropdown arrow] 75*cdf0e10cSrcweir Size maItemSize; 76*cdf0e10cSrcweir long mnSepSize; 77*cdf0e10cSrcweir long mnDropDownArrowWidth; 78*cdf0e10cSrcweir ToolBoxItemType meType; 79*cdf0e10cSrcweir ToolBoxItemBits mnBits; 80*cdf0e10cSrcweir TriState meState; 81*cdf0e10cSrcweir sal_uInt16 mnId; 82*cdf0e10cSrcweir sal_Bool mbEnabled:1, 83*cdf0e10cSrcweir mbVisible:1, 84*cdf0e10cSrcweir mbEmptyBtn:1, 85*cdf0e10cSrcweir mbShowWindow:1, 86*cdf0e10cSrcweir mbBreak:1, 87*cdf0e10cSrcweir mbVisibleText:1; // indicates if text will definitely be drawn, influences dropdown pos 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir ImplToolItem(); 90*cdf0e10cSrcweir ImplToolItem( sal_uInt16 nItemId, const Image& rImage, 91*cdf0e10cSrcweir ToolBoxItemBits nItemBits ); 92*cdf0e10cSrcweir ImplToolItem( sal_uInt16 nItemId, const XubString& rTxt, 93*cdf0e10cSrcweir ToolBoxItemBits nItemBits ); 94*cdf0e10cSrcweir ImplToolItem( sal_uInt16 nItemId, const Image& rImage, 95*cdf0e10cSrcweir const XubString& rTxt, 96*cdf0e10cSrcweir ToolBoxItemBits nItemBits ); 97*cdf0e10cSrcweir ~ImplToolItem(); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir ImplToolItem( const ImplToolItem& ); 100*cdf0e10cSrcweir ImplToolItem& operator=(const ImplToolItem&); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir // returns the size of a item, taking toolbox orientation into account 103*cdf0e10cSrcweir // the default size is the precomputed size for standard items 104*cdf0e10cSrcweir // ie those that are just ordinary buttons (no windows or text etc.) 105*cdf0e10cSrcweir // bCheckMaxWidth indicates that item windows must not exceed maxWidth in which case they will be painted as buttons 106*cdf0e10cSrcweir Size GetSize( sal_Bool bHorz, sal_Bool bCheckMaxWidth, long maxWidth, const Size& rDefaultSize ); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir // only useful for buttons: returns if the text or image part or both can be drawn according to current button drawing style 109*cdf0e10cSrcweir void DetermineButtonDrawStyle( ButtonType eButtonType, sal_Bool& rbImage, sal_Bool& rbText ) const; 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir // returns the rectangle which contains the drop down arrow 112*cdf0e10cSrcweir // or an empty rect if there is none 113*cdf0e10cSrcweir // bHorz denotes the toolbox alignment 114*cdf0e10cSrcweir Rectangle GetDropDownRect( sal_Bool bHorz ) const; 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir // returns sal_True if the toolbar item is currently clipped, which can happen for docked toolbars 117*cdf0e10cSrcweir sal_Bool IsClipped() const; 118*cdf0e10cSrcweir }; 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir namespace vcl 121*cdf0e10cSrcweir { 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir struct ToolBoxLayoutData : public ControlLayoutData 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir std::vector< sal_uInt16 > m_aLineItemIds; 126*cdf0e10cSrcweir std::vector< sal_uInt16 > m_aLineItemPositions; 127*cdf0e10cSrcweir }; 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir } /* namespace vcl */ 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir struct ImplToolBoxPrivateData 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir vcl::ToolBoxLayoutData* m_pLayoutData; 136*cdf0e10cSrcweir std::vector< ImplToolItem > m_aItems; 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir ImplToolBoxPrivateData(); 139*cdf0e10cSrcweir ~ImplToolBoxPrivateData(); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir void ImplClearLayoutData() { delete m_pLayoutData; m_pLayoutData = NULL; } 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir // called when dropdown items are clicked 144*cdf0e10cSrcweir Link maDropdownClickHdl; 145*cdf0e10cSrcweir Timer maDropdownTimer; // for opening dropdown items on "long click" 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir // large or small buttons ? 148*cdf0e10cSrcweir ToolBoxButtonSize meButtonSize; 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // the optional custom menu 151*cdf0e10cSrcweir PopupMenu* mpMenu; 152*cdf0e10cSrcweir sal_uInt16 maMenuType; 153*cdf0e10cSrcweir sal_uIntPtr mnEventId; 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir // called when menu button is clicked and before the popup menu is executed 156*cdf0e10cSrcweir Link maMenuButtonHdl; 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir // a dummy item representing the custom menu button 159*cdf0e10cSrcweir ImplToolItem maMenubuttonItem; 160*cdf0e10cSrcweir long mnMenuButtonWidth; 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir Wallpaper maDisplayBackground; 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir // support for highcontrast 165*cdf0e10cSrcweir vcl::IImageListProvider* mpImageListProvider; 166*cdf0e10cSrcweir vcl::ImageListType meImageListType; 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir sal_Bool mbIsLocked:1, // keeps last lock state from ImplDockingWindowWrapper 169*cdf0e10cSrcweir mbAssumeDocked:1, // only used during calculations to override current floating/popup mode 170*cdf0e10cSrcweir mbAssumeFloating:1, 171*cdf0e10cSrcweir mbAssumePopupMode:1, 172*cdf0e10cSrcweir mbKeyInputDisabled:1, // no KEY input if all items disabled, closing/docking will be allowed though 173*cdf0e10cSrcweir mbIsPaintLocked:1, // don't allow paints 174*cdf0e10cSrcweir mbMenubuttonSelected:1, // menu button is highlighted 175*cdf0e10cSrcweir mbPageScroll:1, // determines if we scroll a page at a time 176*cdf0e10cSrcweir mbNativeButtons:1, // system supports native toolbar buttons 177*cdf0e10cSrcweir mbWillUsePopupMode:1, // this toolbox will be opened in popup mode 178*cdf0e10cSrcweir mbDropDownByKeyboard:1; // tells whether a dropdown was started by key input 179*cdf0e10cSrcweir }; 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir #endif // _SV_TOOLBOX_H 183