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 _SVX_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_ 23 #define _SVX_SIDEBAR_VALUESETWITHTEXT_CONTROL_HXX_ 24 25 #include "svx/svxdllapi.h" 26 27 #include <svtools/valueset.hxx> 28 #include <limits.h> 29 #include <com/sun/star/uno/Reference.h> 30 #include <com/sun/star/uno/Sequence.h> 31 #include <com/sun/star/lang/Locale.hpp> 32 33 #include <vcl/image.hxx> 34 35 #include <vector> 36 37 namespace com{namespace sun{ namespace star{ 38 namespace container{ 39 class XIndexAccess; 40 } 41 namespace beans{ 42 struct PropertyValue; 43 } 44 namespace text{ 45 class XNumberingFormatter; 46 } 47 }}} 48 49 namespace svx { namespace sidebar { 50 51 /** Specialization of class <ValueSet>. 52 This specialization allows is a one-columned ValueSet which allow 53 items containing an image and a text or a text and a second text. 54 55 Especially, used for sidebar related controls. 56 */ 57 class SVX_DLLPUBLIC ValueSetWithTextControl : public ValueSet 58 { 59 public: 60 // control type of specialized <ValueSet>: 61 // - image + text 62 // - text + text 63 enum tControlType 64 { 65 IMAGE_TEXT, 66 TEXT_TEXT 67 }; 68 69 ValueSetWithTextControl( 70 const tControlType eControlType, 71 Window* pParent, 72 const ResId& rResId); 73 74 virtual ~ValueSetWithTextControl(void); 75 76 // add item for control type IMAGE_TEXT 77 // if control type does not match IMAGE_TEXT no item is added. 78 // @param pSelectedItemImage 79 // selection item image is optional. if not provided, it is the same as the image item 80 // @param pItemHelpText 81 // help text is optional. if not provided, it is the same as the item text 82 void AddItem( 83 const Image& rItemImage, 84 const Image* pSelectedItemImage, 85 const XubString& rItemText, 86 const XubString* pItemHelpText ); 87 88 // replace item images for control type IMAGE_TEXT 89 void ReplaceItemImages( 90 const sal_uInt16 nItemId, 91 const Image& rItemImage, 92 const Image* pSelectedItemImage ); 93 94 // add item for control type TEXT_TEXT 95 // if control type does not match TEXT_TEXT no item is added. 96 // @param pItemHelpText 97 // help text is optional. if not provided, it is the same as the item text 98 void AddItem( 99 const XubString& rItemText, 100 const XubString& rItemText2, 101 const XubString* pItemHelpText ); 102 103 virtual void UserDraw( const UserDrawEvent& rUDEvt ); 104 105 private: 106 struct ValueSetWithTextItem 107 { 108 Image maItemImage; 109 Image maSelectedItemImage; 110 XubString maItemText; 111 XubString maItemText2; 112 }; 113 114 typedef ::std::vector< ValueSetWithTextItem > tItemList; 115 116 const tControlType meControlType; 117 tItemList maItems; 118 }; 119 120 class SVX_DLLPUBLIC SvxNumValueSet2 : public ValueSet 121 { 122 Color aLineColor; 123 Rectangle aOrgRect; 124 VirtualDevice* pVDev; 125 126 com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter; 127 com::sun::star::lang::Locale aLocale; 128 129 com::sun::star::uno::Sequence< 130 com::sun::star::uno::Sequence< 131 com::sun::star::beans::PropertyValue> > aNumSettings; 132 133 134 public: 135 SvxNumValueSet2( Window* pParent, const ResId& rResId); 136 ~SvxNumValueSet2(); 137 138 virtual void UserDraw( const UserDrawEvent& rUDEvt ); 139 140 141 void SetNumberingSettings( 142 const com::sun::star::uno::Sequence< 143 com::sun::star::uno::Sequence< 144 com::sun::star::beans::PropertyValue> >& aNum, 145 com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter, 146 const com::sun::star::lang::Locale& rLocale ); 147 }; 148 149 class SVX_DLLPUBLIC SvxNumValueSet3 : public ValueSet 150 { 151 public: 152 SvxNumValueSet3( Window* pParent, const ResId& rResId); 153 ~SvxNumValueSet3(); 154 155 virtual void UserDraw( const UserDrawEvent& rUDEvt ); 156 157 }; 158 159 } } // end of namespace svx::sidebar 160 161 #endif 162