15900e8ecSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 35900e8ecSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 45900e8ecSAndrew Rist * or more contributor license agreements. See the NOTICE file 55900e8ecSAndrew Rist * distributed with this work for additional information 65900e8ecSAndrew Rist * regarding copyright ownership. The ASF licenses this file 75900e8ecSAndrew Rist * to you under the Apache License, Version 2.0 (the 85900e8ecSAndrew Rist * "License"); you may not use this file except in compliance 95900e8ecSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 115900e8ecSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 135900e8ecSAndrew Rist * Unless required by applicable law or agreed to in writing, 145900e8ecSAndrew Rist * software distributed under the License is distributed on an 155900e8ecSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 165900e8ecSAndrew Rist * KIND, either express or implied. See the License for the 175900e8ecSAndrew Rist * specific language governing permissions and limitations 185900e8ecSAndrew Rist * under the License. 19cdf0e10cSrcweir * 205900e8ecSAndrew Rist *************************************************************/ 215900e8ecSAndrew Rist 225900e8ecSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svtools.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #ifndef GCC 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir //------------------------------------------------------------------ 32cdf0e10cSrcweir 33cdf0e10cSrcweir //#include "Svitems.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include "property.hxx" 36cdf0e10cSrcweir /* 37cdf0e10cSrcweir #include "property.hrc" 38cdf0e10cSrcweir #include "Scresid.hxx" 39cdf0e10cSrcweir */ 40cdf0e10cSrcweir #define FRAME_OFFSET 4 41cdf0e10cSrcweir 42cdf0e10cSrcweir 43cdf0e10cSrcweir SvXPropertyControl::SvXPropertyControl( Window* pParent, WinBits nWinStyle) 44cdf0e10cSrcweir : Control(pParent,nWinStyle) 45cdf0e10cSrcweir { 46cdf0e10cSrcweir } 47cdf0e10cSrcweir 48cdf0e10cSrcweir SvXPropertyControl::SvXPropertyControl( Window* pParent, const ResId& rResId ) 49cdf0e10cSrcweir : Control(pParent,rResId ) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir } 52cdf0e10cSrcweir 53cdf0e10cSrcweir //------------------------------------------------------------------ 54cdf0e10cSrcweir 55cdf0e10cSrcweir SvXPropertyEdit::SvXPropertyEdit( Window* pParent, WinBits nWinStyle) 56cdf0e10cSrcweir : SvXPropertyControl(pParent,nWinStyle), 57cdf0e10cSrcweir aEdit(this,WB_BORDER | WB_TABSTOP) 58cdf0e10cSrcweir { 59cdf0e10cSrcweir pListener=NULL; 60cdf0e10cSrcweir aEdit.SetModifyHdl( 61cdf0e10cSrcweir LINK( this, SvXPropertyEdit, ModifiedHdl )); 62cdf0e10cSrcweir aEdit.SetGetFocusHdl( 63cdf0e10cSrcweir LINK( this, SvXPropertyEdit, GetFocusHdl)); 64cdf0e10cSrcweir aEdit.SetLoseFocusHdl( 65cdf0e10cSrcweir LINK( this, SvXPropertyEdit, LoseFocusHdl)); 66cdf0e10cSrcweir 67cdf0e10cSrcweir aEdit.Show(); 68cdf0e10cSrcweir } 69cdf0e10cSrcweir 70cdf0e10cSrcweir SvXPropertyEdit::SvXPropertyEdit( Window* pParent, const ResId& rResId) 71cdf0e10cSrcweir : SvXPropertyControl(pParent,rResId), 72cdf0e10cSrcweir aEdit(this,WB_BORDER | WB_TABSTOP) 73cdf0e10cSrcweir { 74cdf0e10cSrcweir pListener=NULL; 75cdf0e10cSrcweir aEdit.SetModifyHdl( 76cdf0e10cSrcweir LINK( this, SvXPropertyEdit, ModifiedHdl )); 77cdf0e10cSrcweir aEdit.SetGetFocusHdl( 78cdf0e10cSrcweir LINK( this, SvXPropertyEdit, GetFocusHdl)); 79cdf0e10cSrcweir aEdit.SetLoseFocusHdl( 80cdf0e10cSrcweir LINK( this, SvXPropertyEdit, LoseFocusHdl)); 81cdf0e10cSrcweir 82cdf0e10cSrcweir Size aSize=GetSizePixel(); 83cdf0e10cSrcweir SetCtrSize(aSize); 84cdf0e10cSrcweir aEdit.Show(); 85cdf0e10cSrcweir } 86cdf0e10cSrcweir 87cdf0e10cSrcweir void SvXPropertyEdit::SetSvXPropertyCtrListener(SvXPropertyCtrListener* pCtrListener) 88cdf0e10cSrcweir { 89cdf0e10cSrcweir pListener=pCtrListener; 90cdf0e10cSrcweir } 91cdf0e10cSrcweir 92cdf0e10cSrcweir SvXPropertyCtrListener* SvXPropertyEdit::GetSvXPropertyCtrListener() 93cdf0e10cSrcweir { 94cdf0e10cSrcweir return pListener; 95cdf0e10cSrcweir } 96cdf0e10cSrcweir 97cdf0e10cSrcweir 98cdf0e10cSrcweir void SvXPropertyEdit::SetCtrSize(const Size& rSize) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir SetSizePixel(rSize); 101cdf0e10cSrcweir Size aSize=GetOutputSizePixel(); 102cdf0e10cSrcweir Point aPos(0,0); 103cdf0e10cSrcweir aEdit.SetPosPixel(aPos); 104cdf0e10cSrcweir aEdit.SetSizePixel(aSize); 105cdf0e10cSrcweir } 106cdf0e10cSrcweir 107cdf0e10cSrcweir void SvXPropertyEdit::SetLocked(sal_Bool bLocked) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir if(bLocked) 110cdf0e10cSrcweir Disable(); 111cdf0e10cSrcweir else 112cdf0e10cSrcweir Enable(); 113cdf0e10cSrcweir } 114cdf0e10cSrcweir 115cdf0e10cSrcweir void SvXPropertyEdit::SetProperty(const String &rString) 116cdf0e10cSrcweir { 117cdf0e10cSrcweir aEdit.SetText(rString); 118cdf0e10cSrcweir } 119cdf0e10cSrcweir 120cdf0e10cSrcweir String SvXPropertyEdit::GetProperty() const 121cdf0e10cSrcweir { 122cdf0e10cSrcweir return aEdit.GetText(); 123cdf0e10cSrcweir } 124cdf0e10cSrcweir 125cdf0e10cSrcweir sal_Bool SvXPropertyEdit::HasList() 126cdf0e10cSrcweir { 127cdf0e10cSrcweir return sal_False; 128cdf0e10cSrcweir }; 129cdf0e10cSrcweir 130cdf0e10cSrcweir 131cdf0e10cSrcweir void SvXPropertyEdit::ClearList() 132cdf0e10cSrcweir { 133cdf0e10cSrcweir return; 134cdf0e10cSrcweir } 135cdf0e10cSrcweir void SvXPropertyEdit::InsertEntry( const String&,sal_uInt16 ) 136cdf0e10cSrcweir { 137cdf0e10cSrcweir return; 138cdf0e10cSrcweir } 139cdf0e10cSrcweir 140cdf0e10cSrcweir void SvXPropertyEdit::SetMyName(const String &rString) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir aName=rString; 143cdf0e10cSrcweir } 144cdf0e10cSrcweir 145cdf0e10cSrcweir String SvXPropertyEdit::GetMyName()const 146cdf0e10cSrcweir { 147cdf0e10cSrcweir return aName; 148cdf0e10cSrcweir } 149cdf0e10cSrcweir 150cdf0e10cSrcweir void SvXPropertyEdit::SetMyData(void* pDat) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir pData=pDat; 153cdf0e10cSrcweir } 154cdf0e10cSrcweir 155cdf0e10cSrcweir void* SvXPropertyEdit::GetMyData() 156cdf0e10cSrcweir { 157cdf0e10cSrcweir return pData; 158cdf0e10cSrcweir } 159cdf0e10cSrcweir 160cdf0e10cSrcweir 161cdf0e10cSrcweir IMPL_LINK( SvXPropertyEdit, ModifiedHdl, Edit*, EMPTYARG ) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir if(pListener!=NULL) 164cdf0e10cSrcweir pListener->Modified(this); 165cdf0e10cSrcweir return 0; 166cdf0e10cSrcweir } 167cdf0e10cSrcweir 168cdf0e10cSrcweir IMPL_LINK( SvXPropertyEdit, GetFocusHdl, Edit*, EMPTYARG ) 169cdf0e10cSrcweir { 170cdf0e10cSrcweir if(pListener!=NULL) 171cdf0e10cSrcweir pListener->GetFocus(this); 172cdf0e10cSrcweir return 0; 173cdf0e10cSrcweir } 174cdf0e10cSrcweir 175cdf0e10cSrcweir IMPL_LINK( SvXPropertyEdit, LoseFocusHdl, Edit*, EMPTYARG ) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir if(pListener!=NULL) 178cdf0e10cSrcweir pListener->LoseFocus(this); 179cdf0e10cSrcweir return 0; 180cdf0e10cSrcweir } 181cdf0e10cSrcweir 182cdf0e10cSrcweir //------------------------------------------------------------------ 183cdf0e10cSrcweir 184cdf0e10cSrcweir SvXPropertyListBox::SvXPropertyListBox( Window* pParent, WinBits nWinStyle) 185cdf0e10cSrcweir : SvXPropertyControl(pParent,nWinStyle), 186cdf0e10cSrcweir aListBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir pListener=NULL; 189cdf0e10cSrcweir aListBox.SetSelectHdl( 190cdf0e10cSrcweir LINK( this, SvXPropertyListBox, ModifiedHdl )); 191cdf0e10cSrcweir aListBox.SetGetFocusHdl( 192cdf0e10cSrcweir LINK( this, SvXPropertyListBox, GetFocusHdl)); 193cdf0e10cSrcweir aListBox.SetLoseFocusHdl( 194cdf0e10cSrcweir LINK( this, SvXPropertyListBox, LoseFocusHdl)); 195cdf0e10cSrcweir aListBox.Show(); 196cdf0e10cSrcweir } 197cdf0e10cSrcweir 198cdf0e10cSrcweir SvXPropertyListBox::SvXPropertyListBox( Window* pParent, const ResId& rResId) 199cdf0e10cSrcweir : SvXPropertyControl(pParent,rResId), 200cdf0e10cSrcweir aListBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP) 201cdf0e10cSrcweir { 202cdf0e10cSrcweir pListener=NULL; 203cdf0e10cSrcweir aListBox.SetSelectHdl( 204cdf0e10cSrcweir LINK( this, SvXPropertyListBox, ModifiedHdl )); 205cdf0e10cSrcweir aListBox.SetGetFocusHdl( 206cdf0e10cSrcweir LINK( this, SvXPropertyListBox, GetFocusHdl)); 207cdf0e10cSrcweir aListBox.SetLoseFocusHdl( 208cdf0e10cSrcweir LINK( this, SvXPropertyListBox, LoseFocusHdl)); 209cdf0e10cSrcweir 210cdf0e10cSrcweir Size aSize=GetSizePixel(); 211cdf0e10cSrcweir SetCtrSize(aSize); 212cdf0e10cSrcweir aListBox.Show(); 213cdf0e10cSrcweir } 214cdf0e10cSrcweir 215cdf0e10cSrcweir void SvXPropertyListBox::SetSvXPropertyCtrListener(SvXPropertyCtrListener* pCtrListener) 216cdf0e10cSrcweir { 217cdf0e10cSrcweir pListener=pCtrListener; 218cdf0e10cSrcweir } 219cdf0e10cSrcweir 220cdf0e10cSrcweir SvXPropertyCtrListener* SvXPropertyListBox::GetSvXPropertyCtrListener() 221cdf0e10cSrcweir { 222cdf0e10cSrcweir return pListener; 223cdf0e10cSrcweir } 224cdf0e10cSrcweir 225cdf0e10cSrcweir 226cdf0e10cSrcweir void SvXPropertyListBox::SetCtrSize(const Size& rSize) 227cdf0e10cSrcweir { 228cdf0e10cSrcweir SetSizePixel(rSize); 229cdf0e10cSrcweir Size aSize=GetOutputSizePixel(); 230cdf0e10cSrcweir Point aPos(0,0); 231cdf0e10cSrcweir aListBox.SetPosPixel(aPos); 232cdf0e10cSrcweir aListBox.SetSizePixel(aSize); 233cdf0e10cSrcweir } 234cdf0e10cSrcweir 235cdf0e10cSrcweir void SvXPropertyListBox::SetLocked(sal_Bool bLocked) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir if(bLocked) 238cdf0e10cSrcweir Disable(); 239cdf0e10cSrcweir else 240cdf0e10cSrcweir Enable(); 241cdf0e10cSrcweir } 242cdf0e10cSrcweir 243cdf0e10cSrcweir void SvXPropertyListBox::SetProperty(const String &rString) 244cdf0e10cSrcweir { 245cdf0e10cSrcweir aListBox.SelectEntry(rString); 246cdf0e10cSrcweir } 247cdf0e10cSrcweir 248cdf0e10cSrcweir String SvXPropertyListBox::GetProperty()const 249cdf0e10cSrcweir { 250cdf0e10cSrcweir return aListBox.GetSelectEntry(); 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir sal_Bool SvXPropertyListBox::HasList() 254cdf0e10cSrcweir { 255cdf0e10cSrcweir return sal_True; 256cdf0e10cSrcweir } 257cdf0e10cSrcweir 258cdf0e10cSrcweir 259cdf0e10cSrcweir void SvXPropertyListBox::ClearList() 260cdf0e10cSrcweir { 261cdf0e10cSrcweir aListBox.Clear(); 262cdf0e10cSrcweir } 263cdf0e10cSrcweir 264cdf0e10cSrcweir void SvXPropertyListBox::InsertEntry( const String& rString,sal_uInt16 nPos) 265cdf0e10cSrcweir { 266cdf0e10cSrcweir aListBox.InsertEntry(rString,nPos); 267cdf0e10cSrcweir } 268cdf0e10cSrcweir 269cdf0e10cSrcweir void SvXPropertyListBox::SetMyName(const String &rString) 270cdf0e10cSrcweir { 271cdf0e10cSrcweir aName=rString; 272cdf0e10cSrcweir } 273cdf0e10cSrcweir 274cdf0e10cSrcweir String SvXPropertyListBox::GetMyName()const 275cdf0e10cSrcweir { 276cdf0e10cSrcweir return aName; 277cdf0e10cSrcweir } 278cdf0e10cSrcweir 279cdf0e10cSrcweir void SvXPropertyListBox::SetMyData(void* pDat) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir pData=pDat; 282cdf0e10cSrcweir } 283cdf0e10cSrcweir 284cdf0e10cSrcweir void* SvXPropertyListBox::GetMyData() 285cdf0e10cSrcweir { 286cdf0e10cSrcweir return pData; 287cdf0e10cSrcweir } 288cdf0e10cSrcweir 289cdf0e10cSrcweir IMPL_LINK( SvXPropertyListBox, ModifiedHdl, ListBox*, EMPTYARG ) 290cdf0e10cSrcweir { 291cdf0e10cSrcweir if(pListener!=NULL) 292cdf0e10cSrcweir pListener->Modified(this); 293cdf0e10cSrcweir return 0; 294cdf0e10cSrcweir } 295cdf0e10cSrcweir 296cdf0e10cSrcweir IMPL_LINK( SvXPropertyListBox, GetFocusHdl, ListBox*, EMPTYARG ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir if(pListener!=NULL) 299cdf0e10cSrcweir pListener->GetFocus(this); 300cdf0e10cSrcweir return 0; 301cdf0e10cSrcweir } 302cdf0e10cSrcweir 303cdf0e10cSrcweir IMPL_LINK( SvXPropertyListBox, LoseFocusHdl, ListBox*, EMPTYARG ) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir if(pListener!=NULL) 306cdf0e10cSrcweir pListener->LoseFocus(this); 307cdf0e10cSrcweir return 0; 308cdf0e10cSrcweir } 309cdf0e10cSrcweir 310cdf0e10cSrcweir //------------------------------------------------------------------ 311cdf0e10cSrcweir 312cdf0e10cSrcweir 313cdf0e10cSrcweir SvXPropertyComboBox::SvXPropertyComboBox( Window* pParent, WinBits nWinStyle) 314cdf0e10cSrcweir : SvXPropertyControl(pParent,nWinStyle), 315cdf0e10cSrcweir aComboBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP) 316cdf0e10cSrcweir { 317cdf0e10cSrcweir pListener=NULL; 318cdf0e10cSrcweir aComboBox.SetModifyHdl( 319cdf0e10cSrcweir LINK( this, SvXPropertyComboBox, ModifiedHdl )); 320cdf0e10cSrcweir aComboBox.SetGetFocusHdl( 321cdf0e10cSrcweir LINK( this, SvXPropertyComboBox, GetFocusHdl)); 322cdf0e10cSrcweir aComboBox.SetLoseFocusHdl( 323cdf0e10cSrcweir LINK( this, SvXPropertyComboBox, LoseFocusHdl)); 324cdf0e10cSrcweir aComboBox.Show(); 325cdf0e10cSrcweir } 326cdf0e10cSrcweir 327cdf0e10cSrcweir SvXPropertyComboBox::SvXPropertyComboBox( Window* pParent, const ResId& rResId) 328cdf0e10cSrcweir : SvXPropertyControl(pParent,rResId), 329cdf0e10cSrcweir aComboBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP) 330cdf0e10cSrcweir { 331cdf0e10cSrcweir pListener=NULL; 332cdf0e10cSrcweir aComboBox.SetModifyHdl( 333cdf0e10cSrcweir LINK( this, SvXPropertyComboBox, ModifiedHdl )); 334cdf0e10cSrcweir aComboBox.SetGetFocusHdl( 335cdf0e10cSrcweir LINK( this, SvXPropertyComboBox, GetFocusHdl)); 336cdf0e10cSrcweir aComboBox.SetLoseFocusHdl( 337cdf0e10cSrcweir LINK( this, SvXPropertyComboBox, LoseFocusHdl)); 338cdf0e10cSrcweir 339cdf0e10cSrcweir Size aSize=GetSizePixel(); 340cdf0e10cSrcweir SetCtrSize(aSize); 341cdf0e10cSrcweir aComboBox.Show(); 342cdf0e10cSrcweir } 343cdf0e10cSrcweir 344cdf0e10cSrcweir void SvXPropertyComboBox::SetLocked(sal_Bool bLocked) 345cdf0e10cSrcweir { 346cdf0e10cSrcweir if(bLocked) 347cdf0e10cSrcweir Disable(); 348cdf0e10cSrcweir else 349cdf0e10cSrcweir Enable(); 350cdf0e10cSrcweir } 351cdf0e10cSrcweir 352cdf0e10cSrcweir void SvXPropertyComboBox::SetSvXPropertyCtrListener(SvXPropertyCtrListener* pCtrListener) 353cdf0e10cSrcweir { 354cdf0e10cSrcweir pListener=pCtrListener; 355cdf0e10cSrcweir } 356cdf0e10cSrcweir 357cdf0e10cSrcweir SvXPropertyCtrListener* SvXPropertyComboBox::GetSvXPropertyCtrListener() 358cdf0e10cSrcweir { 359cdf0e10cSrcweir return pListener; 360cdf0e10cSrcweir } 361cdf0e10cSrcweir 362cdf0e10cSrcweir 363cdf0e10cSrcweir void SvXPropertyComboBox::SetCtrSize(const Size& rSize) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir SetSizePixel(rSize); 366cdf0e10cSrcweir Size aSize=GetOutputSizePixel(); 367cdf0e10cSrcweir Point aPos(0,0); 368cdf0e10cSrcweir aComboBox.SetPosPixel(aPos); 369cdf0e10cSrcweir aComboBox.SetSizePixel(aSize); 370cdf0e10cSrcweir } 371cdf0e10cSrcweir 372cdf0e10cSrcweir 373cdf0e10cSrcweir void SvXPropertyComboBox::SetProperty(const String &rString) 374cdf0e10cSrcweir { 375cdf0e10cSrcweir aComboBox.SetText(rString); 376cdf0e10cSrcweir } 377cdf0e10cSrcweir 378cdf0e10cSrcweir String SvXPropertyComboBox::GetProperty() const 379cdf0e10cSrcweir { 380cdf0e10cSrcweir return aComboBox.GetText(); 381cdf0e10cSrcweir } 382cdf0e10cSrcweir 383cdf0e10cSrcweir sal_Bool SvXPropertyComboBox::HasList() 384cdf0e10cSrcweir { 385cdf0e10cSrcweir return sal_True; 386cdf0e10cSrcweir } 387cdf0e10cSrcweir 388cdf0e10cSrcweir void SvXPropertyComboBox::ClearList() 389cdf0e10cSrcweir { 390cdf0e10cSrcweir aComboBox.Clear(); 391cdf0e10cSrcweir } 392cdf0e10cSrcweir 393cdf0e10cSrcweir void SvXPropertyComboBox::InsertEntry( const String& rString,sal_uInt16 nPos) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir aComboBox.InsertEntry(rString,nPos); 396cdf0e10cSrcweir } 397cdf0e10cSrcweir 398cdf0e10cSrcweir void SvXPropertyComboBox::SetMyName(const String &rString) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir aName=rString; 401cdf0e10cSrcweir } 402cdf0e10cSrcweir 403cdf0e10cSrcweir String SvXPropertyComboBox::GetMyName()const 404cdf0e10cSrcweir { 405cdf0e10cSrcweir return aName; 406cdf0e10cSrcweir } 407cdf0e10cSrcweir 408cdf0e10cSrcweir void SvXPropertyComboBox::SetMyData(void* pDat) 409cdf0e10cSrcweir { 410cdf0e10cSrcweir pData=pDat; 411cdf0e10cSrcweir } 412cdf0e10cSrcweir 413cdf0e10cSrcweir void* SvXPropertyComboBox::GetMyData() 414cdf0e10cSrcweir { 415cdf0e10cSrcweir return pData; 416cdf0e10cSrcweir } 417cdf0e10cSrcweir 418cdf0e10cSrcweir IMPL_LINK( SvXPropertyComboBox, ModifiedHdl, ComboBox*, EMPTYARG ) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir if(pListener!=NULL) 421cdf0e10cSrcweir pListener->Modified(this); 422cdf0e10cSrcweir return 0; 423cdf0e10cSrcweir } 424cdf0e10cSrcweir 425cdf0e10cSrcweir IMPL_LINK( SvXPropertyComboBox, GetFocusHdl, ComboBox*, EMPTYARG ) 426cdf0e10cSrcweir { 427cdf0e10cSrcweir if(pListener!=NULL) 428cdf0e10cSrcweir pListener->GetFocus(this); 429cdf0e10cSrcweir return 0; 430cdf0e10cSrcweir } 431cdf0e10cSrcweir 432cdf0e10cSrcweir IMPL_LINK( SvXPropertyComboBox, LoseFocusHdl, ComboBox*, EMPTYARG ) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir if(pListener!=NULL) 435cdf0e10cSrcweir pListener->LoseFocus(this); 436cdf0e10cSrcweir return 0; 437cdf0e10cSrcweir } 438cdf0e10cSrcweir //------------------------------------------------------------------ 439cdf0e10cSrcweir 440cdf0e10cSrcweir SvPropertyLine::SvPropertyLine( Window* pParent,WinBits nWinStyle) 441cdf0e10cSrcweir : Control(pParent,nWinStyle), 442cdf0e10cSrcweir aName(this,WB_BORDER), 443cdf0e10cSrcweir pSvXPropertyControl(NULL), 444cdf0e10cSrcweir aXButton(this,WB_BORDER), 445cdf0e10cSrcweir bIsLocked(sal_False), 446cdf0e10cSrcweir bIsHyperlink(sal_False) 447cdf0e10cSrcweir { 448cdf0e10cSrcweir bNeedsRepaint = sal_True; 449cdf0e10cSrcweir bHasXButton = sal_False; 450cdf0e10cSrcweir aXButton.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "..." ) ) ); 451cdf0e10cSrcweir aName.Show(); 452cdf0e10cSrcweir aXButton.Show(); 453cdf0e10cSrcweir eKindOfCtr = KOC_UNDEFINED; 454cdf0e10cSrcweir Wallpaper aWall = GetBackground(); 455cdf0e10cSrcweir aWall.SetColor( Color( COL_TRANSPARENT ) ); 456cdf0e10cSrcweir SetBackground( aWall ); 457cdf0e10cSrcweir } 458cdf0e10cSrcweir 459cdf0e10cSrcweir SvPropertyLine::SvPropertyLine( Window* pParent,const ResId& rResId ) 460cdf0e10cSrcweir : Control(pParent,rResId), 461cdf0e10cSrcweir aName (this,WB_BORDER), 462cdf0e10cSrcweir pSvXPropertyControl(NULL), 463cdf0e10cSrcweir aXButton (this,WB_BORDER), 464cdf0e10cSrcweir bIsLocked(sal_False), 465cdf0e10cSrcweir bIsHyperlink(sal_False) 466cdf0e10cSrcweir { 467cdf0e10cSrcweir bNeedsRepaint = sal_True; 468cdf0e10cSrcweir bHasXButton = sal_False; 469cdf0e10cSrcweir eKindOfCtr = KOC_UNDEFINED; 470cdf0e10cSrcweir aXButton.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "..." ) ) ); 471cdf0e10cSrcweir aName.Show(); 472cdf0e10cSrcweir aXButton.Show(); 473cdf0e10cSrcweir Wallpaper aWall = GetBackground(); 474cdf0e10cSrcweir aWall.SetColor( Color( COL_TRANSPARENT ) ); 475cdf0e10cSrcweir SetBackground( aWall ); 476cdf0e10cSrcweir Resize(); 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir void SvPropertyLine::SetSvXPropertyControl(SvXPropertyControl* pXControl) 480cdf0e10cSrcweir { 481cdf0e10cSrcweir pSvXPropertyControl=pXControl; 482cdf0e10cSrcweir pSvXPropertyControl->Show(); 483cdf0e10cSrcweir Resize(); 484cdf0e10cSrcweir } 485cdf0e10cSrcweir 486cdf0e10cSrcweir SvXPropertyControl* SvPropertyLine::GetSvXPropertyControl() 487cdf0e10cSrcweir { 488cdf0e10cSrcweir return pSvXPropertyControl; 489cdf0e10cSrcweir } 490cdf0e10cSrcweir 491cdf0e10cSrcweir void SvPropertyLine::Resize() 492cdf0e10cSrcweir { 493cdf0e10cSrcweir Size aSize=GetOutputSizePixel(); 494cdf0e10cSrcweir Size a2Size=aSize; 495cdf0e10cSrcweir 496cdf0e10cSrcweir aSize.Width()=nNameWidth; 497cdf0e10cSrcweir a2Size.Width()-=nNameWidth; 498cdf0e10cSrcweir 499cdf0e10cSrcweir Point aPos(0,0); 500cdf0e10cSrcweir aName.SetPosPixel(aPos); 501cdf0e10cSrcweir aName.SetSizePixel(aSize); 502cdf0e10cSrcweir 503cdf0e10cSrcweir sal_uInt16 nXButtonWidth=0; 504cdf0e10cSrcweir 505cdf0e10cSrcweir if(bHasXButton) 506cdf0e10cSrcweir { 507cdf0e10cSrcweir nXButtonWidth=(sal_uInt16)aSize.Height(); 508cdf0e10cSrcweir } 509cdf0e10cSrcweir a2Size.Width()=a2Size.Width()-nXButtonWidth; 510cdf0e10cSrcweir 511cdf0e10cSrcweir aPos.X()+=aSize.Width(); 512cdf0e10cSrcweir 513cdf0e10cSrcweir if(pSvXPropertyControl!=NULL) 514cdf0e10cSrcweir { 515cdf0e10cSrcweir pSvXPropertyControl->SetPosPixel(aPos); 516cdf0e10cSrcweir pSvXPropertyControl->SetCtrSize(a2Size); 517cdf0e10cSrcweir } 518cdf0e10cSrcweir 519cdf0e10cSrcweir if(bHasXButton) 520cdf0e10cSrcweir { 521cdf0e10cSrcweir aPos.X()=GetOutputSizePixel().Width() 522cdf0e10cSrcweir -nXButtonWidth; 523cdf0e10cSrcweir aSize.Width()=nXButtonWidth; 524cdf0e10cSrcweir aXButton .SetSizePixel(aSize); 525cdf0e10cSrcweir aXButton .SetPosPixel(aPos); 526cdf0e10cSrcweir } 527cdf0e10cSrcweir } 528cdf0e10cSrcweir 529cdf0e10cSrcweir void SvPropertyLine::SetNeedsRepaint(sal_Bool bFlag) 530cdf0e10cSrcweir { 531cdf0e10cSrcweir bNeedsRepaint=bFlag; 532cdf0e10cSrcweir } 533cdf0e10cSrcweir 534cdf0e10cSrcweir sal_Bool SvPropertyLine::NeedsRepaint() 535cdf0e10cSrcweir { 536cdf0e10cSrcweir return bNeedsRepaint; 537cdf0e10cSrcweir } 538cdf0e10cSrcweir 539cdf0e10cSrcweir void SvPropertyLine::SetName(const String& rString ) 540cdf0e10cSrcweir { 541cdf0e10cSrcweir aName.SetText(rString); 542cdf0e10cSrcweir aName.Invalidate(); 543cdf0e10cSrcweir } 544cdf0e10cSrcweir 545cdf0e10cSrcweir String SvPropertyLine::GetName() const 546cdf0e10cSrcweir { 547cdf0e10cSrcweir return aName.GetText(); 548cdf0e10cSrcweir } 549cdf0e10cSrcweir 550cdf0e10cSrcweir void SvPropertyLine::SetKindOfControl(eKindOfControl eKOC) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir eKindOfCtr=eKOC; 553cdf0e10cSrcweir } 554cdf0e10cSrcweir 555cdf0e10cSrcweir eKindOfControl SvPropertyLine::GetKindOfControl() 556cdf0e10cSrcweir { 557cdf0e10cSrcweir return eKindOfCtr; 558cdf0e10cSrcweir } 559cdf0e10cSrcweir 560cdf0e10cSrcweir void SvPropertyLine::ShowXButton() 561cdf0e10cSrcweir { 562cdf0e10cSrcweir bHasXButton=sal_True; 563cdf0e10cSrcweir aXButton.Show(); 564cdf0e10cSrcweir Resize(); 565cdf0e10cSrcweir } 566cdf0e10cSrcweir void SvPropertyLine::HideXButton() 567cdf0e10cSrcweir { 568cdf0e10cSrcweir bHasXButton=sal_False; 569cdf0e10cSrcweir aXButton.Hide(); 570cdf0e10cSrcweir Resize(); 571cdf0e10cSrcweir } 572cdf0e10cSrcweir sal_Bool SvPropertyLine::IsVisibleXButton() 573cdf0e10cSrcweir { 574cdf0e10cSrcweir return bHasXButton; 575cdf0e10cSrcweir } 576cdf0e10cSrcweir 577cdf0e10cSrcweir void SvPropertyLine::ShowAsHyperLink(sal_Bool nFlag) 578cdf0e10cSrcweir { 579cdf0e10cSrcweir bIsHyperlink=nFlag; 580cdf0e10cSrcweir if(nFlag) 581cdf0e10cSrcweir { 582cdf0e10cSrcweir Font aFont=GetFont(); 583cdf0e10cSrcweir aFont.SetUnderline(UNDERLINE_SINGLE); 584cdf0e10cSrcweir aFont.SetColor(Color(COL_BLUE)); 585cdf0e10cSrcweir aName.SetFont(aFont); 586cdf0e10cSrcweir } 587cdf0e10cSrcweir else 588cdf0e10cSrcweir { 589cdf0e10cSrcweir Font aFont=GetFont(); 590cdf0e10cSrcweir aName.SetFont(aFont); 591cdf0e10cSrcweir } 592cdf0e10cSrcweir } 593cdf0e10cSrcweir 594cdf0e10cSrcweir sal_Bool SvPropertyLine::IsShownAsHyperlink() 595cdf0e10cSrcweir { 596cdf0e10cSrcweir return bIsHyperlink; 597cdf0e10cSrcweir } 598cdf0e10cSrcweir 599cdf0e10cSrcweir void SvPropertyLine::Locked(sal_Bool nFlag) 600cdf0e10cSrcweir { 601cdf0e10cSrcweir bIsLocked=nFlag; 602cdf0e10cSrcweir if(pSvXPropertyControl!=NULL) 603cdf0e10cSrcweir pSvXPropertyControl->SetLocked(nFlag); 604cdf0e10cSrcweir } 605cdf0e10cSrcweir 606cdf0e10cSrcweir sal_Bool SvPropertyLine::IsLineLocked() 607cdf0e10cSrcweir { 608cdf0e10cSrcweir return bIsLocked; 609cdf0e10cSrcweir } 610cdf0e10cSrcweir 611cdf0e10cSrcweir void SvPropertyLine::SetNameWidth(sal_uInt16 nWidth) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir nNameWidth=nWidth; 614cdf0e10cSrcweir Resize(); 615cdf0e10cSrcweir } 616cdf0e10cSrcweir 617cdf0e10cSrcweir void SvPropertyLine::SetClickHdl(const Link& rLink) 618cdf0e10cSrcweir { 619cdf0e10cSrcweir aXButton.SetClickHdl(rLink ); 620cdf0e10cSrcweir } 621cdf0e10cSrcweir 622cdf0e10cSrcweir //---------------------------------------------------------- 623cdf0e10cSrcweir 624cdf0e10cSrcweir SvXPropEvListener::SvXPropEvListener() 625cdf0e10cSrcweir { 626cdf0e10cSrcweir pTheActiveControl=NULL; 627cdf0e10cSrcweir } 628cdf0e10cSrcweir 629cdf0e10cSrcweir SvXPropEvListener::~SvXPropEvListener() 630cdf0e10cSrcweir { 631cdf0e10cSrcweir } 632cdf0e10cSrcweir 633cdf0e10cSrcweir void SvXPropEvListener::Modified (SvXPropertyControl *pSvXPCtr) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir pTheActiveControl=pSvXPCtr; 636cdf0e10cSrcweir aModifyLink.Call(this); 637cdf0e10cSrcweir } 638cdf0e10cSrcweir 639cdf0e10cSrcweir void SvXPropEvListener::GetFocus (SvXPropertyControl *pSvXPCtr) 640cdf0e10cSrcweir { 641cdf0e10cSrcweir pTheActiveControl=pSvXPCtr; 642cdf0e10cSrcweir aGetFocusLink.Call(this); 643cdf0e10cSrcweir } 644cdf0e10cSrcweir 645cdf0e10cSrcweir void SvXPropEvListener::LoseFocus (SvXPropertyControl *pSvXPCtr) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir pTheActiveControl=pSvXPCtr; 648cdf0e10cSrcweir aLoseFocusLink.Call(this); 649cdf0e10cSrcweir } 650cdf0e10cSrcweir 651cdf0e10cSrcweir void SvXPropEvListener::KeyInput (SvXPropertyControl *pSvXPCtr,const KeyCode& theKeyCode) 652cdf0e10cSrcweir { 653cdf0e10cSrcweir pTheActiveControl=pSvXPCtr; 654cdf0e10cSrcweir aKeyCode=theKeyCode; 655cdf0e10cSrcweir aKeyInputLink.Call(this); 656cdf0e10cSrcweir } 657cdf0e10cSrcweir 658cdf0e10cSrcweir SvXPropertyControl * SvXPropEvListener::GetPropertyControl() 659cdf0e10cSrcweir { 660cdf0e10cSrcweir return pTheActiveControl; 661cdf0e10cSrcweir } 662cdf0e10cSrcweir 663cdf0e10cSrcweir KeyCode SvXPropEvListener::GetKeyCode() const 664cdf0e10cSrcweir { 665cdf0e10cSrcweir return aKeyCode; 666cdf0e10cSrcweir } 667cdf0e10cSrcweir 668cdf0e10cSrcweir //------------------------------------------------------------------ 669cdf0e10cSrcweir 670cdf0e10cSrcweir SvListBoxForProperties::SvListBoxForProperties( Window* pParent, WinBits nWinStyle) 671cdf0e10cSrcweir : Control(pParent,nWinStyle), 672cdf0e10cSrcweir aPlayGround(this,WB_DIALOGCONTROL), 673cdf0e10cSrcweir aVScroll(this,WB_VSCROLL|WB_REPEAT|WB_DRAG), 674cdf0e10cSrcweir pPropDataControl(NULL) 675cdf0e10cSrcweir { 676cdf0e10cSrcweir 677cdf0e10cSrcweir aListener.SetModifyHdl (LINK( this, SvListBoxForProperties, ModifyHdl)); 678cdf0e10cSrcweir aListener.SetGetFocusHdl (LINK( this, SvListBoxForProperties, GetFocusHdl)); 679cdf0e10cSrcweir aListener.SetLoseFocusHdl(LINK( this, SvListBoxForProperties,LoseFocusHdl)); 680cdf0e10cSrcweir aListener.SetKeyInputHdl (LINK( this, SvListBoxForProperties, KeyInputHdl)); 681cdf0e10cSrcweir 682cdf0e10cSrcweir nYOffset=0; 683cdf0e10cSrcweir nTheNameSize=0; 684cdf0e10cSrcweir ListBox aListBox(this,WB_DROPDOWN); 685cdf0e10cSrcweir aListBox.SetPosSizePixel(Point(0,0),Size(100,100)); 686cdf0e10cSrcweir nRowHeight=(sal_uInt16)aListBox.GetSizePixel().Height(); 687cdf0e10cSrcweir Wallpaper aWall = aPlayGround.GetBackground(); 688cdf0e10cSrcweir aWall.SetColor( Color( COL_TRANSPARENT ) ); 689cdf0e10cSrcweir aPlayGround.SetBackground( aWall ); 690cdf0e10cSrcweir aPlayGround.Show(); 691cdf0e10cSrcweir aVScroll.Hide(); 692cdf0e10cSrcweir aVScroll.SetScrollHdl( 693cdf0e10cSrcweir LINK( this, SvListBoxForProperties, ScrollHdl )); 694cdf0e10cSrcweir 695cdf0e10cSrcweir } 696cdf0e10cSrcweir 697cdf0e10cSrcweir 698cdf0e10cSrcweir SvListBoxForProperties::SvListBoxForProperties( Window* pParent, const ResId& rResId ) 699cdf0e10cSrcweir : Control(pParent,rResId), 700cdf0e10cSrcweir aPlayGround(this,0), 701cdf0e10cSrcweir aVScroll(this,WB_VSCROLL|WB_REPEAT|WB_DRAG), 702cdf0e10cSrcweir pPropDataControl(NULL) 703cdf0e10cSrcweir { 704cdf0e10cSrcweir nTheNameSize=0; 705cdf0e10cSrcweir nYOffset=0; 706cdf0e10cSrcweir ListBox aListBox(this,WB_DROPDOWN); 707cdf0e10cSrcweir aListBox.SetPosSizePixel(Point(0,0),Size(100,100)); 708cdf0e10cSrcweir nRowHeight=(sal_uInt16)aListBox.GetSizePixel().Height(); 709cdf0e10cSrcweir Wallpaper aWall = aPlayGround.GetBackground(); 710cdf0e10cSrcweir aWall.SetColor( Color( COL_TRANSPARENT ) ); 711cdf0e10cSrcweir aPlayGround.SetBackground( aWall ); 712cdf0e10cSrcweir aPlayGround.Show(); 713cdf0e10cSrcweir aVScroll.Hide(); 714cdf0e10cSrcweir aVScroll.SetScrollHdl( LINK( this, SvListBoxForProperties, ScrollHdl ) ); 715cdf0e10cSrcweir UpdateVScroll(); 716cdf0e10cSrcweir Resize(); 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir SvListBoxForProperties::~SvListBoxForProperties() 720cdf0e10cSrcweir { 721cdf0e10cSrcweir Clear(); 722cdf0e10cSrcweir } 723cdf0e10cSrcweir 724cdf0e10cSrcweir void SvListBoxForProperties::Clear() 725cdf0e10cSrcweir { 726cdf0e10cSrcweir for(sal_uInt16 i=0;i<PLineArray.Count();i++) 727cdf0e10cSrcweir { 728cdf0e10cSrcweir SvPropertyLine* pPropLine=PLineArray[i]; 729cdf0e10cSrcweir 730cdf0e10cSrcweir switch(pPropLine->GetKindOfControl()) 731cdf0e10cSrcweir { 732cdf0e10cSrcweir case KOC_LISTBOX: 733cdf0e10cSrcweir case KOC_COMBOBOX: 734cdf0e10cSrcweir case KOC_EDIT: delete pPropLine->GetSvXPropertyControl(); 735cdf0e10cSrcweir break; 736cdf0e10cSrcweir default: 737cdf0e10cSrcweir break; 738cdf0e10cSrcweir } 739cdf0e10cSrcweir delete pPropLine; 740cdf0e10cSrcweir } 741cdf0e10cSrcweir PLineArray.Remove(0,PLineArray.Count()); 742cdf0e10cSrcweir } 743cdf0e10cSrcweir 744cdf0e10cSrcweir 745cdf0e10cSrcweir void SvListBoxForProperties::Resize() 746cdf0e10cSrcweir { 747cdf0e10cSrcweir Size aSize=GetOutputSizePixel(); 748cdf0e10cSrcweir Size a2Size=aSize; 749cdf0e10cSrcweir Size aVScrollSize; 750cdf0e10cSrcweir 751cdf0e10cSrcweir if(aVScroll.IsVisible()) 752cdf0e10cSrcweir { 753cdf0e10cSrcweir Point aPos(0,0); 754cdf0e10cSrcweir aVScrollSize=aVScroll.GetSizePixel(); 755cdf0e10cSrcweir aVScrollSize.Height()=aSize.Height(); 756cdf0e10cSrcweir a2Size.Width()-=aVScrollSize.Width(); 757cdf0e10cSrcweir aPos.X()=a2Size.Width(); 758cdf0e10cSrcweir aVScroll.SetPosPixel(aPos); 759cdf0e10cSrcweir aVScroll.SetSizePixel(aVScrollSize); 760cdf0e10cSrcweir } 761cdf0e10cSrcweir 762cdf0e10cSrcweir aPlayGround.SetPosPixel(Point(0,0)); 763cdf0e10cSrcweir aPlayGround.SetSizePixel(a2Size); 764cdf0e10cSrcweir UpdatePosNSize(); 765cdf0e10cSrcweir } 766cdf0e10cSrcweir 767cdf0e10cSrcweir void SvListBoxForProperties::SetController( SvPropertyDataControl *pPDC) 768cdf0e10cSrcweir { 769cdf0e10cSrcweir pPropDataControl=pPDC; 770cdf0e10cSrcweir } 771cdf0e10cSrcweir 772cdf0e10cSrcweir sal_uInt16 SvListBoxForProperties::CalcVisibleLines() 773cdf0e10cSrcweir { 774cdf0e10cSrcweir Size aSize=aPlayGround.GetOutputSizePixel(); 775cdf0e10cSrcweir sal_uInt16 nResult=0; 776cdf0e10cSrcweir if(nRowHeight!=0) 777cdf0e10cSrcweir nResult=(sal_uInt16) aSize.Height()/nRowHeight; 778cdf0e10cSrcweir 779cdf0e10cSrcweir return nResult; 780cdf0e10cSrcweir } 781cdf0e10cSrcweir 782cdf0e10cSrcweir void SvListBoxForProperties::UpdateVScroll() 783cdf0e10cSrcweir { 784cdf0e10cSrcweir sal_uInt16 nLines=CalcVisibleLines(); 785cdf0e10cSrcweir aVScroll.SetPageSize(nLines-1); 786cdf0e10cSrcweir aVScroll.SetVisibleSize(nLines-1); 787cdf0e10cSrcweir aVScroll.SetRange(Range(0,PLineArray.Count()-1)); 788cdf0e10cSrcweir if(PLineArray.Count()<=nLines) 789cdf0e10cSrcweir { 790cdf0e10cSrcweir aVScroll.Hide(); 791cdf0e10cSrcweir } 792cdf0e10cSrcweir else 793cdf0e10cSrcweir { 794cdf0e10cSrcweir sal_Bool bFlag=aVScroll.IsVisible(); 795cdf0e10cSrcweir aVScroll.Show(); 796cdf0e10cSrcweir if(!bFlag)Resize(); 797cdf0e10cSrcweir } 798cdf0e10cSrcweir 799cdf0e10cSrcweir 800cdf0e10cSrcweir } 801cdf0e10cSrcweir 802cdf0e10cSrcweir void SvListBoxForProperties::UpdatePosNSize() 803cdf0e10cSrcweir { 804cdf0e10cSrcweir Point aPos(0,nYOffset); 805cdf0e10cSrcweir 806cdf0e10cSrcweir for(sal_uInt16 i=0; i<PLineArray.Count();i++) 807cdf0e10cSrcweir { 808cdf0e10cSrcweir if((PLineArray[i])->NeedsRepaint()) 809cdf0e10cSrcweir { 810cdf0e10cSrcweir (PLineArray[i])->SetPosPixel(aPos); 811cdf0e10cSrcweir Size aSize=aPlayGround.GetOutputSizePixel(); 812cdf0e10cSrcweir aSize.Height()=nRowHeight; 813cdf0e10cSrcweir (PLineArray[i])->SetSizePixel(aSize); 814cdf0e10cSrcweir (PLineArray[i])->SetNameWidth(nTheNameSize+2*FRAME_OFFSET); 815cdf0e10cSrcweir (PLineArray[i])->Invalidate(); 816cdf0e10cSrcweir (PLineArray[i])->Update(); 817cdf0e10cSrcweir (PLineArray[i])->Show(); 818cdf0e10cSrcweir (PLineArray[i])->SetNeedsRepaint(sal_False); 819cdf0e10cSrcweir } 820cdf0e10cSrcweir else 821cdf0e10cSrcweir { 822cdf0e10cSrcweir if((PLineArray[i])->IsVisible()) 823cdf0e10cSrcweir { 824cdf0e10cSrcweir Size aSize=aPlayGround.GetOutputSizePixel(); 825cdf0e10cSrcweir aSize.Height()=nRowHeight; 826cdf0e10cSrcweir (PLineArray[i])->SetSizePixel(aSize); 827cdf0e10cSrcweir (PLineArray[i])->SetNameWidth(nTheNameSize+2*FRAME_OFFSET); 828cdf0e10cSrcweir (PLineArray[i])->Invalidate(); 829cdf0e10cSrcweir } 830cdf0e10cSrcweir } 831cdf0e10cSrcweir 832cdf0e10cSrcweir aPos.Y()+=nRowHeight; 833cdf0e10cSrcweir } 834cdf0e10cSrcweir aPlayGround.Invalidate(); 835cdf0e10cSrcweir aPlayGround.Update(); 836cdf0e10cSrcweir } 837cdf0e10cSrcweir 838cdf0e10cSrcweir void SvListBoxForProperties::UpdatePlayGround() 839cdf0e10cSrcweir { 840cdf0e10cSrcweir Point aPos(0,0); 841cdf0e10cSrcweir long nThumbPos=aVScroll.GetThumbPos(); 842cdf0e10cSrcweir long nLines=aVScroll.GetPageSize(); 843cdf0e10cSrcweir long nDelta=aVScroll.GetDelta(); 844cdf0e10cSrcweir 845cdf0e10cSrcweir sal_uInt16 nStart,nEnd; 846cdf0e10cSrcweir Size aSize=aPlayGround.GetOutputSizePixel(); 847cdf0e10cSrcweir Point aPEnd; 848cdf0e10cSrcweir aPEnd.X()=aSize.Width(); 849cdf0e10cSrcweir 850cdf0e10cSrcweir if(nDelta>0) 851cdf0e10cSrcweir { 852cdf0e10cSrcweir nStart=(sal_uInt16)(nThumbPos+nLines+1-nDelta); 853cdf0e10cSrcweir nEnd=(sal_uInt16)(nThumbPos+nLines); 854cdf0e10cSrcweir aPos.Y()=(nLines+1-nDelta)*nRowHeight; 855cdf0e10cSrcweir } 856cdf0e10cSrcweir else 857cdf0e10cSrcweir { 858cdf0e10cSrcweir nStart=(sal_uInt16)nThumbPos; 859cdf0e10cSrcweir nEnd=(sal_uInt16)(nThumbPos-nDelta); 860*6bcc9fe0Smseidel aPEnd.Y()=(nThumbPos-nDelta)*nRowHeight; 861cdf0e10cSrcweir } 862cdf0e10cSrcweir 863cdf0e10cSrcweir aSize.Height()=nRowHeight; 864cdf0e10cSrcweir 865cdf0e10cSrcweir nDelta=-nDelta*nRowHeight; 866cdf0e10cSrcweir 867cdf0e10cSrcweir aPlayGround.Scroll(0,nDelta,SCROLL_CHILDREN); 868cdf0e10cSrcweir 869cdf0e10cSrcweir for(sal_uInt16 i=nStart; i<=nEnd;i++) 870cdf0e10cSrcweir { 871cdf0e10cSrcweir (PLineArray[i])->SetPosSizePixel(aPos,aSize); 872cdf0e10cSrcweir (PLineArray[i])->SetNameWidth(nTheNameSize+2*FRAME_OFFSET); 873cdf0e10cSrcweir (PLineArray[i])->Show(); 874cdf0e10cSrcweir aPos.Y()+=nRowHeight; 875cdf0e10cSrcweir } 876cdf0e10cSrcweir aPlayGround.Update(); 877cdf0e10cSrcweir } 878cdf0e10cSrcweir 879cdf0e10cSrcweir void SvListBoxForProperties::UpdateAll() 880cdf0e10cSrcweir { 881cdf0e10cSrcweir UpdatePosNSize(); 882cdf0e10cSrcweir UpdatePlayGround(); 883cdf0e10cSrcweir //UpdateVScroll(); 884cdf0e10cSrcweir } 885cdf0e10cSrcweir 886cdf0e10cSrcweir void SvListBoxForProperties::DisableUpdate() 887cdf0e10cSrcweir { 888cdf0e10cSrcweir bUpdate=sal_False; 889cdf0e10cSrcweir } 890cdf0e10cSrcweir 891cdf0e10cSrcweir void SvListBoxForProperties::EnableUpdate() 892cdf0e10cSrcweir { 893cdf0e10cSrcweir bUpdate=sal_True; 894cdf0e10cSrcweir UpdateAll(); 895cdf0e10cSrcweir } 896cdf0e10cSrcweir 897cdf0e10cSrcweir void SvListBoxForProperties::SetPropertyValue( const String & rEntryName, const String & rValue ) 898cdf0e10cSrcweir { 899cdf0e10cSrcweir sal_uInt16 i, iEnd = PLineArray.Count(); 900cdf0e10cSrcweir for( i = 0 ; i < iEnd ; i++ ) 901cdf0e10cSrcweir { 902cdf0e10cSrcweir SvPropertyLine* pPropLine = PLineArray[ i ]; 903cdf0e10cSrcweir SvXPropertyControl* pSvXPCtr=pPropLine->GetSvXPropertyControl(); 904cdf0e10cSrcweir if( pSvXPCtr && pSvXPCtr->GetMyName() == rEntryName ) 905cdf0e10cSrcweir { 906cdf0e10cSrcweir pSvXPCtr->SetProperty( rValue ); 907cdf0e10cSrcweir } 908cdf0e10cSrcweir } 909cdf0e10cSrcweir } 910cdf0e10cSrcweir 911cdf0e10cSrcweir sal_uInt16 SvListBoxForProperties::AppendEntry( const SvPropertyData& aPropData) 912cdf0e10cSrcweir { 913cdf0e10cSrcweir return InsertEntry(aPropData); 914cdf0e10cSrcweir } 915cdf0e10cSrcweir 916cdf0e10cSrcweir sal_uInt16 SvListBoxForProperties::InsertEntry( const SvPropertyData& aPropData, sal_uInt16 nPos) 917cdf0e10cSrcweir { 918cdf0e10cSrcweir sal_uInt16 nInsPos=nPos; 919cdf0e10cSrcweir SvPropertyLine* pPropLine=new SvPropertyLine(&aPlayGround,WB_TABSTOP | WB_DIALOGCONTROL); 920cdf0e10cSrcweir 921cdf0e10cSrcweir if(nPos==LISTBOX_APPEND) 922cdf0e10cSrcweir { 923cdf0e10cSrcweir nInsPos=PLineArray.Count(); 924cdf0e10cSrcweir PLineArray.Insert(pPropLine,nInsPos); 925cdf0e10cSrcweir } 926cdf0e10cSrcweir else 927cdf0e10cSrcweir { 928cdf0e10cSrcweir PLineArray.Insert(pPropLine,nPos); 929cdf0e10cSrcweir } 930cdf0e10cSrcweir pPropLine->SetNameWidth(nTheNameSize); 931cdf0e10cSrcweir UpdateVScroll(); 932cdf0e10cSrcweir UpdatePosNSize(); 933cdf0e10cSrcweir ChangeEntry(aPropData,nInsPos); 934cdf0e10cSrcweir return nInsPos; 935cdf0e10cSrcweir } 936cdf0e10cSrcweir 937cdf0e10cSrcweir void SvListBoxForProperties::ChangeEntry( const SvPropertyData& aPropData, sal_uInt16 nPos) 938cdf0e10cSrcweir { 939cdf0e10cSrcweir if(nPos<PLineArray.Count()) 940cdf0e10cSrcweir { 941cdf0e10cSrcweir SvPropertyLine* pPropLine=PLineArray[nPos]; 942cdf0e10cSrcweir 943cdf0e10cSrcweir switch(pPropLine->GetKindOfControl()) 944cdf0e10cSrcweir { 945cdf0e10cSrcweir case KOC_LISTBOX: 946cdf0e10cSrcweir case KOC_COMBOBOX: 947cdf0e10cSrcweir case KOC_EDIT: delete pPropLine->GetSvXPropertyControl(); 948cdf0e10cSrcweir break; 949cdf0e10cSrcweir default: 950cdf0e10cSrcweir break; 951cdf0e10cSrcweir } 952cdf0e10cSrcweir 953cdf0e10cSrcweir switch(aPropData.eKind) 954cdf0e10cSrcweir { 955cdf0e10cSrcweir case KOC_LISTBOX: 956cdf0e10cSrcweir pPropLine->SetSvXPropertyControl( 957cdf0e10cSrcweir new SvXPropertyComboBox(pPropLine,WB_TABSTOP)); 958cdf0e10cSrcweir pPropLine->SetKindOfControl(aPropData.eKind); 959cdf0e10cSrcweir break; 960cdf0e10cSrcweir case KOC_COMBOBOX: 961cdf0e10cSrcweir pPropLine->SetSvXPropertyControl( 962cdf0e10cSrcweir new SvXPropertyComboBox(pPropLine,WB_TABSTOP)); 963cdf0e10cSrcweir pPropLine->SetKindOfControl(aPropData.eKind); 964cdf0e10cSrcweir break; 965cdf0e10cSrcweir case KOC_EDIT: 966cdf0e10cSrcweir pPropLine->SetSvXPropertyControl( 967cdf0e10cSrcweir new SvXPropertyEdit(pPropLine,WB_TABSTOP)); 968cdf0e10cSrcweir pPropLine->SetKindOfControl(aPropData.eKind); 969cdf0e10cSrcweir break; 970cdf0e10cSrcweir case KOC_USERDEFINED: 971cdf0e10cSrcweir pPropLine->SetSvXPropertyControl(aPropData.pControl); 972cdf0e10cSrcweir aPropData.pControl->SetParent(pPropLine); 973cdf0e10cSrcweir pPropLine->SetKindOfControl(aPropData.eKind); 974cdf0e10cSrcweir break; 975cdf0e10cSrcweir default: 976cdf0e10cSrcweir pPropLine->SetSvXPropertyControl(NULL); 977cdf0e10cSrcweir pPropLine->SetKindOfControl(KOC_UNDEFINED); 978cdf0e10cSrcweir break; 979cdf0e10cSrcweir } 980cdf0e10cSrcweir 981cdf0e10cSrcweir SvXPropertyControl* pSvXPCtr=pPropLine->GetSvXPropertyControl(); 982cdf0e10cSrcweir 983cdf0e10cSrcweir if(pSvXPCtr!=NULL) 984cdf0e10cSrcweir { 985cdf0e10cSrcweir pSvXPCtr->SetSvXPropertyCtrListener(&aListener); 986cdf0e10cSrcweir pSvXPCtr->SetProperty(aPropData.aValue); 987cdf0e10cSrcweir pSvXPCtr->SetMyData(aPropData.pDataPtr); 988cdf0e10cSrcweir pSvXPCtr->SetMyName(aPropData.aName); 989cdf0e10cSrcweir 990cdf0e10cSrcweir if(pSvXPCtr->HasList()) 991cdf0e10cSrcweir { 992cdf0e10cSrcweir for(sal_uInt16 i=0;i<aPropData.theValues.Count();i++) 993cdf0e10cSrcweir { 994cdf0e10cSrcweir pSvXPCtr->InsertEntry(*(aPropData.theValues[i])); 995cdf0e10cSrcweir } 996cdf0e10cSrcweir } 997cdf0e10cSrcweir } 998cdf0e10cSrcweir 999cdf0e10cSrcweir pPropLine->SetName(aPropData.aName); 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir sal_uInt16 nTextWidth=(sal_uInt16)aPlayGround.GetTextWidth(aPropData.aName); 1002cdf0e10cSrcweir 1003cdf0e10cSrcweir if ( nTheNameSize < nTextWidth ) 1004cdf0e10cSrcweir nTheNameSize = nTextWidth; 1005cdf0e10cSrcweir 1006cdf0e10cSrcweir if ( aPropData.bHasVisibleXButton ) 1007cdf0e10cSrcweir { 1008cdf0e10cSrcweir pPropLine->SetClickHdl(LINK( this, SvListBoxForProperties, ClickHdl ) ); 1009cdf0e10cSrcweir pPropLine->ShowXButton(); 1010cdf0e10cSrcweir } 1011cdf0e10cSrcweir else 1012cdf0e10cSrcweir pPropLine->HideXButton(); 1013cdf0e10cSrcweir 1014cdf0e10cSrcweir pPropLine->Locked(aPropData.bIsLocked); 1015cdf0e10cSrcweir 1016cdf0e10cSrcweir pPropLine->ShowAsHyperLink(aPropData.bIsHyperLink); 1017cdf0e10cSrcweir pPropLine->SetData(aPropData.pDataPtr); 1018cdf0e10cSrcweir } 1019cdf0e10cSrcweir } 1020cdf0e10cSrcweir 1021cdf0e10cSrcweir sal_uInt16 SvListBoxForProperties::GetFirstVisibleEntry() 1022cdf0e10cSrcweir { 1023cdf0e10cSrcweir return 0; 1024cdf0e10cSrcweir } 1025cdf0e10cSrcweir void SvListBoxForProperties::SetFirstVisibleEntry(sal_uInt16) 1026cdf0e10cSrcweir { 1027cdf0e10cSrcweir return; 1028cdf0e10cSrcweir } 1029cdf0e10cSrcweir 1030cdf0e10cSrcweir void SvListBoxForProperties::SetSelectedEntry(sal_uInt16) 1031cdf0e10cSrcweir { 1032cdf0e10cSrcweir return; 1033cdf0e10cSrcweir } 1034cdf0e10cSrcweir 1035cdf0e10cSrcweir sal_uInt16 SvListBoxForProperties::GetSelectedEntry() 1036cdf0e10cSrcweir { 1037cdf0e10cSrcweir return 0; 1038cdf0e10cSrcweir } 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir IMPL_LINK( SvListBoxForProperties, ScrollHdl, ScrollBar*, pSB ) 1041cdf0e10cSrcweir { 1042cdf0e10cSrcweir if(pSB!=NULL) 1043cdf0e10cSrcweir { 1044cdf0e10cSrcweir long nDelta=aVScroll.GetDelta(); 1045cdf0e10cSrcweir nYOffset=-aVScroll.GetThumbPos()*nRowHeight; 1046cdf0e10cSrcweir //aPlayGround.SetUpdateMode(sal_False); 1047cdf0e10cSrcweir 1048cdf0e10cSrcweir long nThumbPos=aVScroll.GetThumbPos(); 1049cdf0e10cSrcweir long nLines=aVScroll.GetPageSize(); 1050cdf0e10cSrcweir 1051cdf0e10cSrcweir UpdatePlayGround(); 1052cdf0e10cSrcweir 1053cdf0e10cSrcweir for(long i=nThumbPos-nDelta; i<nThumbPos+nLines-nDelta;i++) 1054cdf0e10cSrcweir { 1055cdf0e10cSrcweir if(i>=nThumbPos && i<=nThumbPos+nLines) 1056cdf0e10cSrcweir { 1057cdf0e10cSrcweir (PLineArray[sal::static_int_cast< sal_uInt16 >(i)])-> 1058cdf0e10cSrcweir SetNeedsRepaint(sal_True); 1059cdf0e10cSrcweir } 1060cdf0e10cSrcweir else 1061cdf0e10cSrcweir { 1062cdf0e10cSrcweir (PLineArray[sal::static_int_cast< sal_uInt16 >(i)])->Hide(); 1063cdf0e10cSrcweir (PLineArray[sal::static_int_cast< sal_uInt16 >(i)])-> 1064cdf0e10cSrcweir SetNeedsRepaint(sal_False); 1065cdf0e10cSrcweir } 1066cdf0e10cSrcweir } 1067cdf0e10cSrcweir } 1068cdf0e10cSrcweir return 0; 1069cdf0e10cSrcweir } 1070cdf0e10cSrcweir 1071cdf0e10cSrcweir IMPL_LINK( SvListBoxForProperties, ClickHdl, PushButton*,pPB) 1072cdf0e10cSrcweir { 1073cdf0e10cSrcweir if(pPB!=NULL) 1074cdf0e10cSrcweir { 1075cdf0e10cSrcweir SvPropertyLine *pPropLine=(SvPropertyLine *)pPB->GetParent(); 1076cdf0e10cSrcweir SvXPropertyControl* pSvXPCtr=pPropLine->GetSvXPropertyControl(); 1077cdf0e10cSrcweir pPropDataControl->Clicked(pSvXPCtr->GetMyName(), 1078cdf0e10cSrcweir pSvXPCtr->GetProperty(),pSvXPCtr->GetMyData()); 1079cdf0e10cSrcweir } 1080cdf0e10cSrcweir return 0; 1081cdf0e10cSrcweir } 1082cdf0e10cSrcweir 1083cdf0e10cSrcweir IMPL_LINK( SvListBoxForProperties, ModifyHdl,SvXPropEvListener*, pSvXPEvL) 1084cdf0e10cSrcweir { 1085cdf0e10cSrcweir if(pSvXPEvL!=NULL && pPropDataControl!=NULL) 1086cdf0e10cSrcweir { 1087cdf0e10cSrcweir 1088cdf0e10cSrcweir SvXPropertyControl* pSvXPCtr=aListener.GetPropertyControl(); 1089cdf0e10cSrcweir 1090cdf0e10cSrcweir pPropDataControl->Modified(pSvXPCtr->GetMyName(), 1091cdf0e10cSrcweir pSvXPCtr->GetProperty(),pSvXPCtr->GetMyData()); 1092cdf0e10cSrcweir 1093cdf0e10cSrcweir } 1094cdf0e10cSrcweir return 0; 1095cdf0e10cSrcweir } 1096cdf0e10cSrcweir 1097cdf0e10cSrcweir IMPL_LINK( SvListBoxForProperties, GetFocusHdl,SvXPropEvListener*, pSvXPEvL) 1098cdf0e10cSrcweir { 1099cdf0e10cSrcweir if(pSvXPEvL!=NULL && pPropDataControl!=NULL) 1100cdf0e10cSrcweir { 1101cdf0e10cSrcweir SvXPropertyControl* pSvXPCtr=aListener.GetPropertyControl(); 1102cdf0e10cSrcweir 1103cdf0e10cSrcweir pPropDataControl->Select(pSvXPCtr->GetMyName(),pSvXPCtr->GetMyData()); 1104cdf0e10cSrcweir } 1105cdf0e10cSrcweir return 0; 1106cdf0e10cSrcweir } 1107cdf0e10cSrcweir 1108cdf0e10cSrcweir IMPL_LINK( SvListBoxForProperties, LoseFocusHdl,SvXPropEvListener*, pSvXPEvL) 1109cdf0e10cSrcweir { 1110cdf0e10cSrcweir if(pSvXPEvL!=NULL && pPropDataControl!=NULL) 1111cdf0e10cSrcweir { 1112cdf0e10cSrcweir SvXPropertyControl* pSvXPCtr=aListener.GetPropertyControl(); 1113cdf0e10cSrcweir 1114cdf0e10cSrcweir pPropDataControl->Commit(pSvXPCtr->GetMyName(), 1115cdf0e10cSrcweir pSvXPCtr->GetProperty(),pSvXPCtr->GetMyData()); 1116cdf0e10cSrcweir /* 1117cdf0e10cSrcweir { 1118cdf0e10cSrcweir pSvXPCtr->SetProperty( 1119cdf0e10cSrcweir pPropDataControl->GetTheCorrectProperty()); 1120cdf0e10cSrcweir } 1121cdf0e10cSrcweir */ 1122cdf0e10cSrcweir } 1123cdf0e10cSrcweir return 0; 1124cdf0e10cSrcweir } 1125cdf0e10cSrcweir 1126cdf0e10cSrcweir IMPL_LINK( SvListBoxForProperties, KeyInputHdl,SvXPropEvListener*, pSvXPEvL) 1127cdf0e10cSrcweir { 1128cdf0e10cSrcweir // FIXME - This code does not make a lot of sense. 1129cdf0e10cSrcweir if(pSvXPEvL!=NULL && pPropDataControl!=NULL) 1130cdf0e10cSrcweir { 1131cdf0e10cSrcweir /*SvXPropertyControl* pSvXPCtr=*/aListener.GetPropertyControl(); 1132cdf0e10cSrcweir } 1133cdf0e10cSrcweir return 0; 1134cdf0e10cSrcweir } 1135cdf0e10cSrcweir 1136cdf0e10cSrcweir 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir 1139cdf0e10cSrcweir SvTabPageForProperties::SvTabPageForProperties(Window* pParent,WinBits nWinStyle) 1140cdf0e10cSrcweir : TabPage(pParent,nWinStyle), 1141cdf0e10cSrcweir aLbProp(this) 1142cdf0e10cSrcweir { 1143cdf0e10cSrcweir aLbProp.Show(); 1144cdf0e10cSrcweir } 1145cdf0e10cSrcweir 1146cdf0e10cSrcweir void SvTabPageForProperties::Resize() 1147cdf0e10cSrcweir { 1148cdf0e10cSrcweir Point aPos(3,3); 1149cdf0e10cSrcweir Size aSize=GetOutputSizePixel(); 1150cdf0e10cSrcweir aSize.Width()-=6; 1151cdf0e10cSrcweir aSize.Height()-=6; 1152cdf0e10cSrcweir 1153cdf0e10cSrcweir aLbProp.SetPosSizePixel(aPos,aSize); 1154cdf0e10cSrcweir } 1155cdf0e10cSrcweir 1156cdf0e10cSrcweir SvListBoxForProperties* SvTabPageForProperties::GetTheListBox() 1157cdf0e10cSrcweir { 1158cdf0e10cSrcweir return &aLbProp; 1159cdf0e10cSrcweir } 1160cdf0e10cSrcweir 1161cdf0e10cSrcweir 1162cdf0e10cSrcweir SvPropertyBox::SvPropertyBox( Window* pParent, WinBits nWinStyle) 1163cdf0e10cSrcweir : Control(pParent,nWinStyle), 1164cdf0e10cSrcweir aTabControl(this) 1165cdf0e10cSrcweir { 1166cdf0e10cSrcweir aTabControl.Show(); 1167cdf0e10cSrcweir } 1168cdf0e10cSrcweir 1169cdf0e10cSrcweir SvPropertyBox::SvPropertyBox( Window* pParent, const ResId& rResId ) 1170cdf0e10cSrcweir : Control(pParent,rResId), 1171cdf0e10cSrcweir aTabControl(this) 1172cdf0e10cSrcweir { 1173cdf0e10cSrcweir aTabControl.Show(); 1174cdf0e10cSrcweir Resize(); 1175cdf0e10cSrcweir } 1176cdf0e10cSrcweir 1177cdf0e10cSrcweir SvPropertyBox::~SvPropertyBox() 1178cdf0e10cSrcweir { 1179cdf0e10cSrcweir ClearAll(); 1180cdf0e10cSrcweir } 1181cdf0e10cSrcweir 1182cdf0e10cSrcweir 1183cdf0e10cSrcweir void SvPropertyBox::ClearAll() 1184cdf0e10cSrcweir { 1185cdf0e10cSrcweir sal_uInt16 nCount=aTabControl.GetPageCount(); 1186cdf0e10cSrcweir 1187cdf0e10cSrcweir for(sal_uInt16 i=nCount;i>=1;i--) 1188cdf0e10cSrcweir { 1189cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1190cdf0e10cSrcweir aTabControl.GetTabPage(i); 1191cdf0e10cSrcweir aTabControl.RemovePage(i); 1192cdf0e10cSrcweir delete pPage; 1193cdf0e10cSrcweir } 1194cdf0e10cSrcweir } 1195cdf0e10cSrcweir 1196cdf0e10cSrcweir 1197cdf0e10cSrcweir void SvPropertyBox::Resize() 1198cdf0e10cSrcweir { 1199cdf0e10cSrcweir Point aPos(3,3); 1200cdf0e10cSrcweir Size aSize=GetOutputSizePixel(); 1201cdf0e10cSrcweir aSize.Width()-=6; 1202cdf0e10cSrcweir aSize.Height()-=6; 1203cdf0e10cSrcweir 1204cdf0e10cSrcweir aTabControl.SetPosSizePixel(aPos,aSize); 1205cdf0e10cSrcweir 1206cdf0e10cSrcweir sal_uInt16 nCount=aTabControl.GetPageCount(); 1207cdf0e10cSrcweir 1208cdf0e10cSrcweir aSize=aTabControl.GetTabPageSizePixel(); 1209cdf0e10cSrcweir for(sal_uInt16 i=1;i<=nCount;i++) 1210cdf0e10cSrcweir { 1211cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1212cdf0e10cSrcweir aTabControl.GetTabPage(i); 1213cdf0e10cSrcweir pPage->SetSizePixel(aSize); 1214cdf0e10cSrcweir } 1215cdf0e10cSrcweir 1216cdf0e10cSrcweir } 1217cdf0e10cSrcweir 1218cdf0e10cSrcweir 1219cdf0e10cSrcweir sal_uInt16 SvPropertyBox::AppendPage( const String & rText ) 1220cdf0e10cSrcweir { 1221cdf0e10cSrcweir sal_uInt16 nId=aTabControl.GetPageCount()+1; 1222cdf0e10cSrcweir aTabControl.InsertPage( nId,rText); 1223cdf0e10cSrcweir SvTabPageForProperties* pPage=new SvTabPageForProperties(&aTabControl); 1224cdf0e10cSrcweir pPage->SetSizePixel(aTabControl.GetTabPageSizePixel()); 1225cdf0e10cSrcweir pPage->GetTheListBox()->SetController(pThePropDataCtr); 1226cdf0e10cSrcweir aTabControl.SetTabPage( nId, pPage); 1227cdf0e10cSrcweir aTabControl.SetCurPageId(nId); 1228cdf0e10cSrcweir return nId; 1229cdf0e10cSrcweir } 1230cdf0e10cSrcweir 1231cdf0e10cSrcweir void SvPropertyBox::SetPage( sal_uInt16 nId) 1232cdf0e10cSrcweir { 1233cdf0e10cSrcweir aTabControl.SetCurPageId(nId); 1234cdf0e10cSrcweir } 1235cdf0e10cSrcweir 1236cdf0e10cSrcweir sal_uInt16 SvPropertyBox::GetCurPage() 1237cdf0e10cSrcweir { 1238cdf0e10cSrcweir return aTabControl.GetCurPageId(); 1239cdf0e10cSrcweir } 1240cdf0e10cSrcweir 1241cdf0e10cSrcweir sal_uInt16 SvPropertyBox::CalcVisibleLines() 1242cdf0e10cSrcweir { 1243cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1244cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1245cdf0e10cSrcweir return pPage->GetTheListBox()->CalcVisibleLines(); 1246cdf0e10cSrcweir } 1247cdf0e10cSrcweir void SvPropertyBox::EnableUpdate() 1248cdf0e10cSrcweir { 1249cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1250cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1251cdf0e10cSrcweir pPage->GetTheListBox()->EnableUpdate(); 1252cdf0e10cSrcweir } 1253cdf0e10cSrcweir 1254cdf0e10cSrcweir void SvPropertyBox::DisableUpdate() 1255cdf0e10cSrcweir { 1256cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1257cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1258cdf0e10cSrcweir pPage->GetTheListBox()->DisableUpdate(); 1259cdf0e10cSrcweir } 1260cdf0e10cSrcweir 1261cdf0e10cSrcweir void SvPropertyBox::SetController(SvPropertyDataControl *pDataCtr) 1262cdf0e10cSrcweir { 1263cdf0e10cSrcweir pThePropDataCtr=pDataCtr; 1264cdf0e10cSrcweir sal_uInt16 nCount=aTabControl.GetPageCount(); 1265cdf0e10cSrcweir 1266cdf0e10cSrcweir for(sal_uInt16 i=1;i<=nCount;i++) 1267cdf0e10cSrcweir { 1268cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1269cdf0e10cSrcweir aTabControl.GetTabPage(i); 1270cdf0e10cSrcweir 1271cdf0e10cSrcweir pPage->GetTheListBox()->SetController(pThePropDataCtr); 1272cdf0e10cSrcweir } 1273cdf0e10cSrcweir 1274cdf0e10cSrcweir } 1275cdf0e10cSrcweir 1276cdf0e10cSrcweir sal_uInt16 SvPropertyBox::InsertEntry( const SvPropertyData& rData, sal_uInt16 nPos) 1277cdf0e10cSrcweir { 1278cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1279cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1280cdf0e10cSrcweir return pPage->GetTheListBox()->InsertEntry(rData,nPos); 1281cdf0e10cSrcweir } 1282cdf0e10cSrcweir 1283cdf0e10cSrcweir void SvPropertyBox::ChangeEntry( const SvPropertyData& rData, sal_uInt16 nPos) 1284cdf0e10cSrcweir { 1285cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1286cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1287cdf0e10cSrcweir pPage->GetTheListBox()->ChangeEntry(rData,nPos); 1288cdf0e10cSrcweir } 1289cdf0e10cSrcweir 1290cdf0e10cSrcweir sal_uInt16 SvPropertyBox::AppendEntry( const SvPropertyData& rData) 1291cdf0e10cSrcweir { 1292cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1293cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1294cdf0e10cSrcweir return pPage->GetTheListBox()->AppendEntry(rData); 1295cdf0e10cSrcweir } 1296cdf0e10cSrcweir 1297cdf0e10cSrcweir void SvPropertyBox::SetPropertyValue( const String & rEntryName, const String & rValue ) 1298cdf0e10cSrcweir { 1299cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1300cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1301cdf0e10cSrcweir pPage->GetTheListBox()->SetPropertyValue( rEntryName, rValue ); 1302cdf0e10cSrcweir } 1303cdf0e10cSrcweir 1304cdf0e10cSrcweir void SvPropertyBox::SetFirstVisibleEntry(sal_uInt16 nPos) 1305cdf0e10cSrcweir { 1306cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1307cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1308cdf0e10cSrcweir pPage->GetTheListBox()->SetFirstVisibleEntry(nPos); 1309cdf0e10cSrcweir } 1310cdf0e10cSrcweir sal_uInt16 SvPropertyBox::GetFirstVisibleEntry() 1311cdf0e10cSrcweir { 1312cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1313cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1314cdf0e10cSrcweir return pPage->GetTheListBox()->GetFirstVisibleEntry(); 1315cdf0e10cSrcweir } 1316cdf0e10cSrcweir 1317cdf0e10cSrcweir void SvPropertyBox::SetSelectedEntry(sal_uInt16 nPos) 1318cdf0e10cSrcweir { 1319cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1320cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1321cdf0e10cSrcweir pPage->GetTheListBox()->SetSelectedEntry(nPos); 1322cdf0e10cSrcweir } 1323cdf0e10cSrcweir sal_uInt16 SvPropertyBox::GetSelectedEntry() 1324cdf0e10cSrcweir { 1325cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1326cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1327cdf0e10cSrcweir return pPage->GetTheListBox()->GetSelectedEntry(); 1328cdf0e10cSrcweir } 1329cdf0e10cSrcweir 1330cdf0e10cSrcweir void SvPropertyBox::ClearTable() 1331cdf0e10cSrcweir { 1332cdf0e10cSrcweir SvTabPageForProperties* pPage=(SvTabPageForProperties*) 1333cdf0e10cSrcweir aTabControl.GetTabPage(aTabControl.GetCurPageId()); 1334cdf0e10cSrcweir pPage->GetTheListBox()->Clear(); 1335cdf0e10cSrcweir } 1336cdf0e10cSrcweir 1337cdf0e10cSrcweir SvBasicPropertyDataControl::~SvBasicPropertyDataControl() 1338cdf0e10cSrcweir { 1339cdf0e10cSrcweir } 1340cdf0e10cSrcweir 1341cdf0e10cSrcweir void SvBasicPropertyDataControl::Modified(const String& aName, 1342cdf0e10cSrcweir const String& aVal,void* pData) 1343cdf0e10cSrcweir { 1344cdf0e10cSrcweir aEntryName=aName; 1345cdf0e10cSrcweir aEntryProperty=aVal; 1346cdf0e10cSrcweir pTheData=pData; 1347cdf0e10cSrcweir aModifyLink.Call(this); 1348cdf0e10cSrcweir } 1349cdf0e10cSrcweir 1350cdf0e10cSrcweir void SvBasicPropertyDataControl::Clicked( const String& aName, 1351cdf0e10cSrcweir const String& aVal, 1352cdf0e10cSrcweir void* pData) //Xtension-Button pressed 1353cdf0e10cSrcweir { 1354cdf0e10cSrcweir aEntryName=aName; 1355cdf0e10cSrcweir aEntryProperty=aVal; 1356cdf0e10cSrcweir pTheData=pData; 1357cdf0e10cSrcweir aClickedLink.Call(this); 1358cdf0e10cSrcweir } 1359cdf0e10cSrcweir 1360cdf0e10cSrcweir void SvBasicPropertyDataControl::Commit( const String& aName, 1361cdf0e10cSrcweir const String& aVal, 1362cdf0e10cSrcweir void* pData) //User accept changes 1363cdf0e10cSrcweir { 1364cdf0e10cSrcweir aEntryName=aName; 1365cdf0e10cSrcweir aEntryProperty=aVal; 1366cdf0e10cSrcweir pTheData=pData; 1367cdf0e10cSrcweir aCommitLink.Call(this); 1368cdf0e10cSrcweir } 1369cdf0e10cSrcweir 1370cdf0e10cSrcweir void SvBasicPropertyDataControl::Select( const String& aName, 1371cdf0e10cSrcweir void* pData) //User select new Row 1372cdf0e10cSrcweir { 1373cdf0e10cSrcweir aEntryName=aName; 1374cdf0e10cSrcweir pTheData=pData; 1375cdf0e10cSrcweir aSelectLink.Call(this); 1376cdf0e10cSrcweir } 1377cdf0e10cSrcweir 1378cdf0e10cSrcweir void SvBasicPropertyDataControl::LinkClicked(const String&, void*) 1379cdf0e10cSrcweir { 1380cdf0e10cSrcweir } 1381cdf0e10cSrcweir 1382cdf0e10cSrcweir 1383cdf0e10cSrcweir String SvBasicPropertyDataControl::GetName() const //Tell's the name of the Property 1384cdf0e10cSrcweir { 1385cdf0e10cSrcweir return aEntryName; 1386cdf0e10cSrcweir } 1387cdf0e10cSrcweir 1388cdf0e10cSrcweir String SvBasicPropertyDataControl::GetProperty() const //Tell's the content of the Property 1389cdf0e10cSrcweir { 1390cdf0e10cSrcweir return aEntryProperty; 1391cdf0e10cSrcweir } 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir void* SvBasicPropertyDataControl::GetData() //Tell's the storage 1394cdf0e10cSrcweir { 1395cdf0e10cSrcweir return pTheData; 1396cdf0e10cSrcweir } 1397cdf0e10cSrcweir 1398cdf0e10cSrcweir /* 1399cdf0e10cSrcweir String SvBasicPropertyDataControl::GetTheCorrectProperty() const 1400cdf0e10cSrcweir { 1401cdf0e10cSrcweir return aCorrectProperty; 1402cdf0e10cSrcweir } 1403cdf0e10cSrcweir */ 1404cdf0e10cSrcweir 1405cdf0e10cSrcweir void SvBasicPropertyDataControl::SetTheCorrectProperty(const String& aString) 1406cdf0e10cSrcweir { 1407cdf0e10cSrcweir aCorrectProperty=aString; 1408cdf0e10cSrcweir } 1409cdf0e10cSrcweir 1410cdf0e10cSrcweir void SvBasicPropertyDataControl::SetIsCorrect(sal_Bool nFlag) 1411cdf0e10cSrcweir { 1412cdf0e10cSrcweir bCorrectness=nFlag; 1413cdf0e10cSrcweir } 1414cdf0e10cSrcweir 1415cdf0e10cSrcweir 1416cdf0e10cSrcweir 1417cdf0e10cSrcweir //======================================================================== 1418cdf0e10cSrcweir // Property-Dialog: 1419cdf0e10cSrcweir /* zum TESTEN im CALC*/ 1420cdf0e10cSrcweir //======================================================================== 1421cdf0e10cSrcweir /* 1422cdf0e10cSrcweir ScPropertyDlg::ScPropertyDlg( Window* pParent) : 1423cdf0e10cSrcweir ModalDialog ( pParent, ScResId( RID_SCDLG_PROPERTIES) ), 1424cdf0e10cSrcweir aPropListBox ( this, ResId( CTR_PROPLINE) ), 1425cdf0e10cSrcweir aKindOfListBox (this,ResId( LB_KIND_OF_PROP)), 1426cdf0e10cSrcweir aModAnswer (this,ResId(FT_ANSMOD )), 1427cdf0e10cSrcweir aClickAnswer (this,ResId(FT_ANSCLICK )), 1428cdf0e10cSrcweir aCommitAnswer (this,ResId(FT_ANSCOMMIT)), 1429cdf0e10cSrcweir aSelectAnswer (this,ResId(FT_ANSSELECT)), 1430cdf0e10cSrcweir anOk(this,ResId( BTN_OK)), 1431cdf0e10cSrcweir aCancel(this,ResId( BTN_CANCEL)) 1432cdf0e10cSrcweir { 1433cdf0e10cSrcweir FreeResource(); 1434cdf0e10cSrcweir 1435cdf0e10cSrcweir aKindOfListBox.SelectEntryPos(0); 1436cdf0e10cSrcweir aKindOfListBox.SetSelectHdl( 1437cdf0e10cSrcweir LINK( this, ScPropertyDlg, ModifiedHdl )); 1438cdf0e10cSrcweir nCount=0; 1439cdf0e10cSrcweir nClickCount=0; 1440cdf0e10cSrcweir 1441cdf0e10cSrcweir String aString("Don't know "); 1442cdf0e10cSrcweir 1443cdf0e10cSrcweir aBaProDatCtr.SetModifyHdl (LINK( this, ScPropertyDlg, RowModifiedHdl )); 1444cdf0e10cSrcweir aBaProDatCtr.SetClickedHdl(LINK( this, ScPropertyDlg, ClickHdl )); 1445cdf0e10cSrcweir aBaProDatCtr.SetCommitHdl (LINK( this, ScPropertyDlg, SelectHdl )); 1446cdf0e10cSrcweir aBaProDatCtr.SetSelectHdl (LINK( this, ScPropertyDlg, CommitHdl )); 1447cdf0e10cSrcweir 1448cdf0e10cSrcweir aPropListBox.SetController(&aBaProDatCtr); 1449cdf0e10cSrcweir 1450cdf0e10cSrcweir sal_uInt16 nPageId=aPropListBox.AppendPage("YabbaDabbaDo"); 1451cdf0e10cSrcweir aPropListBox.SetPage(nPageId); 1452cdf0e10cSrcweir aProperty.eKind=KOC_EDIT; 1453cdf0e10cSrcweir aProperty.aName=aString; 1454cdf0e10cSrcweir aProperty.aName+=String((sal_uInt16)++nCount); 1455cdf0e10cSrcweir aProperty.aValue=sizeof ComboBox; 1456cdf0e10cSrcweir aProperty.bHasVisibleXButton=sal_False; 1457cdf0e10cSrcweir aProperty.bIsHyperLink=sal_False; 1458cdf0e10cSrcweir aProperty.bIsLocked=sal_False; 1459cdf0e10cSrcweir aProperty.pDataPtr=NULL; 1460cdf0e10cSrcweir aProperty.pControl=NULL; 1461cdf0e10cSrcweir aProperty.theValues.Insert(new String("1"),aProperty.theValues.Count()); 1462cdf0e10cSrcweir aProperty.theValues.Insert(new String("2"),aProperty.theValues.Count()); 1463cdf0e10cSrcweir aProperty.theValues.Insert(new String("3"),aProperty.theValues.Count()); 1464cdf0e10cSrcweir aProperty.theValues.Insert(new String("4"),aProperty.theValues.Count()); 1465cdf0e10cSrcweir aPropListBox.InsertEntry(aProperty); 1466cdf0e10cSrcweir aProperty.bHasVisibleXButton=sal_True; 1467cdf0e10cSrcweir aProperty.aName=aString; 1468cdf0e10cSrcweir aProperty.aName+=String((sal_uInt16)++nCount); 1469cdf0e10cSrcweir aProperty.aValue="42"; 1470cdf0e10cSrcweir aProperty.eKind=KOC_LISTBOX; 1471cdf0e10cSrcweir aPropListBox.InsertEntry(aProperty); 1472cdf0e10cSrcweir aProperty.aName=aString; 1473cdf0e10cSrcweir aProperty.aName+=String((sal_uInt16)++nCount); 1474cdf0e10cSrcweir aProperty.eKind=KOC_COMBOBOX; 1475cdf0e10cSrcweir aProperty.bHasVisibleXButton=sal_False; 1476cdf0e10cSrcweir aPropListBox.InsertEntry(aProperty); 1477cdf0e10cSrcweir } 1478cdf0e10cSrcweir 1479cdf0e10cSrcweir ScPropertyDlg::~ScPropertyDlg() 1480cdf0e10cSrcweir { 1481cdf0e10cSrcweir delete aProperty.theValues[0]; 1482cdf0e10cSrcweir delete aProperty.theValues[1]; 1483cdf0e10cSrcweir delete aProperty.theValues[2]; 1484cdf0e10cSrcweir delete aProperty.theValues[3]; 1485cdf0e10cSrcweir } 1486cdf0e10cSrcweir 1487cdf0e10cSrcweir IMPL_LINK( ScPropertyDlg, ModifiedHdl, ListBox*, pLB ) 1488cdf0e10cSrcweir { 1489cdf0e10cSrcweir if(pLB!=NULL) 1490cdf0e10cSrcweir { 1491cdf0e10cSrcweir String aString("Don't know "); 1492cdf0e10cSrcweir aProperty.aName=aString; 1493cdf0e10cSrcweir aProperty.aName+=String((sal_uInt16)++nCount); 1494cdf0e10cSrcweir if(nCount>20) 1495cdf0e10cSrcweir { 1496cdf0e10cSrcweir String aStr("Yabba "); 1497cdf0e10cSrcweir aStr+=aPropListBox.GetCurPage(); 1498cdf0e10cSrcweir sal_uInt16 nPageId=aPropListBox.AppendPage(aStr); 1499cdf0e10cSrcweir aPropListBox.SetPage(nPageId); 1500cdf0e10cSrcweir nCount=0; 1501cdf0e10cSrcweir } 1502cdf0e10cSrcweir 1503cdf0e10cSrcweir aProperty.eKind=(eKindOfControl)(aKindOfListBox.GetSelectEntryPos()+1); 1504cdf0e10cSrcweir aProperty.bHasVisibleXButton=sal_False; 1505cdf0e10cSrcweir if((nCount % 5)==0) aProperty.bHasVisibleXButton=sal_True; 1506cdf0e10cSrcweir aPropListBox.InsertEntry(aProperty); 1507cdf0e10cSrcweir } 1508cdf0e10cSrcweir return 0; 1509cdf0e10cSrcweir } 1510cdf0e10cSrcweir 1511cdf0e10cSrcweir IMPL_LINK( ScPropertyDlg, RowModifiedHdl, SvBasicPropertyDataControl* ,pProCtr) 1512cdf0e10cSrcweir { 1513cdf0e10cSrcweir if(pProCtr!=NULL) 1514cdf0e10cSrcweir { 1515cdf0e10cSrcweir aModAnswer.SetText(aBaProDatCtr.GetProperty()); 1516cdf0e10cSrcweir aModAnswer.Invalidate(); 1517cdf0e10cSrcweir aBaProDatCtr.SetIsCorrect(sal_True); 1518cdf0e10cSrcweir } 1519cdf0e10cSrcweir return 0; 1520cdf0e10cSrcweir } 1521cdf0e10cSrcweir 1522cdf0e10cSrcweir IMPL_LINK( ScPropertyDlg, CommitHdl, SvBasicPropertyDataControl*,pProCtr) 1523cdf0e10cSrcweir { 1524cdf0e10cSrcweir if(pProCtr!=NULL) 1525cdf0e10cSrcweir { 1526cdf0e10cSrcweir aCommitAnswer.SetText(aBaProDatCtr.GetProperty()); 1527cdf0e10cSrcweir aCommitAnswer.Invalidate(); 1528cdf0e10cSrcweir aBaProDatCtr.SetIsCorrect(sal_True); 1529cdf0e10cSrcweir } 1530cdf0e10cSrcweir return 0; 1531cdf0e10cSrcweir } 1532cdf0e10cSrcweir 1533cdf0e10cSrcweir IMPL_LINK( ScPropertyDlg, ClickHdl, SvBasicPropertyDataControl*,pProCtr) 1534cdf0e10cSrcweir { 1535cdf0e10cSrcweir if(pProCtr!=NULL) 1536cdf0e10cSrcweir { 1537cdf0e10cSrcweir aClickAnswer.SetText(aBaProDatCtr.GetName()); 1538cdf0e10cSrcweir aClickAnswer.Invalidate(); 1539cdf0e10cSrcweir aBaProDatCtr.SetIsCorrect(sal_True); 1540cdf0e10cSrcweir } 1541cdf0e10cSrcweir return 0; 1542cdf0e10cSrcweir } 1543cdf0e10cSrcweir 1544cdf0e10cSrcweir IMPL_LINK( ScPropertyDlg, SelectHdl, SvBasicPropertyDataControl*,pProCtr) 1545cdf0e10cSrcweir { 1546cdf0e10cSrcweir if(pProCtr!=NULL) 1547cdf0e10cSrcweir { 1548cdf0e10cSrcweir aSelectAnswer.SetText(aBaProDatCtr.GetName()); 1549cdf0e10cSrcweir aSelectAnswer.Invalidate(); 1550cdf0e10cSrcweir aBaProDatCtr.SetIsCorrect(sal_True); 1551cdf0e10cSrcweir } 1552cdf0e10cSrcweir return 0; 1553cdf0e10cSrcweir } 1554cdf0e10cSrcweir */ 1555