Kaydet (Commit) 0f61a89e authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Caolán McNamara

Resolves: #i125065# handle critical cases in FillStyle/FillProperties...

toolbar combination
(cherry picked from commit 0ce4a90e)

Conflicts:
	include/svx/fillctrl.hxx
	svx/source/tbxctrls/fillctrl.cxx

Change-Id: I9a1b2490a7e9285559dddd4df7fb20c2216fd450
üst 7b811b68
......@@ -40,32 +40,33 @@ class ListBox;
|*
\************************************************************************/
class SVX_DLLPUBLIC SvxFillToolBoxControl: public SfxToolBoxControl
class SVX_DLLPUBLIC SvxFillToolBoxControl : public SfxToolBoxControl
{
private:
XFillStyleItem* pStyleItem;
XFillColorItem* pColorItem;
XFillGradientItem* pGradientItem;
XFillHatchItem* pHatchItem;
XFillBitmapItem* pBitmapItem;
XFillStyleItem* mpStyleItem;
XFillColorItem* mpColorItem;
XFillGradientItem* mpGradientItem;
XFillHatchItem* mpHatchItem;
XFillBitmapItem* mpBitmapItem;
FillControl* pFillControl;
SvxFillTypeBox* pFillTypeLB;
SvxFillAttrBox* pFillAttrLB;
FillControl* mpFillControl;
SvxFillTypeBox* mpFillTypeLB;
SvxFillAttrBox* mpFillAttrLB;
bool bUpdate;
sal_uInt16 eLastXFS;
XFillStyle meLastXFS;
/// bitfield
bool mbUpdate:1;
public:
SFX_DECL_TOOLBOX_CONTROL();
SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
SvxFillToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
virtual ~SvxFillToolBoxControl();
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) SAL_OVERRIDE;
void Update( const SfxPoolItem* pState );
virtual Window* CreateItemWindow( Window *pParent ) SAL_OVERRIDE;
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE;
void Update(const SfxPoolItem* pState);
virtual Window* CreateItemWindow(Window* pParent) SAL_OVERRIDE;
};
......@@ -75,18 +76,29 @@ class FillControl : public Window
private:
friend class SvxFillToolBoxControl;
SvxFillTypeBox* pLbFillType;
SvxFillAttrBox* pLbFillAttr;
Size aLogicalFillSize;
Size aLogicalAttrSize;
Timer aDelayTimer;
SvxFillTypeBox* mpLbFillType;
SvxFillAttrBox* mpLbFillAttr;
Size maLogicalFillSize;
Size maLogicalAttrSize;
//
sal_uInt16 mnLastFillTypeControlSelectEntryPos;
sal_uInt16 mnLastFillAttrControlSelectEntryPos;
/// bitfield
bool mbFillTypeChanged : 1;
DECL_LINK(SelectFillTypeHdl,ListBox *);
DECL_LINK(SelectFillAttrHdl,ListBox *);
virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE;
void InitializeFillStyleAccordingToGivenFillType(XFillStyle eFillStyle);
void updateLastFillTypeControlSelectEntryPos();
void updateLastFillAttrControlSelectEntryPos();
DECL_LINK( DelayHdl, void * );
DECL_LINK( SelectFillTypeHdl, ListBox * );
DECL_LINK( SelectFillAttrHdl, ListBox * );
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
public:
FillControl( Window* pParent, WinBits nStyle = 0 );
FillControl(Window* pParent, WinBits nStyle = 0);
virtual ~FillControl();
virtual void Resize() SAL_OVERRIDE;
......
......@@ -26,8 +26,6 @@
#include <vcl/settings.hxx>
#include <svx/dialogs.hrc>
#define DELAY_TIMEOUT 300
#define TMP_STR_BEGIN "["
#define TMP_STR_END "]"
......@@ -52,20 +50,21 @@ SFX_IMPL_TOOLBOX_CONTROL( SvxFillToolBoxControl, XFillStyleItem );
|* SvxFillToolBoxControl
|*
\************************************************************************/
SvxFillToolBoxControl::SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
SfxToolBoxControl( nSlotId, nId, rTbx ),
pStyleItem ( NULL ),
pColorItem ( NULL ),
pGradientItem ( NULL ),
pHatchItem ( NULL ),
pBitmapItem ( NULL ),
pFillControl ( NULL ),
pFillTypeLB ( NULL ),
pFillAttrLB ( NULL ),
bUpdate ( false ),
eLastXFS ( XFILL_NONE )
SvxFillToolBoxControl::SvxFillToolBoxControl(
sal_uInt16 nSlotId,
sal_uInt16 nId,
ToolBox& rTbx )
: SfxToolBoxControl( nSlotId, nId, rTbx )
, mpStyleItem(0)
, mpColorItem(0)
, mpGradientItem(0)
, mpHatchItem(0)
, mpBitmapItem(0)
, mpFillControl(0)
, mpFillTypeLB(0)
, mpFillAttrLB(0)
, meLastXFS(XFILL_NONE)
, mbUpdate(false)
{
addStatusListener( OUString( ".uno:FillColor" ));
addStatusListener( OUString( ".uno:FillGradient" ));
......@@ -81,134 +80,146 @@ SvxFillToolBoxControl::SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId
SvxFillToolBoxControl::~SvxFillToolBoxControl()
{
delete pStyleItem;
delete pColorItem;
delete pGradientItem;
delete pHatchItem;
delete pBitmapItem;
delete mpStyleItem;
delete mpColorItem;
delete mpGradientItem;
delete mpHatchItem;
delete mpBitmapItem;
}
void SvxFillToolBoxControl::StateChanged(
sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState)
{
if( eState == SFX_ITEM_DISABLED )
if(eState == SFX_ITEM_DISABLED)
{
if( nSID == SID_ATTR_FILL_STYLE )
// slot disable state
if(nSID == SID_ATTR_FILL_STYLE)
{
pFillTypeLB->Disable();
pFillTypeLB->SetNoSelection();
mpFillTypeLB->Disable();
mpFillTypeLB->SetNoSelection();
}
pFillAttrLB->Disable();
pFillAttrLB->SetNoSelection();
mpFillAttrLB->Disable();
mpFillAttrLB->SetNoSelection();
}
else
{
if ( SFX_ITEM_AVAILABLE == eState )
else if(SFX_ITEM_AVAILABLE == eState)
{
bool bEnableControls = false;
if( nSID == SID_ATTR_FILL_STYLE )
bool bEnableControls(false);
// slot available state
if(nSID == SID_ATTR_FILL_STYLE)
{
delete pStyleItem;
pStyleItem = (XFillStyleItem*) pState->Clone();
pFillTypeLB->Enable();
delete mpStyleItem;
mpStyleItem = static_cast< XFillStyleItem* >(pState->Clone());
mpFillTypeLB->Enable();
}
else if( pStyleItem )
else if(mpStyleItem)
{
XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
const XFillStyle eXFS(static_cast< XFillStyle >(mpStyleItem->GetValue()));
if( nSID == SID_ATTR_FILL_COLOR )
if(nSID == SID_ATTR_FILL_COLOR)
{
delete pColorItem;
pColorItem = (XFillColorItem*) pState->Clone();
delete mpColorItem;
mpColorItem = static_cast< XFillColorItem* >(pState->Clone());
if( eXFS == XFILL_SOLID )
if(eXFS == XFILL_SOLID)
{
bEnableControls = true;
}
else if( nSID == SID_ATTR_FILL_GRADIENT )
}
else if(nSID == SID_ATTR_FILL_GRADIENT)
{
delete pGradientItem;
pGradientItem = (XFillGradientItem*) pState->Clone();
delete mpGradientItem;
mpGradientItem = static_cast< XFillGradientItem* >(pState->Clone());
if( eXFS == XFILL_GRADIENT )
if(eXFS == XFILL_GRADIENT)
{
bEnableControls = true;
}
else if( nSID == SID_ATTR_FILL_HATCH )
}
else if(nSID == SID_ATTR_FILL_HATCH)
{
delete pHatchItem;
pHatchItem = (XFillHatchItem*) pState->Clone();
delete mpHatchItem;
mpHatchItem = static_cast< XFillHatchItem* >(pState->Clone());
if( eXFS == XFILL_HATCH )
if(eXFS == XFILL_HATCH)
{
bEnableControls = true;
}
else if( nSID == SID_ATTR_FILL_BITMAP )
}
else if(nSID == SID_ATTR_FILL_BITMAP)
{
delete pBitmapItem;
pBitmapItem = (XFillBitmapItem*) pState->Clone();
delete mpBitmapItem;
mpBitmapItem = static_cast< XFillBitmapItem* >(pState->Clone());
if( eXFS == XFILL_BITMAP )
if(eXFS == XFILL_BITMAP)
{
bEnableControls = true;
}
}
}
if( pStyleItem )
if(mpStyleItem)
{
// ensure that the correct entry is selected in pFillTypeLB. It
// might have been changed by nSID == SID_ATTR_FILL_STYLE, but
// it might also be in an in-between state when user had started to
// change fillstyle, but not yet changed fillvalue for new style
// and when nSID == SID_ATTR_FILL_COLOR/SID_ATTR_FILL_GRADIENT/
// SID_ATTR_FILL_HATCH/SID_ATTR_FILL_BITMAP value change is triggered
eLastXFS = pFillTypeLB->GetSelectEntryPos();
XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
// ensure that the correct entry is selected in mpFillTypeLB
XFillStyle eXFS(static_cast< XFillStyle >(mpStyleItem->GetValue()));
const bool bFillTypeChangedByUser(mpFillControl->mbFillTypeChanged);
if(eLastXFS != eXFS)
if(bFillTypeChangedByUser)
{
bUpdate = true;
pFillTypeLB->SelectEntryPos( eXFS );
meLastXFS = static_cast< XFillStyle >(mpFillControl->mnLastFillTypeControlSelectEntryPos);
mpFillControl->mbFillTypeChanged = false;
}
pFillAttrLB->Enable();
if(meLastXFS != eXFS)
{
mbUpdate = true;
mpFillTypeLB->SelectEntryPos(sal::static_int_cast<sal_uInt16>(eXFS));
}
if( bEnableControls )
{
//pFillTypeLB->Enable();
pFillAttrLB->Enable();
mpFillAttrLB->Enable();
}
bUpdate = true;
if(bEnableControls)
{
mpFillAttrLB->Enable();
mbUpdate = true;
}
Update( pState );
Update(pState);
}
else
{
// empty or ambiguous status
if( nSID == SID_ATTR_FILL_STYLE )
// slot empty or ambigous
if(nSID == SID_ATTR_FILL_STYLE)
{
pFillTypeLB->SetNoSelection();
pFillAttrLB->Disable();
pFillAttrLB->SetNoSelection();
bUpdate = false;
mpFillTypeLB->SetNoSelection();
mpFillAttrLB->Disable();
mpFillAttrLB->SetNoSelection();
delete mpStyleItem;
mpStyleItem = 0;
mbUpdate = false;
}
else
{
XFillStyle eXFS = XFILL_NONE;
if( pStyleItem )
eXFS = (XFillStyle)pStyleItem->GetValue();
if( !pStyleItem ||
( nSID == SID_ATTR_FILL_COLOR && eXFS == XFILL_SOLID ) ||
( nSID == SID_ATTR_FILL_GRADIENT && eXFS == XFILL_GRADIENT ) ||
( nSID == SID_ATTR_FILL_HATCH && eXFS == XFILL_HATCH ) ||
( nSID == SID_ATTR_FILL_BITMAP && eXFS == XFILL_BITMAP ) )
XFillStyle eXFS(XFILL_NONE);
if(mpStyleItem)
{
pFillAttrLB->SetNoSelection();
//bUpdate = sal_False;
eXFS = static_cast< XFillStyle >(mpStyleItem->GetValue());
}
if(!mpStyleItem ||
(nSID == SID_ATTR_FILL_COLOR && eXFS == XFILL_SOLID) ||
(nSID == SID_ATTR_FILL_GRADIENT && eXFS == XFILL_GRADIENT) ||
(nSID == SID_ATTR_FILL_HATCH && eXFS == XFILL_HATCH) ||
(nSID == SID_ATTR_FILL_BITMAP && eXFS == XFILL_BITMAP))
{
mpFillAttrLB->SetNoSelection();
}
}
}
......@@ -216,102 +227,106 @@ void SvxFillToolBoxControl::StateChanged(
void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
void SvxFillToolBoxControl::Update(const SfxPoolItem* pState)
{
if ( pStyleItem && pState && bUpdate )
if(mpStyleItem && pState && mbUpdate)
{
bUpdate = false;
XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
mbUpdate = false;
const XFillStyle eXFS(static_cast< XFillStyle >(mpStyleItem->GetValue()));
// Check if the fill style was already active
//if( eTmpXFS != eXFS )
if( (XFillStyle) eLastXFS != eXFS )
pFillControl->SelectFillTypeHdl( NULL );
//eLastXFS = eXFS;
if(meLastXFS != eXFS)
{
// update mnLastFillTypeControlSelectEntryPos and fill style list
mpFillControl->updateLastFillTypeControlSelectEntryPos();
mpFillControl->InitializeFillStyleAccordingToGivenFillType(eXFS);
meLastXFS = eXFS;
}
switch( eXFS )
switch(eXFS)
{
case XFILL_NONE:
{
break;
}
case XFILL_SOLID:
{
if ( pColorItem )
if(mpColorItem)
{
OUString aString( pColorItem->GetName() );
::Color aColor = pColorItem->GetColorValue();
OUString aString(mpColorItem->GetName());
::Color aColor = mpColorItem->GetColorValue();
pFillAttrLB->SelectEntry( aString );
mpFillAttrLB->SelectEntry(aString);
if ( pFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ||
pFillAttrLB->GetSelectEntryColor() != aColor )
pFillAttrLB->SelectEntry( aColor );
if(mpFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND || mpFillAttrLB->GetSelectEntryColor() != aColor)
{
mpFillAttrLB->SelectEntry(aColor);
}
// Check if the entry is not in the list
if( pFillAttrLB->GetSelectEntryPos() ==
if( mpFillAttrLB->GetSelectEntryPos() ==
LISTBOX_ENTRY_NOTFOUND ||
pFillAttrLB->GetSelectEntryColor() != aColor )
mpFillAttrLB->GetSelectEntryColor() != aColor )
{
sal_Int32 nCount = pFillAttrLB->GetEntryCount();
sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
OUString aTmpStr;
if( nCount > 0 )
{
// Last entry gets tested against temporary color
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
aTmpStr = mpFillAttrLB->GetEntry( nCount - 1 );
if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
mpFillAttrLB->RemoveEntry(nCount - 1);
}
}
aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
//pFillAttrLB->SetUpdateMode( sal_False );
sal_Int32 nPos = pFillAttrLB->InsertEntry( aColor, aTmpStr );
//pFillAttrLB->SetUpdateMode( sal_True );
pFillAttrLB->SelectEntryPos( nPos );
sal_Int32 nPos = mpFillAttrLB->InsertEntry(aColor, aTmpStr);
mpFillAttrLB->SelectEntryPos(nPos);
}
}
else
pFillAttrLB->SetNoSelection();
{
mpFillAttrLB->SetNoSelection();
}
break;
}
case XFILL_GRADIENT:
{
if ( pGradientItem )
if(mpGradientItem)
{
OUString aString( pGradientItem->GetName() );
pFillAttrLB->SelectEntry( aString );
OUString aString(mpGradientItem->GetName());
mpFillAttrLB->SelectEntry( aString );
// Check if the entry is not in the list
if( pFillAttrLB->GetSelectEntry() != aString )
if (mpFillAttrLB->GetSelectEntry() != aString)
{
sal_Int32 nCount = pFillAttrLB->GetEntryCount();
sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
OUString aTmpStr;
if( nCount > 0 )
{
// Last entry gets tested against temporary entry
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
aTmpStr = mpFillAttrLB->GetEntry( nCount - 1 );
if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
mpFillAttrLB->RemoveEntry(nCount - 1);
}
}
aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
XGradientEntry* pEntry = new XGradientEntry( pGradientItem->GetGradientValue(), aTmpStr );
XGradientEntry* pEntry = new XGradientEntry(mpGradientItem->GetGradientValue(), aTmpStr);
XGradientList aGradientList( "", ""/*TODO?*/ );
aGradientList.Insert( pEntry );
aGradientList.SetDirty( false );
const Bitmap aBmp = aGradientList.GetUiBitmap( 0 );
if( !aBmp.IsEmpty() )
if(!aBmp.IsEmpty())
{
pFillAttrLB->InsertEntry(pEntry->GetName(), Image(aBmp));
pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
//delete pBmp;
mpFillAttrLB->InsertEntry(pEntry->GetName(), Image(aBmp));
mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1);
}
aGradientList.Remove( 0 );
......@@ -319,44 +334,45 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
}
}
else
pFillAttrLB->SetNoSelection();
{
mpFillAttrLB->SetNoSelection();
}
break;
}
case XFILL_HATCH:
{
if ( pHatchItem )
if(mpHatchItem)
{
OUString aString( pHatchItem->GetName() );
pFillAttrLB->SelectEntry( aString );
OUString aString(mpHatchItem->GetName());
mpFillAttrLB->SelectEntry( aString );
// Check if the entry is not in the list
if( pFillAttrLB->GetSelectEntry() != aString )
if (mpFillAttrLB->GetSelectEntry() != aString)
{
sal_Int32 nCount = pFillAttrLB->GetEntryCount();
sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
OUString aTmpStr;
if( nCount > 0 )
{
// Last entry gets tested against temporary entry
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
aTmpStr = mpFillAttrLB->GetEntry( nCount - 1 );
if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
mpFillAttrLB->RemoveEntry(nCount - 1);
}
}
aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
XHatchEntry* pEntry = new XHatchEntry( pHatchItem->GetHatchValue(), aTmpStr );
XHatchEntry* pEntry = new XHatchEntry(mpHatchItem->GetHatchValue(), aTmpStr);
XHatchList aHatchList( "", ""/*TODO?*/ );
aHatchList.Insert( pEntry );
aHatchList.SetDirty( false );
const Bitmap aBmp = aHatchList.GetUiBitmap( 0 );
if( !aBmp.IsEmpty() )
if(!aBmp.IsEmpty())
{
pFillAttrLB->InsertEntry(pEntry->GetName(), Image(aBmp));
pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
//delete pBmp;
mpFillAttrLB->InsertEntry(pEntry->GetName(), Image(aBmp));
mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1);
}
aHatchList.Remove( 0 );
......@@ -364,121 +380,159 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
}
}
else
pFillAttrLB->SetNoSelection();
{
mpFillAttrLB->SetNoSelection();
}
break;
}
case XFILL_BITMAP:
{
if ( pBitmapItem )
// &&
// SfxObjectShell::Current() &&
// SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) )
if(mpBitmapItem)
{
OUString aString( pBitmapItem->GetName() );
// Bitmap aBitmap( pBitmapItem->GetValue() );
// SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
// SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) ) );
pFillAttrLB->SelectEntry( aString );
OUString aString(mpBitmapItem->GetName());
mpFillAttrLB->SelectEntry( aString );
// Check if the entry is not in the list
if( pFillAttrLB->GetSelectEntry() != aString )
if (mpFillAttrLB->GetSelectEntry() != aString)
{
sal_Int32 nCount = pFillAttrLB->GetEntryCount();
sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
OUString aTmpStr;
if( nCount > 0 )
{
// Last entry gets tested against temporary entry
aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
aTmpStr = mpFillAttrLB->GetEntry(nCount - 1);
if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
aTmpStr.endsWith(TMP_STR_END) )
{
pFillAttrLB->RemoveEntry( nCount - 1 );
mpFillAttrLB->RemoveEntry(nCount - 1);
}
}
aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
XBitmapEntry* pEntry = new XBitmapEntry(pBitmapItem->GetGraphicObject(), aTmpStr);
XBitmapEntry* pEntry = new XBitmapEntry(mpBitmapItem->GetGraphicObject(), aTmpStr);
XBitmapListRef xBitmapList =
XPropertyList::CreatePropertyList(XBITMAP_LIST,
OUString("TmpList"), ""/*TODO?*/)->AsBitmapList();
xBitmapList->Insert( pEntry );
xBitmapList->SetDirty( false );
pFillAttrLB->Fill( xBitmapList );
pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
mpFillAttrLB->Fill( xBitmapList );
mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1);
xBitmapList->Remove( 0 );
delete pEntry;
}
}
else
pFillAttrLB->SetNoSelection();
{
mpFillAttrLB->SetNoSelection();
}
break;
}
default:
{
OSL_FAIL( "Unsupported fill type" );
break;
}
}
if( pState && pStyleItem )
// update mnLastFillAttrControlSelectEntryPos
mpFillControl->updateLastFillAttrControlSelectEntryPos();
}
if(pState && mpStyleItem)
{
XFillStyle eXFS = (XFillStyle) pStyleItem->GetValue();
XFillStyle eXFS = static_cast< XFillStyle >(mpStyleItem->GetValue());
// Does the lists have changed?
if( pState->ISA( SvxColorListItem ) &&
eXFS == XFILL_SOLID )
switch(eXFS)
{
::Color aTmpColor( pFillAttrLB->GetSelectEntryColor() );
pFillAttrLB->Clear();
pFillAttrLB->Fill( ( (SvxColorListItem*)pState )->GetColorList() );
pFillAttrLB->SelectEntry( aTmpColor );
case XFILL_SOLID:
{
const SvxColorListItem* pItem = dynamic_cast< const SvxColorListItem* >(pState);
if(pItem)
{
::Color aTmpColor(mpFillAttrLB->GetSelectEntryColor());
mpFillAttrLB->Clear();
mpFillAttrLB->Fill(pItem->GetColorList());
mpFillAttrLB->SelectEntry(aTmpColor);
}
break;
}
if( pState->ISA( SvxGradientListItem ) &&
eXFS == XFILL_GRADIENT )
case XFILL_GRADIENT:
{
const SvxGradientListItem* pItem = dynamic_cast< const SvxGradientListItem* >(pState);
if(pItem)
{
OUString aString( pFillAttrLB->GetSelectEntry() );
pFillAttrLB->Clear();
pFillAttrLB->Fill( ( (SvxGradientListItem*)pState )->GetGradientList() );
pFillAttrLB->SelectEntry( aString );
OUString aString(mpFillAttrLB->GetSelectEntry());
mpFillAttrLB->Clear();
mpFillAttrLB->Fill(pItem->GetGradientList());
mpFillAttrLB->SelectEntry(aString);
}
break;
}
if( pState->ISA( SvxHatchListItem ) &&
eXFS == XFILL_HATCH )
case XFILL_HATCH:
{
const SvxHatchListItem* pItem = dynamic_cast< const SvxHatchListItem* >(pState);
if(pItem)
{
OUString aString( pFillAttrLB->GetSelectEntry() );
pFillAttrLB->Clear();
pFillAttrLB->Fill( ( (SvxHatchListItem*)pState )->GetHatchList() );
pFillAttrLB->SelectEntry( aString );
OUString aString(mpFillAttrLB->GetSelectEntry());
mpFillAttrLB->Clear();
mpFillAttrLB->Fill(pItem->GetHatchList());
mpFillAttrLB->SelectEntry(aString);
}
if( pState->ISA( SvxBitmapListItem ) &&
eXFS == XFILL_BITMAP )
break;
}
case XFILL_BITMAP:
{
OUString aString( pFillAttrLB->GetSelectEntry() );
pFillAttrLB->Clear();
pFillAttrLB->Fill( ( (SvxBitmapListItem*)pState )->GetBitmapList() );
pFillAttrLB->SelectEntry( aString );
const SvxBitmapListItem* pItem = dynamic_cast< const SvxBitmapListItem* >(pState);
if(pItem)
{
OUString aString(mpFillAttrLB->GetSelectEntry());
mpFillAttrLB->Clear();
mpFillAttrLB->Fill(pItem->GetBitmapList());
mpFillAttrLB->SelectEntry(aString);
}
break;
}
default: // XFILL_NONE
{
break;
}
}
}
}
Window* SvxFillToolBoxControl::CreateItemWindow( Window *pParent )
Window* SvxFillToolBoxControl::CreateItemWindow(Window *pParent)
{
if ( GetSlotId() == SID_ATTR_FILL_STYLE )
if(GetSlotId() == SID_ATTR_FILL_STYLE)
{
pFillControl = new FillControl( pParent );
mpFillControl = new FillControl(pParent);
// Thus the FillControl is known by SvxFillToolBoxControl
// (and in order to remain compatible)
pFillControl->SetData( this );
mpFillControl->SetData(this);
pFillAttrLB = (SvxFillAttrBox*)pFillControl->pLbFillAttr;
pFillTypeLB = (SvxFillTypeBox*)pFillControl->pLbFillType;
mpFillAttrLB = (SvxFillAttrBox*)mpFillControl->mpLbFillAttr;
mpFillTypeLB = (SvxFillTypeBox*)mpFillControl->mpLbFillType;
pFillAttrLB->SetUniqueId( HID_FILL_ATTR_LISTBOX );
pFillTypeLB->SetUniqueId( HID_FILL_TYPE_LISTBOX );
mpFillAttrLB->SetUniqueId(HID_FILL_ATTR_LISTBOX);
mpFillTypeLB->SetUniqueId(HID_FILL_TYPE_LISTBOX);
return pFillControl;
if(!mpStyleItem)
{
// for Writer and Calc it's not the same instance of
// SvxFillToolBoxControl which gets used after deselecting
// and selecting a DrawObject, thhus a useful initialization is
// needed to get the FillType and the FillStyle List inited
// correctly. This in combination with meLastXFS inited to
// XFILL_NONE do the trick
mpStyleItem = new XFillStyleItem(XFILL_SOLID);
}
return mpFillControl;
}
return NULL;
}
......@@ -489,280 +543,328 @@ Window* SvxFillToolBoxControl::CreateItemWindow( Window *pParent )
|*
\************************************************************************/
FillControl::FillControl( Window* pParent, WinBits nStyle ) :
Window( pParent, nStyle | WB_DIALOGCONTROL ),
pLbFillType(new SvxFillTypeBox( this )),
aLogicalFillSize(40,80),
aLogicalAttrSize(50,80)
FillControl::FillControl(Window* pParent,WinBits nStyle)
: Window(pParent,nStyle | WB_DIALOGCONTROL),
mpLbFillType(new SvxFillTypeBox(this)),
mpLbFillAttr(new SvxFillAttrBox(this)),
maLogicalFillSize(40,80),
maLogicalAttrSize(50,80),
mnLastFillTypeControlSelectEntryPos(mpLbFillType->GetSelectEntryPos()),
mnLastFillAttrControlSelectEntryPos(mpLbFillAttr->GetSelectEntryPos()),
mbFillTypeChanged(false)
{
pLbFillAttr = new SvxFillAttrBox( this );
Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT));
Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT));
pLbFillType->SetSizePixel(aTypeSize);
pLbFillAttr->SetSizePixel(aAttrSize);
Size aTypeSize(LogicToPixel(maLogicalFillSize,MAP_APPFONT));
Size aAttrSize(LogicToPixel(maLogicalAttrSize,MAP_APPFONT));
mpLbFillType->SetSizePixel(aTypeSize);
mpLbFillAttr->SetSizePixel(aAttrSize);
//to get the base height
aTypeSize = pLbFillType->GetSizePixel();
aAttrSize = pLbFillAttr->GetSizePixel();
Point aAttrPnt = pLbFillAttr->GetPosPixel();
aTypeSize = mpLbFillType->GetSizePixel();
aAttrSize = mpLbFillAttr->GetSizePixel();
Point aAttrPnt = mpLbFillAttr->GetPosPixel();
SetSizePixel(
Size( aAttrPnt.X() + aAttrSize.Width(),
std::max( aAttrSize.Height(), aTypeSize.Height() ) ) );
Size(aAttrPnt.X() + aAttrSize.Width(),
std::max(aAttrSize.Height(),aTypeSize.Height())));
pLbFillType->SetSelectHdl( LINK( this, FillControl, SelectFillTypeHdl ) );
pLbFillAttr->SetSelectHdl( LINK( this, FillControl, SelectFillAttrHdl ) );
aDelayTimer.SetTimeout( DELAY_TIMEOUT );
aDelayTimer.SetTimeoutHdl( LINK( this, FillControl, DelayHdl ) );
aDelayTimer.Start();
mpLbFillType->SetSelectHdl(LINK(this,FillControl,SelectFillTypeHdl));
mpLbFillAttr->SetSelectHdl(LINK(this,FillControl,SelectFillAttrHdl));
}
FillControl::~FillControl()
{
delete pLbFillType;
delete pLbFillAttr;
}
IMPL_LINK_NOARG_INLINE_START(FillControl, DelayHdl)
{
SelectFillTypeHdl( NULL );
( (SvxFillToolBoxControl*)GetData() )->updateStatus( OUString( ".uno:FillStyle" ));
// ( (SvxFillToolBoxControl*)GetData() )->GetBindings().Invalidate( SID_ATTR_FILL_STYLE );
return 0;
delete mpLbFillType;
delete mpLbFillAttr;
}
IMPL_LINK_INLINE_END( FillControl, DelayHdl, Timer *, pTimer )
IMPL_LINK( FillControl, SelectFillTypeHdl, ListBox *, pBox )
void FillControl::InitializeFillStyleAccordingToGivenFillType(XFillStyle aFillStyle)
{
XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos();
// Later, an optimization should be accomplished,
// that the lists or tables can only be deleted and rebuilt
// when the lists, or tables have actually changed (in the LBs of course).
if ( ( pBox && !pBox->IsTravelSelect() ) || !pBox )
{
// So that we can show a status in the following case:
// One type was selected but no attribute.
// The selection has exactly the same attributes as the previous one.
// SvxFillToolBoxControl* pControlerItem = (SvxFillToolBoxControl*)GetData();
// if( pControlerItem )
// pControlerItem->ClearCache();
pLbFillAttr->Clear();
SfxObjectShell* pSh = SfxObjectShell::Current();
bool bDone(false);
switch( eXFS )
if(pSh)
{
case XFILL_NONE:
{
pLbFillType->Selected();
SelectFillAttrHdl( pBox );
pLbFillAttr->Disable();
}
break;
// clear in all cases, else we would risk a mix of FillStyles in the Style list
mpLbFillAttr->Clear();
switch (aFillStyle)
{
case XFILL_SOLID:
{
if ( pSh && pSh->GetItem( SID_COLOR_TABLE ) )
if(pSh->GetItem(SID_COLOR_TABLE))
{
SvxColorListItem aItem( *(const SvxColorListItem*)(
pSh->GetItem( SID_COLOR_TABLE ) ) );
pLbFillAttr->Enable();
pLbFillAttr->Fill( aItem.GetColorList() );
}
else
pLbFillAttr->Disable();
const SvxColorListItem* pItem = static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE));
mpLbFillAttr->Enable();
mpLbFillAttr->Fill(pItem->GetColorList());
bDone = true;
}
break;
}
case XFILL_GRADIENT:
{
if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
if(pSh->GetItem(SID_GRADIENT_LIST))
{
SvxGradientListItem aItem( *(const SvxGradientListItem*)(
pSh->GetItem( SID_GRADIENT_LIST ) ) );
pLbFillAttr->Enable();
pLbFillAttr->Fill( aItem.GetGradientList() );
}
else
pLbFillAttr->Disable();
const SvxGradientListItem* pItem = static_cast< const SvxGradientListItem* >(pSh->GetItem(SID_GRADIENT_LIST));
mpLbFillAttr->Enable();
mpLbFillAttr->Fill(pItem->GetGradientList());
bDone = true;
}
break;
}
case XFILL_HATCH:
{
if ( pSh && pSh->GetItem( SID_HATCH_LIST ) )
if(pSh->GetItem(SID_HATCH_LIST))
{
SvxHatchListItem aItem( *(const SvxHatchListItem*)(
pSh->GetItem( SID_HATCH_LIST ) ) );
pLbFillAttr->Enable();
pLbFillAttr->Fill( aItem.GetHatchList() );
}
else
pLbFillAttr->Disable();
const SvxHatchListItem* pItem = static_cast< const SvxHatchListItem* >(pSh->GetItem(SID_HATCH_LIST));
mpLbFillAttr->Enable();
mpLbFillAttr->Fill(pItem->GetHatchList());
bDone = true;
}
break;
}
case XFILL_BITMAP:
{
if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) )
if(pSh->GetItem(SID_BITMAP_LIST))
{
SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
pSh->GetItem( SID_BITMAP_LIST ) ) );
pLbFillAttr->Enable();
pLbFillAttr->Fill( aItem.GetBitmapList() );
const SvxBitmapListItem* pItem = static_cast< const SvxBitmapListItem* >(pSh->GetItem(SID_BITMAP_LIST));
mpLbFillAttr->Enable();
mpLbFillAttr->Fill(pItem->GetBitmapList());
bDone = true;
}
else
pLbFillAttr->Disable();
break;
}
default: // XFILL_NONE
{
// accept disable (no styles for XFILL_NONE)
break;
}
}
}
if( eXFS != XFILL_NONE ) // Has already been done
if (!bDone)
{
if ( pBox )
pLbFillType->Selected();
mpLbFillAttr->Disable();
}
}
void FillControl::updateLastFillTypeControlSelectEntryPos()
{
mnLastFillTypeControlSelectEntryPos = mpLbFillType->GetSelectEntryPos();
}
// release focus
if ( pBox && pLbFillType->IsRelease() )
IMPL_LINK(FillControl,SelectFillTypeHdl,ListBox *,pBox)
{
if(!pBox) // only work with real calls from ListBox, do not accept direct calls with zeros here
{
return 0;
}
const bool bAction(
!mpLbFillType->IsTravelSelect() // keep TravelSelect, this means keyboard up/down in the list
&& mpLbFillType->GetSelectEntryCount()
&& mpLbFillType->GetSelectEntryPos() != mnLastFillTypeControlSelectEntryPos);
updateLastFillTypeControlSelectEntryPos();
XFillStyle eXFS = static_cast< XFillStyle >(mpLbFillType->GetSelectEntryPos());
if(bAction && XFILL_NONE != eXFS)
{
mbFillTypeChanged = true;
}
// update list of FillStyles in any case
InitializeFillStyleAccordingToGivenFillType(eXFS);
// for XFILL_NONE do no longer call SelectFillAttrHdl (as done before),
// trigger needed actions directly. This is the only action this handler
// can trigger directly as the user action is finished in this case
if(XFILL_NONE == eXFS && bAction)
{
// for XFILL_NONE do no longer call SelectFillAttrHdl,
// trigger needed actions directly
Any a;
Sequence< PropertyValue > aArgsFillStyle(1);
XFillStyleItem aXFillStyleItem(eXFS);
aArgsFillStyle[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));
aXFillStyleItem.QueryValue(a);
aArgsFillStyle[0].Value = a;
((SvxFillToolBoxControl*)GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillStyle")), aArgsFillStyle);
}
mpLbFillType->Selected();
// release focus. Needed to get focus automatically back to EditView
if(mpLbFillType->IsRelease())
{
SfxViewShell* pViewShell = SfxViewShell::Current();
if( pViewShell && pViewShell->GetWindow() )
if(pViewShell && pViewShell->GetWindow())
{
pViewShell->GetWindow()->GrabFocus();
}
}
}
return 0;
}
IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox )
void FillControl::updateLastFillAttrControlSelectEntryPos()
{
XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos();
XFillStyleItem aXFillStyleItem( eXFS );
bool bAction = pBox && !pLbFillAttr->IsTravelSelect();
mnLastFillAttrControlSelectEntryPos = mpLbFillAttr->GetSelectEntryPos();
}
SfxObjectShell* pSh = SfxObjectShell::Current();
if ( bAction )
IMPL_LINK(FillControl, SelectFillAttrHdl, ListBox *, pBox)
{
if(!pBox) // only work with real calls from ListBox, do not accept direct calls with zeros here
{
Any a;
Sequence< PropertyValue > aArgs( 1 );
return 0;
}
// First set the style
aArgs[0].Name = "FillStyle";
aXFillStyleItem.QueryValue( a );
aArgs[0].Value = a;
((SvxFillToolBoxControl*)GetData())->Dispatch(
OUString( ".uno:FillStyle" ), aArgs );
const bool bAction(
!mpLbFillAttr->IsTravelSelect() // keep TravelSelect, this means keyboard up/down in the list
&& mpLbFillAttr->GetSelectEntryCount()
&& mpLbFillAttr->GetSelectEntryPos() != mnLastFillAttrControlSelectEntryPos);
switch( eXFS )
updateLastFillAttrControlSelectEntryPos();
if(bAction)
{
SfxObjectShell* pSh = SfxObjectShell::Current();
// Need to prepare the PropertyValue for the FillStyle dispatch action early,
// else the call for FillType to Dispatch(".uno:FillStyle") will already destroy the current state
// of selection in mpLbFillAttr again by calls to StateChanged which *will* set to no
// selection again (e.g. when two objects, same fill style, but different fill attributes)
Any a;
Sequence< PropertyValue > aArgsFillAttr(1);
OUString aFillAttrCommand;
XFillStyle eXFS(static_cast< XFillStyle >(mpLbFillType->GetSelectEntryPos()));
switch(eXFS)
{
case XFILL_NONE:
{
}
// handled in SelectFillTypeHdl, nothing to do here
break;
}
case XFILL_SOLID:
{
// Entry gets tested against temporary color
OUString aTmpStr = pLbFillAttr->GetSelectEntry();
OUString aTmpStr = mpLbFillAttr->GetSelectEntry();
if( aTmpStr.startsWith(TMP_STR_BEGIN) && aTmpStr.endsWith(TMP_STR_END) )
{
aTmpStr = aTmpStr.copy(1, aTmpStr.getLength()-2);
}
XFillColorItem aXFillColorItem( aTmpStr, pLbFillAttr->GetSelectEntryColor() );
aArgs[0].Name = "FillColor";
aXFillColorItem.QueryValue( a );
aArgs[0].Value = a;
((SvxFillToolBoxControl*)GetData())->Dispatch( ".uno:FillColor",
aArgs );
}
XFillColorItem aXFillColorItem(aTmpStr, mpLbFillAttr->GetSelectEntryColor());
aArgsFillAttr[0].Name = "FillColor";
aXFillColorItem.QueryValue(a);
aArgsFillAttr[0].Value = a;
aFillAttrCommand = ".uno:FillColor";
break;
}
case XFILL_GRADIENT:
{
sal_Int32 nPos = pLbFillAttr->GetSelectEntryPos();
if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos();
if (nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_GRADIENT_LIST))
{
SvxGradientListItem aItem(
*(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) );
const SvxGradientListItem* pItem = static_cast< const SvxGradientListItem* >(pSh->GetItem(SID_GRADIENT_LIST));
if ( nPos < aItem.GetGradientList()->Count() ) // no temporary entry?
if (nPos < pItem->GetGradientList()->Count()) // no temporary entry?
{
XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient();
XFillGradientItem aXFillGradientItem( pLbFillAttr->GetSelectEntry(), aGradient );
aArgs[0].Name = "FillGradient";
aXFillGradientItem.QueryValue( a );
aArgs[0].Value = a;
((SvxFillToolBoxControl*)GetData())->Dispatch( OUString( ".uno:FillGradient" ),
aArgs );
}
XGradient aGradient = pItem->GetGradientList()->GetGradient(nPos)->GetGradient();
XFillGradientItem aXFillGradientItem(mpLbFillAttr->GetSelectEntry(),aGradient);
aArgsFillAttr[0].Name = "FillGradient";
aXFillGradientItem.QueryValue(a);
aArgsFillAttr[0].Value = a;
aFillAttrCommand = ".uno:FillGradient";
}
}
break;
}
case XFILL_HATCH:
{
sal_Int32 nPos = pLbFillAttr->GetSelectEntryPos();
if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) )
sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos();
if (nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_HATCH_LIST))
{
SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) );
const SvxHatchListItem* pItem = static_cast< const SvxHatchListItem* >(pSh->GetItem(SID_HATCH_LIST));
if ( nPos < aItem.GetHatchList()->Count() ) // no temporary entry?
if (nPos < pItem->GetHatchList()->Count()) // no temporary entry?
{
XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch();
XFillHatchItem aXFillHatchItem( pLbFillAttr->GetSelectEntry(), aHatch );
XHatch aHatch = pItem->GetHatchList()->GetHatch(nPos)->GetHatch();
XFillHatchItem aXFillHatchItem(mpLbFillAttr->GetSelectEntry(), aHatch);
aArgs[0].Name = "FillHatch";
aXFillHatchItem.QueryValue( a );
aArgs[0].Value = a;
((SvxFillToolBoxControl*)GetData())->Dispatch( OUString( ".uno:FillHatch" ),
aArgs );
}
aArgsFillAttr[0].Name = "FillHatch";
aXFillHatchItem.QueryValue(a);
aArgsFillAttr[0].Value = a;
aFillAttrCommand = ".uno:FillHatch";
}
}
break;
}
case XFILL_BITMAP:
{
sal_Int32 nPos = pLbFillAttr->GetSelectEntryPos();
if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) )
sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos();
if (nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_BITMAP_LIST))
{
SvxBitmapListItem aItem(
*(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) );
const SvxBitmapListItem* pItem = static_cast< const SvxBitmapListItem* >(pSh->GetItem(SID_BITMAP_LIST));
if ( nPos < aItem.GetBitmapList()->Count() ) // no temporary entry?
if (nPos < pItem->GetBitmapList()->Count()) // no temporary entry?
{
const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos);
const XFillBitmapItem aXFillBitmapItem(pLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject());
const XBitmapEntry* pXBitmapEntry = pItem->GetBitmapList()->GetBitmap(nPos);
const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectEntry(),pXBitmapEntry->GetGraphicObject());
aArgs[0].Name = "FillBitmap";
aXFillBitmapItem.QueryValue( a );
aArgs[0].Value = a;
((SvxFillToolBoxControl*)GetData())->Dispatch(OUString(".uno:FillBitmap"), aArgs);
}
aArgsFillAttr[0].Name = "FillBitmap";
aXFillBitmapItem.QueryValue(a);
aArgsFillAttr[0].Value = a;
aFillAttrCommand = ".uno:FillBitmap";
}
}
break;
}
}
// release focus
if ( pLbFillAttr->IsRelease() && pBox )
// this is the place where evtl. a new slot action may be introduced to avoid the
// two undo entries. Reason for this is that indeed two actions are executed, the fill style
// and the fill attribute change. The sidebar already handles both separately, so
// changing the fill style already changes the object and adds a default fill attribute for
// the newly choosen fill style.
// This control uses the older user's two-step action to select a fill style and a fill attribute. In
// this case a lot of things may go wrong (e.g. the user stops that action and does something
// different), thus the solution of the sidebar should be preferred from my POV in the future
// first set the fill style if changed
if(mbFillTypeChanged)
{
Sequence< PropertyValue > aArgsFillStyle(1);
XFillStyleItem aXFillStyleItem(eXFS);
aArgsFillStyle[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));
aXFillStyleItem.QueryValue(a);
aArgsFillStyle[0].Value = a;
((SvxFillToolBoxControl*)GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillStyle")), aArgsFillStyle);
mbFillTypeChanged = false;
}
// second set fill attribute when a change was detected and prepared
if(aFillAttrCommand.getLength())
{
((SvxFillToolBoxControl*)GetData())->Dispatch(aFillAttrCommand, aArgsFillAttr);
}
// release focus. Needed to get focus automatically back to EditView
if(mpLbFillAttr->IsRelease() && pBox)
{
SfxViewShell* pViewShell = SfxViewShell::Current();
if( pViewShell && pViewShell->GetWindow() )
if(pViewShell && pViewShell->GetWindow())
{
pViewShell->GetWindow()->GrabFocus();
}
......@@ -781,29 +883,30 @@ void FillControl::Resize()
long nH = 180;
long nSep = 0; // was previously 4
pLbFillType->SetSizePixel( Size( nW * 2 - nSep, nH ) );
pLbFillAttr->SetPosSizePixel( Point( nW * 2 + nSep, 0 ), Size( nW * 3 - nSep, nH ) );
mpLbFillType->SetSizePixel(Size(nW * 2 - nSep,nH));
mpLbFillAttr->SetPosSizePixel(Point(nW * 2 + nSep,0),Size(nW * 3 - nSep,nH));
}
void FillControl::DataChanged( const DataChangedEvent& rDCEvt )
void FillControl::DataChanged(const DataChangedEvent& rDCEvt)
{
if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
(rDCEvt.GetFlags() & SETTINGS_STYLE) )
if((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
(rDCEvt.GetFlags() & SETTINGS_STYLE))
{
Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT));
Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT));
pLbFillType->SetSizePixel(aTypeSize);
pLbFillAttr->SetSizePixel(aAttrSize);
Size aTypeSize(LogicToPixel(maLogicalFillSize,MAP_APPFONT));
Size aAttrSize(LogicToPixel(maLogicalAttrSize,MAP_APPFONT));
mpLbFillType->SetSizePixel(aTypeSize);
mpLbFillAttr->SetSizePixel(aAttrSize);
//to get the base height
aTypeSize = pLbFillType->GetSizePixel();
aAttrSize = pLbFillAttr->GetSizePixel();
Point aAttrPnt = pLbFillAttr->GetPosPixel();
aTypeSize = mpLbFillType->GetSizePixel();
aAttrSize = mpLbFillAttr->GetSizePixel();
Point aAttrPnt = mpLbFillAttr->GetPosPixel();
SetSizePixel(
Size( aAttrPnt.X() + aAttrSize.Width(),
std::max( aAttrSize.Height(), aTypeSize.Height() ) ) );
Size(aAttrPnt.X() + aAttrSize.Width(),
std::max(aAttrSize.Height(), aTypeSize.Height())));
}
Window::DataChanged( rDCEvt );
Window::DataChanged(rDCEvt);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment