TableDesignPane.cxx (79aad27f) | TableDesignPane.cxx (f6859a6b) |
---|---|
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 --- 91 unchanged lines hidden (view full) --- 100, mrBase( rBase ) 101, msTableTemplate( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) ) 102, mbModal( bModal ) 103, mbStyleSelected( false ) 104, mbOptionsChanged( false ) 105{ 106 Window* pControlParent = mbModal ? pParent : this; 107 | 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 --- 91 unchanged lines hidden (view full) --- 100, mrBase( rBase ) 101, msTableTemplate( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) ) 102, mbModal( bModal ) 103, mbStyleSelected( false ) 104, mbOptionsChanged( false ) 105{ 106 Window* pControlParent = mbModal ? pParent : this; 107 |
108 mxControls[FL_TABLE_STYLES].reset( new FixedLine( pControlParent, SdResId( FL_TABLE_STYLES + 1 ) ) ); | 108 // mxControls[FL_TABLE_STYLES].reset( new FixedLine( pControlParent, SdResId( FL_TABLE_STYLES + 1 ) ) ); |
109 110 ValueSet* pValueSet = new ValueSet( pControlParent, SdResId( CT_TABLE_STYLES+1 ) ); 111 mxControls[CT_TABLE_STYLES].reset( pValueSet ); 112 if( !mbModal ) 113 { 114 pValueSet->SetStyle( (pValueSet->GetStyle() & ~(WB_ITEMBORDER|WB_BORDER)) | WB_NO_DIRECTSELECT | WB_FLATVALUESET | WB_NOBORDER ); 115 pValueSet->SetColor(); 116 pValueSet->SetExtraSpacing(8); 117 } 118 else 119 { 120 pValueSet->SetColor( Color( COL_WHITE ) ); 121 pValueSet->SetBackground( Color( COL_WHITE ) ); 122 } 123 pValueSet->SetSelectHdl (LINK(this, TableDesignPane, implValueSetHdl)); 124 | 109 110 ValueSet* pValueSet = new ValueSet( pControlParent, SdResId( CT_TABLE_STYLES+1 ) ); 111 mxControls[CT_TABLE_STYLES].reset( pValueSet ); 112 if( !mbModal ) 113 { 114 pValueSet->SetStyle( (pValueSet->GetStyle() & ~(WB_ITEMBORDER|WB_BORDER)) | WB_NO_DIRECTSELECT | WB_FLATVALUESET | WB_NOBORDER ); 115 pValueSet->SetColor(); 116 pValueSet->SetExtraSpacing(8); 117 } 118 else 119 { 120 pValueSet->SetColor( Color( COL_WHITE ) ); 121 pValueSet->SetBackground( Color( COL_WHITE ) ); 122 } 123 pValueSet->SetSelectHdl (LINK(this, TableDesignPane, implValueSetHdl)); 124 |
125 mxControls[FL_STYLE_OPTIONS].reset( new FixedLine( pControlParent, SdResId( FL_STYLE_OPTIONS + 1 ) ) ); | 125 // mxControls[FL_STYLE_OPTIONS].reset( new FixedLine( pControlParent, SdResId( FL_STYLE_OPTIONS + 1 ) ) ); |
126 sal_uInt16 i; 127 for( i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i ) 128 { 129 CheckBox *pCheckBox = new CheckBox( pControlParent, SdResId( i+1 ) ); 130 mxControls[i].reset( pCheckBox ); 131 pCheckBox->SetClickHdl( LINK( this, TableDesignPane, implCheckBoxHdl ) ); 132 } 133 134 for( i = 0; i < DESIGNPANE_CONTROL_COUNT; i++ ) | 126 sal_uInt16 i; 127 for( i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i ) 128 { 129 CheckBox *pCheckBox = new CheckBox( pControlParent, SdResId( i+1 ) ); 130 mxControls[i].reset( pCheckBox ); 131 pCheckBox->SetClickHdl( LINK( this, TableDesignPane, implCheckBoxHdl ) ); 132 } 133 134 for( i = 0; i < DESIGNPANE_CONTROL_COUNT; i++ ) |
135 mnOrgOffsetY[i] = mxControls[i]->GetPosPixel().Y(); 136 | 135 { 136 if (mxControls[i]) 137 mnOrgOffsetY[i] = mxControls[i]->GetPosPixel().Y(); 138 else if (i > 0) 139 mnOrgOffsetY[i] = mnOrgOffsetY[i-1]; 140 else 141 mnOrgOffsetY[i] = 0; 142 } 143 |
137 // get current controller and initialize listeners 138 try 139 { 140 mxView = Reference< XDrawView >::query(mrBase.GetController()); 141 addListener(); 142 143 Reference< XController > xController( mrBase.GetController(), UNO_QUERY_THROW ); 144 Reference< XStyleFamiliesSupplier > xFamiliesSupp( xController->getModel(), UNO_QUERY_THROW ); --- 30 unchanged lines hidden (view full) --- 175 176// -------------------------------------------------------------------- 177 178void TableDesignPane::Resize() 179{ 180 updateLayout(); 181} 182 | 144 // get current controller and initialize listeners 145 try 146 { 147 mxView = Reference< XDrawView >::query(mrBase.GetController()); 148 addListener(); 149 150 Reference< XController > xController( mrBase.GetController(), UNO_QUERY_THROW ); 151 Reference< XStyleFamiliesSupplier > xFamiliesSupp( xController->getModel(), UNO_QUERY_THROW ); --- 30 unchanged lines hidden (view full) --- 182 183// -------------------------------------------------------------------- 184 185void TableDesignPane::Resize() 186{ 187 updateLayout(); 188} 189 |
190 191 192 193LayoutSize TableDesignPane::GetHeightForWidth (const sal_Int32 nWidth) 194{ 195 if ( ! IsVisible() || nWidth<=0) 196 return LayoutSize(0,0,0); 197 198 // Initialize the height with the offset above and below the value 199 // set and below the check boxes. 200 const Point aOffset (LogicToPixel( Point(3,3), MAP_APPFONT)); 201 sal_Int32 nHeight (3 * aOffset.Y()); 202 203 // Add the height for the check boxes. 204 nHeight += mnOrgOffsetY[CB_BANDED_COLUMNS] - mnOrgOffsetY[CB_HEADER_ROW] 205 + mxControls[CB_BANDED_COLUMNS]->GetSizePixel().Height(); 206 207 // Setup minimal and maximal heights that include all check boxes 208 // and a small or large value set. 209 const sal_Int32 nMinimalHeight (nHeight+100); 210 const sal_Int32 nMaximalHeight (nHeight+450); 211 212 // Calculate the number of rows and columns and then add the 213 // preferred size of the value set. 214 ValueSet* pValueSet = static_cast< ValueSet* >( mxControls[CT_TABLE_STYLES].get() ); 215 if (pValueSet->GetItemCount() > 0) 216 { 217 Image aImage = pValueSet->GetItemImage(pValueSet->GetItemId(0)); 218 Size aItemSize = pValueSet->CalcItemSizePixel(aImage.GetSizePixel()); 219 aItemSize.Width() += 10; 220 aItemSize.Height() += 10; 221 222 int nColumnCount = (pValueSet->GetSizePixel().Width() - pValueSet->GetScrollWidth()) / aItemSize.Width(); 223 if (nColumnCount < 1) 224 nColumnCount = 1; 225 226 int nRowCount = (pValueSet->GetItemCount() + nColumnCount - 1) / nColumnCount; 227 if (nRowCount < 1) 228 nRowCount = 1; 229 230 nHeight += nRowCount * aItemSize.Height(); 231 } 232 233 // Clip the requested height. 234 if (nHeight<nMinimalHeight) 235 nHeight = nMinimalHeight; 236 else if (nHeight>nMaximalHeight) 237 nHeight = nMaximalHeight; 238 return LayoutSize(nMinimalHeight, nMaximalHeight, nHeight); 239} 240 241 242 243 |
|
183// -------------------------------------------------------------------- 184 185static SfxBindings* getBindings( ViewShellBase& rBase ) 186{ 187 if( rBase.GetMainViewShell().get() && rBase.GetMainViewShell()->GetViewFrame() ) 188 return &rBase.GetMainViewShell()->GetViewFrame()->GetBindings(); 189 else 190 return 0; --- 182 unchanged lines hidden (view full) --- 373 Size aValueSetSize; 374 375 if( !mbModal ) 376 { 377 const long nOptionsHeight = mnOrgOffsetY[CB_BANDED_COLUMNS] + mxControls[CB_BANDED_COLUMNS]->GetSizePixel().Height() + aOffset.Y(); 378 379 const long nStylesHeight = aPaneSize.Height() - nOptionsHeight; 380 | 244// -------------------------------------------------------------------- 245 246static SfxBindings* getBindings( ViewShellBase& rBase ) 247{ 248 if( rBase.GetMainViewShell().get() && rBase.GetMainViewShell()->GetViewFrame() ) 249 return &rBase.GetMainViewShell()->GetViewFrame()->GetBindings(); 250 else 251 return 0; --- 182 unchanged lines hidden (view full) --- 434 Size aValueSetSize; 435 436 if( !mbModal ) 437 { 438 const long nOptionsHeight = mnOrgOffsetY[CB_BANDED_COLUMNS] + mxControls[CB_BANDED_COLUMNS]->GetSizePixel().Height() + aOffset.Y(); 439 440 const long nStylesHeight = aPaneSize.Height() - nOptionsHeight; 441 |
381 // set with of controls to size of pane | 442 // set width of controls to size of pane |
382 for( sal_Int32 nId = 0; nId < DESIGNPANE_CONTROL_COUNT; ++nId ) 383 { | 443 for( sal_Int32 nId = 0; nId < DESIGNPANE_CONTROL_COUNT; ++nId ) 444 { |
384 Size aSize( mxControls[nId]->GetSizePixel() ); 385 aSize.Width() = aPaneSize.Width() - aOffset.X() - mxControls[nId]->GetPosPixel().X(); 386 mxControls[nId]->SetSizePixel( aSize ); 387 mxControls[nId]->SetPaintTransparent(sal_True); 388 mxControls[nId]->SetBackground(); | 445 if (mxControls[nId]) 446 { 447 Size aSize( mxControls[nId]->GetSizePixel() ); 448 aSize.Width() = aPaneSize.Width() - aOffset.X() - mxControls[nId]->GetPosPixel().X(); 449 mxControls[nId]->SetSizePixel( aSize ); 450 mxControls[nId]->SetPaintTransparent(sal_True); 451 mxControls[nId]->SetBackground(); 452 } |
389 } | 453 } |
390 aValueSetSize = Size( pValueSet->GetSizePixel().Width(), nStylesHeight - mxControls[FL_TABLE_STYLES]->GetSizePixel().Height() - mnOrgOffsetY[FL_TABLE_STYLES] ); | 454 aValueSetSize = Size( pValueSet->GetSizePixel().Width(), nStylesHeight ); |
391 } 392 else 393 { 394 aValueSetSize = pValueSet->GetSizePixel(); 395 } 396 397 398 // Calculate the number of rows and columns. --- 45 unchanged lines hidden (view full) --- 444 Point aPos( pValueSet->GetPosPixel() ); 445 446 // The following line may look like a no-op but without it the 447 // control is placed off-screen when RTL is active. 448 pValueSet->SetPosPixel(pValueSet->GetPosPixel()); 449 450 // shift show options section down 451 const long nOptionsPos = aPos.Y() + aValueSetSize.Height(); | 455 } 456 else 457 { 458 aValueSetSize = pValueSet->GetSizePixel(); 459 } 460 461 462 // Calculate the number of rows and columns. --- 45 unchanged lines hidden (view full) --- 508 Point aPos( pValueSet->GetPosPixel() ); 509 510 // The following line may look like a no-op but without it the 511 // control is placed off-screen when RTL is active. 512 pValueSet->SetPosPixel(pValueSet->GetPosPixel()); 513 514 // shift show options section down 515 const long nOptionsPos = aPos.Y() + aValueSetSize.Height(); |
452 for( sal_Int32 nId = FL_STYLE_OPTIONS; nId <= CB_BANDED_COLUMNS; ++nId ) | 516 sal_Int32 nMaxY (0); 517 for( sal_Int32 nId = FL_STYLE_OPTIONS+1; nId <= CB_BANDED_COLUMNS; ++nId ) |
453 { | 518 { |
454 Point aCPos( mxControls[nId]->GetPosPixel() ); 455 aCPos.X() = ( nId == FL_STYLE_OPTIONS ? 1 : 2 ) * aOffset.X(); 456 aCPos.Y() = mnOrgOffsetY[nId] + nOptionsPos; 457 mxControls[nId]->SetPosPixel( aCPos ); | 519 if (mxControls[nId]) 520 { 521 Point aCPos( mxControls[nId]->GetPosPixel() ); 522 aCPos.X() = ( nId == FL_STYLE_OPTIONS ? 1 : 2 ) * aOffset.X(); 523 aCPos.Y() = mnOrgOffsetY[nId] + nOptionsPos; 524 mxControls[nId]->SetPosPixel( aCPos ); 525 const sal_Int32 nBottom (aCPos.Y() + mxControls[nId]->GetSizePixel().Height()); 526 if (nBottom > nMaxY) 527 nMaxY = nBottom; 528 } |
458 } 459 } 460 } | 529 } 530 } 531 } |
461 462 if( !mbModal ) 463 SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); | |
464} 465 466// -------------------------------------------------------------------- 467 468void TableDesignPane::updateControls() 469{ 470 static sal_Bool gDefaults[CB_BANDED_COLUMNS-CB_HEADER_ROW+1] = { sal_True, sal_False, sal_True, sal_False, sal_False, sal_False }; 471 --- 476 unchanged lines hidden --- | 532} 533 534// -------------------------------------------------------------------- 535 536void TableDesignPane::updateControls() 537{ 538 static sal_Bool gDefaults[CB_BANDED_COLUMNS-CB_HEADER_ROW+1] = { sal_True, sal_False, sal_True, sal_False, sal_False, sal_False }; 539 --- 476 unchanged lines hidden --- |