linectrl.cxx (97e8a929) linectrl.cxx (c7be74b1)
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

--- 365 unchanged lines hidden (view full) ---

374
375SvxLineEndWindow::SvxLineEndWindow(
376 sal_uInt16 nSlotId,
377 const Reference< XFrame >& rFrame,
378 const String& rWndTitle ) :
379 SfxPopupWindow( nSlotId,
380 rFrame,
381 WinBits( WB_BORDER | WB_STDFLOATWIN | WB_SIZEABLE | WB_3DLOOK ) ),
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

--- 365 unchanged lines hidden (view full) ---

374
375SvxLineEndWindow::SvxLineEndWindow(
376 sal_uInt16 nSlotId,
377 const Reference< XFrame >& rFrame,
378 const String& rWndTitle ) :
379 SfxPopupWindow( nSlotId,
380 rFrame,
381 WinBits( WB_BORDER | WB_STDFLOATWIN | WB_SIZEABLE | WB_3DLOOK ) ),
382 pLineEndList ( NULL ),
382 maLineEndList(),
383 aLineEndSet ( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
384 nCols ( 2 ),
385 nLines ( 12 ),
386 nLineEndWidth ( 400 ),
387 bPopupMode ( sal_True ),
388 mbInResize ( false ),
389 mxFrame ( rFrame )
390{

--- 5 unchanged lines hidden (view full) ---

396 sal_uInt16 nSlotId,
397 const Reference< XFrame >& rFrame,
398 Window* pParentWindow,
399 const String& rWndTitle ) :
400 SfxPopupWindow( nSlotId,
401 rFrame,
402 pParentWindow,
403 WinBits( WB_BORDER | WB_STDFLOATWIN | WB_SIZEABLE | WB_3DLOOK ) ),
383 aLineEndSet ( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
384 nCols ( 2 ),
385 nLines ( 12 ),
386 nLineEndWidth ( 400 ),
387 bPopupMode ( sal_True ),
388 mbInResize ( false ),
389 mxFrame ( rFrame )
390{

--- 5 unchanged lines hidden (view full) ---

396 sal_uInt16 nSlotId,
397 const Reference< XFrame >& rFrame,
398 Window* pParentWindow,
399 const String& rWndTitle ) :
400 SfxPopupWindow( nSlotId,
401 rFrame,
402 pParentWindow,
403 WinBits( WB_BORDER | WB_STDFLOATWIN | WB_SIZEABLE | WB_3DLOOK ) ),
404 pLineEndList ( NULL ),
404 maLineEndList(),
405 aLineEndSet ( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
406 nCols ( 2 ),
407 nLines ( 12 ),
408 nLineEndWidth ( 400 ),
409 bPopupMode ( sal_True ),
410 mbInResize ( false ),
411 mxFrame ( rFrame )
412{

--- 8 unchanged lines hidden (view full) ---

421
422 SetHelpId( HID_POPUP_LINEEND );
423 aLineEndSet.SetHelpId( HID_POPUP_LINEEND_CTRL );
424
425 if ( pDocSh )
426 {
427 pItem = pDocSh->GetItem( SID_LINEEND_LIST );
428 if( pItem )
405 aLineEndSet ( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
406 nCols ( 2 ),
407 nLines ( 12 ),
408 nLineEndWidth ( 400 ),
409 bPopupMode ( sal_True ),
410 mbInResize ( false ),
411 mxFrame ( rFrame )
412{

--- 8 unchanged lines hidden (view full) ---

421
422 SetHelpId( HID_POPUP_LINEEND );
423 aLineEndSet.SetHelpId( HID_POPUP_LINEEND_CTRL );
424
425 if ( pDocSh )
426 {
427 pItem = pDocSh->GetItem( SID_LINEEND_LIST );
428 if( pItem )
429 pLineEndList = ( (SvxLineEndListItem*) pItem )->GetLineEndList();
429 maLineEndList = static_cast< const SvxLineEndListItem* >(pItem)->GetLineEndList();
430
431 pItem = pDocSh->GetItem( SID_ATTR_LINEEND_WIDTH_DEFAULT );
432 if( pItem )
433 nLineEndWidth = ( (SfxUInt16Item*) pItem )->GetValue();
434 }
430
431 pItem = pDocSh->GetItem( SID_ATTR_LINEEND_WIDTH_DEFAULT );
432 if( pItem )
433 nLineEndWidth = ( (SfxUInt16Item*) pItem )->GetValue();
434 }
435 DBG_ASSERT( pLineEndList, "LineEndList wurde nicht gefunden" );
435 DBG_ASSERT( maLineEndList.get(), "LineEndList wurde nicht gefunden" );
436
437 aLineEndSet.SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) );
438 aLineEndSet.SetColCount( nCols );
439
440 // ValueSet mit Eintraegen der LineEndList fuellen
441 FillValueSet();
442
443 AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineEndListState" )));

--- 26 unchanged lines hidden (view full) ---

470 pLineStartItem = new XLineStartItem();
471 }
472 else if( nId == 2 )
473 {
474 pLineEndItem = new XLineEndItem();
475 }
476 else if( nId % 2 ) // LinienAnfang
477 {
436
437 aLineEndSet.SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) );
438 aLineEndSet.SetColCount( nCols );
439
440 // ValueSet mit Eintraegen der LineEndList fuellen
441 FillValueSet();
442
443 AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineEndListState" )));

--- 26 unchanged lines hidden (view full) ---

470 pLineStartItem = new XLineStartItem();
471 }
472 else if( nId == 2 )
473 {
474 pLineEndItem = new XLineEndItem();
475 }
476 else if( nId % 2 ) // LinienAnfang
477 {
478 XLineEndEntry* pEntry = pLineEndList->GetLineEnd( ( nId - 1 ) / 2 - 1 );
478 XLineEndEntry* pEntry = maLineEndList->GetLineEnd( ( nId - 1 ) / 2 - 1 );
479 pLineStartItem = new XLineStartItem( pEntry->GetName(), pEntry->GetLineEnd() );
480 }
481 else // LinienEnde
482 {
479 pLineStartItem = new XLineStartItem( pEntry->GetName(), pEntry->GetLineEnd() );
480 }
481 else // LinienEnde
482 {
483 XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nId / 2 - 2 );
483 XLineEndEntry* pEntry = maLineEndList->GetLineEnd( nId / 2 - 2 );
484 pLineEndItem = new XLineEndItem( pEntry->GetName(), pEntry->GetLineEnd() );
485 }
486
487 if ( IsInPopupMode() )
488 EndPopupMode();
489
490 Sequence< PropertyValue > aArgs( 1 );
491 Any a;

--- 25 unchanged lines hidden (view full) ---

517
518 return 0;
519}
520
521// -----------------------------------------------------------------------
522
523void SvxLineEndWindow::FillValueSet()
524{
484 pLineEndItem = new XLineEndItem( pEntry->GetName(), pEntry->GetLineEnd() );
485 }
486
487 if ( IsInPopupMode() )
488 EndPopupMode();
489
490 Sequence< PropertyValue > aArgs( 1 );
491 Any a;

--- 25 unchanged lines hidden (view full) ---

517
518 return 0;
519}
520
521// -----------------------------------------------------------------------
522
523void SvxLineEndWindow::FillValueSet()
524{
525 if( pLineEndList )
525 if(maLineEndList.get())
526 {
527 XLineEndEntry* pEntry = NULL;
528 VirtualDevice aVD;
529
526 {
527 XLineEndEntry* pEntry = NULL;
528 VirtualDevice aVD;
529
530 long nCount = pLineEndList->Count();
530 long nCount = maLineEndList->Count();
531
532 // Erster Eintrag: kein LinienEnde
533 // Temporaer wird ein Eintrag hinzugefuegt, um die UI-Bitmap zu erhalten
534 basegfx::B2DPolyPolygon aNothing;
531
532 // Erster Eintrag: kein LinienEnde
533 // Temporaer wird ein Eintrag hinzugefuegt, um die UI-Bitmap zu erhalten
534 basegfx::B2DPolyPolygon aNothing;
535 pLineEndList->Insert( new XLineEndEntry( aNothing, SVX_RESSTR( RID_SVXSTR_NONE ) ) );
536 pEntry = pLineEndList->GetLineEnd( nCount );
537 Bitmap aBmp = pLineEndList->GetUiBitmap( nCount );
535 maLineEndList->Insert( new XLineEndEntry( aNothing, SVX_RESSTR( RID_SVXSTR_NONE ) ) );
536 pEntry = maLineEndList->GetLineEnd( nCount );
537 Bitmap aBmp = maLineEndList->GetUiBitmap( nCount );
538 OSL_ENSURE( !aBmp.IsEmpty(), "UI-Bitmap wurde nicht erzeugt" );
539
540 aBmpSize = aBmp.GetSizePixel();
541 aVD.SetOutputSizePixel( aBmpSize, sal_False );
542 aBmpSize.Width() = aBmpSize.Width() / 2;
543 Point aPt0( 0, 0 );
544 Point aPt1( aBmpSize.Width(), 0 );
545
546 aVD.DrawBitmap( Point(), aBmp );
547 aLineEndSet.InsertItem( 1, aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() );
548 aLineEndSet.InsertItem( 2, aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() );
549
538 OSL_ENSURE( !aBmp.IsEmpty(), "UI-Bitmap wurde nicht erzeugt" );
539
540 aBmpSize = aBmp.GetSizePixel();
541 aVD.SetOutputSizePixel( aBmpSize, sal_False );
542 aBmpSize.Width() = aBmpSize.Width() / 2;
543 Point aPt0( 0, 0 );
544 Point aPt1( aBmpSize.Width(), 0 );
545
546 aVD.DrawBitmap( Point(), aBmp );
547 aLineEndSet.InsertItem( 1, aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() );
548 aLineEndSet.InsertItem( 2, aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() );
549
550 delete pLineEndList->Remove( nCount );
550 delete maLineEndList->Remove( nCount );
551
552 for( long i = 0; i < nCount; i++ )
553 {
551
552 for( long i = 0; i < nCount; i++ )
553 {
554 pEntry = pLineEndList->GetLineEnd( i );
554 pEntry = maLineEndList->GetLineEnd( i );
555 DBG_ASSERT( pEntry, "Konnte auf LineEndEntry nicht zugreifen" );
555 DBG_ASSERT( pEntry, "Konnte auf LineEndEntry nicht zugreifen" );
556 aBmp = pLineEndList->GetUiBitmap( i );
556 aBmp = maLineEndList->GetUiBitmap( i );
557 OSL_ENSURE( !aBmp.IsEmpty(), "UI-Bitmap wurde nicht erzeugt" );
558
559 aVD.DrawBitmap( aPt0, aBmp );
560 aLineEndSet.InsertItem( (sal_uInt16)((i+1L)*2L+1L), aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() );
561 aLineEndSet.InsertItem( (sal_uInt16)((i+2L)*2L), aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() );
562 }
563 nLines = Min( (sal_uInt16)(nCount + 1), (sal_uInt16) MAX_LINES );
564 aLineEndSet.SetLineCount( nLines );

--- 94 unchanged lines hidden (view full) ---

659void SvxLineEndWindow::StateChanged(
660 sal_uInt16 nSID, SfxItemState, const SfxPoolItem* pState )
661{
662 if ( nSID == SID_LINEEND_LIST )
663 {
664 // Die Liste der LinienEnden (LineEndList) hat sich geaendert:
665 if ( pState && pState->ISA( SvxLineEndListItem ))
666 {
557 OSL_ENSURE( !aBmp.IsEmpty(), "UI-Bitmap wurde nicht erzeugt" );
558
559 aVD.DrawBitmap( aPt0, aBmp );
560 aLineEndSet.InsertItem( (sal_uInt16)((i+1L)*2L+1L), aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() );
561 aLineEndSet.InsertItem( (sal_uInt16)((i+2L)*2L), aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() );
562 }
563 nLines = Min( (sal_uInt16)(nCount + 1), (sal_uInt16) MAX_LINES );
564 aLineEndSet.SetLineCount( nLines );

--- 94 unchanged lines hidden (view full) ---

659void SvxLineEndWindow::StateChanged(
660 sal_uInt16 nSID, SfxItemState, const SfxPoolItem* pState )
661{
662 if ( nSID == SID_LINEEND_LIST )
663 {
664 // Die Liste der LinienEnden (LineEndList) hat sich geaendert:
665 if ( pState && pState->ISA( SvxLineEndListItem ))
666 {
667 pLineEndList = ((SvxLineEndListItem*)pState)->GetLineEndList();
668 DBG_ASSERT( pLineEndList, "LineEndList nicht gefunden" );
667 maLineEndList = static_cast< const SvxLineEndListItem* >(pState)->GetLineEndList();
668 DBG_ASSERT( maLineEndList.get(), "LineEndList nicht gefunden" );
669
670 aLineEndSet.Clear();
671 FillValueSet();
672
673 Size aSize = GetOutputSizePixel();
674 Resizing( aSize );
675 Resize();
676 }

--- 103 unchanged lines hidden ---
669
670 aLineEndSet.Clear();
671 FillValueSet();
672
673 Size aSize = GetOutputSizePixel();
674 Resizing( aSize );
675 Resize();
676 }

--- 103 unchanged lines hidden ---