diff options
Diffstat (limited to 'cui/source/dialogs/iconcdlg.cxx')
-rw-r--r-- | cui/source/dialogs/iconcdlg.cxx | 232 |
1 files changed, 64 insertions, 168 deletions
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx index ddeb7040bbdd..8adc57ddc7ba 100644 --- a/cui/source/dialogs/iconcdlg.cxx +++ b/cui/source/dialogs/iconcdlg.cxx @@ -55,7 +55,7 @@ int IconcDlgCmpUS_Impl( const void* p1, const void* p2 ) #endif #endif { - return *(USHORT*)p1 - *(USHORT*)p2; + return *(sal_uInt16*)p1 - *(sal_uInt16*)p2; } // some stuff for easier changes for SvtViewOptions @@ -93,9 +93,9 @@ IconChoicePage::IconChoicePage( Window *pParent, const ResId &rResId, const SfxItemSet &rAttrSet ) : TabPage ( pParent, rResId ), pSet ( &rAttrSet ), - bHasExchangeSupport ( FALSE ), + bHasExchangeSupport ( sal_False ), pDialog ( NULL ), - bStandard ( FALSE ) + bStandard ( sal_False ) { SetStyle ( GetStyle() | WB_DIALOGCONTROL | WB_HIDE ); } @@ -135,9 +135,9 @@ void IconChoicePage::FillUserData() // ----------------------------------------------------------------------- -BOOL IconChoicePage::IsReadOnly() const +sal_Bool IconChoicePage::IsReadOnly() const { - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -149,56 +149,6 @@ sal_Bool IconChoicePage::QueryClose() /********************************************************************** | -| handling itemsets -| -\**********************************************************************/ - -const SfxPoolItem* IconChoicePage::GetItem( const SfxItemSet& rSet, - USHORT nSlot ) -{ - const SfxItemPool* pPool = rSet.GetPool(); - USHORT nWh = pPool->GetWhich( nSlot ); - const SfxPoolItem* pItem = 0; - rSet.GetItemState( nWh, TRUE, &pItem ); - - if ( !pItem && nWh != nSlot ) - pItem = &pPool->GetDefaultItem( nWh ); - - return pItem; -} - -// ----------------------------------------------------------------------- - -const SfxPoolItem* IconChoicePage::GetOldItem( const SfxItemSet& rSet, - USHORT nSlot ) -{ - const SfxItemSet& rOldSet = GetItemSet(); - USHORT nWh = GetWhich( nSlot ); - const SfxPoolItem* pItem = 0; - - if ( bStandard && rOldSet.GetParent() ) - pItem = GetItem( *rOldSet.GetParent(), nSlot ); - else if ( rSet.GetParent() && SFX_ITEM_DONTCARE == rSet.GetItemState( nWh ) ) - pItem = GetItem( *rSet.GetParent(), nSlot ); - else - pItem = GetItem( rOldSet, nSlot ); - - return pItem; -} - -// ----------------------------------------------------------------------- - -const SfxPoolItem* IconChoicePage::GetExchangeItem( const SfxItemSet& rSet, - USHORT nSlot ) -{ - if ( pDialog && !pDialog->IsInOK() && pDialog->GetExampleSet() ) - return GetItem( *pDialog->GetExampleSet(), nSlot ); - else - return GetOldItem( rSet, nSlot ); -} - -/********************************************************************** -| | window-methods | \**********************************************************************/ @@ -208,16 +158,16 @@ void IconChoicePage::ImplInitSettings() Window* pParent = GetParent(); if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) { - EnableChildTransparentMode( TRUE ); + EnableChildTransparentMode( sal_True ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( TRUE ); + SetPaintTransparent( sal_True ); SetBackground(); } else { - EnableChildTransparentMode( FALSE ); + EnableChildTransparentMode( sal_False ); SetParentClipMode( 0 ); - SetPaintTransparent( FALSE ); + SetPaintTransparent( sal_False ); if ( IsControlBackground() ) SetBackground( GetControlBackground() ); @@ -285,18 +235,18 @@ IconChoiceDialog::IconChoiceDialog ( Window* pParent, const ResId &rResId, pRanges ( NULL ), nResId ( rResId.GetId() ), - bHideResetBtn ( FALSE ), - bModal ( FALSE ), - bInOK ( FALSE ), - bModified ( FALSE ), - bItemsReset ( FALSE ) + bHideResetBtn ( sal_False ), + bModal ( sal_False ), + bInOK ( sal_False ), + bModified ( sal_False ), + bItemsReset ( sal_False ) { maIconCtrl.SetStyle (WB_3DLOOK | WB_ICON | WB_BORDER | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN ); SetCtrlPos ( meChoicePos ); maIconCtrl.SetClickHdl ( LINK ( this, IconChoiceDialog , ChosePageHdl_Impl ) ); maIconCtrl.Show(); - maIconCtrl.SetChoiceWithCursor ( TRUE ); + maIconCtrl.SetChoiceWithCursor ( sal_True ); maIconCtrl.SetSelectionMode( SINGLE_SELECTION ); maIconCtrl.SetHelpId( HID_ICCDIALOG_CHOICECTRL ); @@ -319,7 +269,7 @@ IconChoiceDialog::IconChoiceDialog ( Window* pParent, const ResId &rResId, aHelpBtn.Show(); aResetBtn.Show(); - SetPosSizeCtrls ( TRUE ); + SetPosSizeCtrls ( sal_True ); } // ----------------------------------------------------------------------- @@ -358,7 +308,7 @@ IconChoiceDialog ::~IconChoiceDialog () for ( ULONG i=0; i < maIconCtrl.GetEntryCount(); i++) { SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i ); - USHORT* pUserData = (USHORT*) pEntry->GetUserData(); + sal_uInt16* pUserData = (sal_uInt16*) pEntry->GetUserData(); delete pUserData; } @@ -376,13 +326,13 @@ IconChoiceDialog ::~IconChoiceDialog () \**********************************************************************/ SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( - USHORT nId, + sal_uInt16 nId, const String& rIconText, const Image& rChoiceIcon, CreatePage pCreateFunc /* != 0 */, GetPageRanges pRangesFunc /* darf 0 sein */, - BOOL bItemsOnDemand, - ULONG /*nPos*/ + sal_Bool bItemsOnDemand, + sal_uLong /*nPos*/ ) { IconChoicePageData* pData = new IconChoicePageData ( nId, pCreateFunc, @@ -393,7 +343,7 @@ SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( pData->fnGetRanges = pRangesFunc; pData->bOnDemand = bItemsOnDemand; - USHORT *pId = new USHORT ( nId ); + sal_uInt16 *pId = new sal_uInt16 ( nId ); SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.InsertEntry( rIconText, rChoiceIcon ); pEntry->SetUserData ( (void*) pId ); return pEntry; @@ -405,7 +355,7 @@ SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( | \**********************************************************************/ -void IconChoiceDialog::RemoveTabPage( USHORT nId ) +void IconChoiceDialog::RemoveTabPage( sal_uInt16 nId ) { IconChoicePageData* pData = GetPageData ( nId ); @@ -442,17 +392,17 @@ void IconChoiceDialog::RemoveTabPage( USHORT nId ) } // remove Icon - BOOL bFound=FALSE; + bool bFound = FALSE; for ( ULONG i=0; i<maIconCtrl.GetEntryCount() && !bFound; i++) { SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i ); - USHORT* pUserData = (USHORT*) pEntry->GetUserData(); + sal_uInt16* pUserData = (sal_uInt16*) pEntry->GetUserData(); if ( *pUserData == nId ) { delete pUserData; maIconCtrl.RemoveEntry ( pEntry ); - bFound = TRUE; + bFound = true; } } @@ -524,13 +474,6 @@ EIconChoicePos IconChoiceDialog::SetCtrlPos( const EIconChoicePos& rPos ) return eOldPos; } -void IconChoiceDialog::SetCtrlColor ( const Color& rColor ) -{ - Wallpaper aWallpaper ( rColor ); - maIconCtrl.SetBackground( aWallpaper ); - maIconCtrl.SetFontColorToBackground (); -} - /********************************************************************** | | Show / Hide page or button @@ -561,7 +504,7 @@ void IconChoiceDialog::RemoveResetButton() // ----------------------------------------------------------------------- -void IconChoiceDialog::ShowPage( USHORT nId ) +void IconChoiceDialog::ShowPage( sal_uInt16 nId ) { bool bInvalidate = GetCurPageId() != nId; SetCurPageId( nId ); @@ -591,7 +534,7 @@ void IconChoiceDialog::Resize() } } -void IconChoiceDialog::SetPosSizeCtrls ( BOOL bInit ) +void IconChoiceDialog::SetPosSizeCtrls ( sal_Bool bInit ) { const Point aCtrlOffset ( LogicToPixel( Point( CTRLS_OFFSET, CTRLS_OFFSET ), MAP_APPFONT ) ); Size aOutSize ( GetOutputSizePixel() ); @@ -692,7 +635,7 @@ void IconChoiceDialog::SetPosSizeCtrls ( BOOL bInit ) //////////////////////////////////////// // Buttons positionieren // - ULONG nXOffset=0; + sal_uLong nXOffset=0; if ( meChoicePos == PosRight ) nXOffset = aNewIconCtrlSize.Width()+(2*aCtrlOffset.X()); @@ -730,7 +673,7 @@ void IconChoiceDialog::SetPosSizeCtrls ( BOOL bInit ) Invalidate(); } -void IconChoiceDialog::SetPosSizePages ( USHORT nId ) +void IconChoiceDialog::SetPosSizePages ( sal_uInt16 nId ) { const Point aCtrlOffset ( LogicToPixel( Point( CTRLS_OFFSET, CTRLS_OFFSET ), MAP_APPFONT ) ); IconChoicePageData* pData = GetPageData ( nId ); @@ -786,13 +729,13 @@ void IconChoiceDialog::SetPosSizePages ( USHORT nId ) IMPL_LINK ( IconChoiceDialog , ChosePageHdl_Impl, void *, EMPTYARG ) { - ULONG nPos; + sal_uLong nPos; SvxIconChoiceCtrlEntry *pEntry = maIconCtrl.GetSelectedEntry ( nPos ); if ( !pEntry ) pEntry = maIconCtrl.GetCursor( ); - USHORT *pId = (USHORT*)pEntry->GetUserData (); + sal_uInt16 *pId = (sal_uInt16*)pEntry->GetUserData (); if( *pId != mnCurrentPageId ) { @@ -817,7 +760,7 @@ IMPL_LINK ( IconChoiceDialog , ChosePageHdl_Impl, void *, EMPTYARG ) IMPL_LINK( IconChoiceDialog, OkHdl, Button *, EMPTYARG ) { - bInOK = TRUE; + bInOK = sal_True; if ( OK_Impl() ) { @@ -910,7 +853,7 @@ void IconChoiceDialog::ActivatePageImpl () pData->pPage->Reset( *pSet ); } - pData->bRefresh = FALSE; + pData->bRefresh = sal_False; if ( pExampleSet ) pData->pPage->ActivatePage( *pExampleSet ); @@ -928,7 +871,7 @@ void IconChoiceDialog::ActivatePageImpl () // ----------------------------------------------------------------------- -BOOL IconChoiceDialog::DeActivatePageImpl () +sal_Bool IconChoiceDialog::DeActivatePageImpl () { IconChoicePageData *pData = GetPageData ( mnCurrentPageId ); @@ -980,17 +923,17 @@ BOOL IconChoiceDialog::DeActivatePageImpl () { IconChoicePageData* pObj = maPageList[ i ]; if ( pObj->pPage != pPage ) // eigene Page nicht mehr refreshen - pObj->bRefresh = TRUE; + pObj->bRefresh = sal_True; else - pObj->bRefresh = FALSE; + pObj->bRefresh = sal_False; } } } if ( nRet & IconChoicePage::LEAVE_PAGE ) - return TRUE; + return sal_True; else - return FALSE; + return sal_False; } // ----------------------------------------------------------------------- @@ -1017,7 +960,7 @@ void IconChoiceDialog::ResetPageImpl () | \**********************************************************************/ -const USHORT* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool ) +const sal_uInt16* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool ) { if ( pSet ) { @@ -1035,10 +978,10 @@ const USHORT* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool ) IconChoicePageData* pData = maPageList[ i ]; if ( pData->fnGetRanges ) { - const USHORT* pTmpRanges = (pData->fnGetRanges)(); - const USHORT* pIter = pTmpRanges; + const sal_uInt16* pTmpRanges = (pData->fnGetRanges)(); + const sal_uInt16* pIter = pTmpRanges; - USHORT nLen; + sal_uInt16 nLen; for( nLen = 0; *pIter; ++nLen, ++pIter ) ; aUS.Insert( pTmpRanges, nLen, aUS.Count() ); @@ -1061,14 +1004,14 @@ const USHORT* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool ) #if defined __SUNPRO_CC #pragma disable_warn #endif - qsort( (void*)aUS.GetData(), aUS.Count(), sizeof(USHORT), IconcDlgCmpUS_Impl ); + qsort( (void*)aUS.GetData(), aUS.Count(), sizeof(sal_uInt16), IconcDlgCmpUS_Impl ); #if defined __SUNPRO_CC #pragma enable_warn #endif } - pRanges = new USHORT[aUS.Count() + 1]; - memcpy(pRanges, aUS.GetData(), sizeof(USHORT) * aUS.Count()); + pRanges = new sal_uInt16[aUS.Count() + 1]; + memcpy(pRanges, aUS.GetData(), sizeof(sal_uInt16) * aUS.Count()); pRanges[aUS.Count()] = 0; return pRanges; @@ -1091,48 +1034,14 @@ void IconChoiceDialog::SetInputSet( const SfxItemSet* pInSet ) // ----------------------------------------------------------------------- -// Liefert die Pages, die ihre Sets onDemand liefern, das OutputItemSet. -const SfxItemSet* IconChoiceDialog::GetOutputItemSet ( USHORT nId ) -{ - IconChoicePageData * pData = GetPageData ( nId ); - DBG_ASSERT( pData, "TabPage nicht gefunden" ); - - if ( pData ) - { - if ( !pData->pPage ) - return NULL; - - if ( pData->bOnDemand ) - return &pData->pPage->GetItemSet(); - - return pOutSet; - } - - return NULL; -} - -// ----------------------------------------------------------------------- - -int IconChoiceDialog::FillOutputItemSet() -{ - int nRet = IconChoicePage::LEAVE_PAGE; - if ( OK_Impl() ) - Ok(); - else - nRet = IconChoicePage::KEEP_PAGE; - return nRet; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::PageCreated( USHORT /*nId*/, IconChoicePage& /*rPage*/ ) +void IconChoiceDialog::PageCreated( sal_uInt16 /*nId*/, IconChoicePage& /*rPage*/ ) { // not interested in } // ----------------------------------------------------------------------- -SfxItemSet* IconChoiceDialog::CreateInputItemSet( USHORT ) +SfxItemSet* IconChoiceDialog::CreateInputItemSet( sal_uInt16 ) { DBG_WARNINGFILE( "CreateInputItemSet nicht implementiert" ); @@ -1157,11 +1066,11 @@ short IconChoiceDialog::Execute() // ----------------------------------------------------------------------- -void IconChoiceDialog::Start( BOOL bShow ) +void IconChoiceDialog::Start( sal_Bool bShow ) { aCancelBtn.SetClickHdl( LINK( this, IconChoiceDialog, CancelHdl ) ); - bModal = FALSE; + bModal = sal_False; Start_Impl(); @@ -1192,7 +1101,7 @@ sal_Bool IconChoiceDialog::QueryClose() void IconChoiceDialog::Start_Impl() { Point aPos; - USHORT nActPage; + sal_uInt16 nActPage; if ( mnCurrentPageId == 0 || mnCurrentPageId == USHRT_MAX ) nActPage = maPageList.front()->nId; @@ -1208,7 +1117,7 @@ void IconChoiceDialog::Start_Impl() SetWindowState( ByteString( aTabDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) ); // initiale TabPage aus Programm/Hilfe/Konfig - nActPage = (USHORT)aTabDlgOpt.GetPageID(); + nActPage = (sal_uInt16)aTabDlgOpt.GetPageID(); if ( USHRT_MAX != mnCurrentPageId ) nActPage = mnCurrentPageId; @@ -1240,7 +1149,7 @@ const SfxItemSet* IconChoiceDialog::GetRefreshedSet() | \**********************************************************************/ -IconChoicePageData* IconChoiceDialog::GetPageData ( USHORT nId ) +IconChoicePageData* IconChoiceDialog::GetPageData ( sal_uInt16 nId ) { IconChoicePageData *pRet = NULL; for ( size_t i=0; i < maPageList.size(); i++ ) @@ -1261,7 +1170,7 @@ IconChoicePageData* IconChoiceDialog::GetPageData ( USHORT nId ) | \**********************************************************************/ -BOOL IconChoiceDialog::OK_Impl() +sal_Bool IconChoiceDialog::OK_Impl() { IconChoicePage* pPage = GetPageData ( mnCurrentPageId )->pPage; @@ -1272,7 +1181,7 @@ BOOL IconChoiceDialog::OK_Impl() if ( pSet ) { SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if ( pPage->HasExchangeSupport() ) nRet = pPage->DeactivatePage( &aTmp ); @@ -1284,7 +1193,7 @@ BOOL IconChoiceDialog::OK_Impl() pOutSet->Put( aTmp ); } else if ( bRet ) - bModified |= TRUE; + bModified |= sal_True; } else nRet = pPage->DeactivatePage( NULL ); @@ -1298,16 +1207,16 @@ BOOL IconChoiceDialog::OK_Impl() short IconChoiceDialog::Ok() { - bInOK = TRUE; + bInOK = sal_True; if ( !pOutSet ) { if ( !pExampleSet && pSet ) - pOutSet = pSet->Clone( FALSE ); // ohne Items + pOutSet = pSet->Clone( sal_False ); // ohne Items else if ( pExampleSet ) pOutSet = new SfxItemSet( *pExampleSet ); } - BOOL _bModified = FALSE; + sal_Bool _bModified = sal_False; for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i ) { @@ -1329,7 +1238,7 @@ short IconChoiceDialog::Ok() if ( pPage->FillItemSet( aTmp ) ) { - _bModified |= TRUE; + _bModified |= sal_True; pExampleSet->Put( aTmp ); pOutSet->Put( aTmp ); } @@ -1338,27 +1247,20 @@ short IconChoiceDialog::Ok() } if ( _bModified || ( pOutSet && pOutSet->Count() > 0 ) ) - _bModified |= TRUE; + _bModified |= sal_True; return _bModified ? RET_OK : RET_CANCEL; } // ----------------------------------------------------------------------- -BOOL IconChoiceDialog::IsInOK() const -{ - return bInOK; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::FocusOnIcon( USHORT nId ) +void IconChoiceDialog::FocusOnIcon( sal_uInt16 nId ) { // set focus to icon for the current visible page - for ( USHORT i=0; i<maIconCtrl.GetEntryCount(); i++) + for ( sal_uInt16 i=0; i<maIconCtrl.GetEntryCount(); i++) { SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i ); - USHORT* pUserData = (USHORT*) pEntry->GetUserData(); + sal_uInt16* pUserData = (sal_uInt16*) pEntry->GetUserData(); if ( pUserData && *pUserData == nId ) { @@ -1368,11 +1270,5 @@ void IconChoiceDialog::FocusOnIcon( USHORT nId ) } } -// ----------------------------------------------------------------------- - -void IconChoiceDialog::CreateIconTextAutoMnemonics( void ) -{ - maIconCtrl.CreateAutoMnemonics(); -} -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file |