LCOV - code coverage report
Current view: top level - cui/source/dialogs - iconcdlg.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 523 0.0 %
Date: 2014-04-11 Functions: 0 49 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sfx2/app.hxx>
      21             : #include <tools/rc.h>
      22             : #include <tools/shl.hxx>
      23             : 
      24             : #include <dialmgr.hxx>
      25             : 
      26             : #include "iconcdlg.hxx"
      27             : 
      28             : #include "helpid.hrc"
      29             : #include <cuires.hrc>
      30             : #include <unotools/viewoptions.hxx>
      31             : #include <svtools/apearcfg.hxx>
      32             : #include <vcl/mnemonic.hxx>
      33             : #include <vcl/i18nhelp.hxx>
      34             : #include <vcl/settings.hxx>
      35             : 
      36             : using ::std::vector;
      37             : 
      38             : // some stuff for easier changes for SvtViewOptions
      39             : static const sal_Char*      pViewOptDataName = "dialog data";
      40             : #define VIEWOPT_DATANAME    OUString::createFromAscii( pViewOptDataName )
      41             : 
      42           0 : static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const OUString& rData )
      43             : {
      44           0 :     rOpt.SetUserItem( VIEWOPT_DATANAME, css::uno::makeAny( rData ) );
      45           0 : }
      46             : 
      47           0 : static inline OUString GetViewOptUserItem( const SvtViewOptions& rOpt )
      48             : {
      49           0 :     ::com::sun::star::uno::Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) );
      50           0 :     OUString aUserData;
      51           0 :     aAny >>= aUserData;
      52             : 
      53           0 :     return aUserData;
      54             : }
      55             : 
      56             : 
      57             : 
      58             : 
      59             : // Class IconChoicePage
      60             : 
      61             : 
      62             : 
      63             : /**********************************************************************
      64             : |
      65             : | Ctor / Dtor
      66             : |
      67             : \**********************************************************************/
      68             : 
      69           0 : IconChoicePage::IconChoicePage( Window *pParent, const ResId &rResId,
      70             :                                 const SfxItemSet &rAttrSet )
      71             : :   TabPage                   ( pParent, rResId ),
      72             :     pSet                      ( &rAttrSet ),
      73             :     bHasExchangeSupport       ( sal_False ),
      74           0 :     pDialog                   ( NULL )
      75             : {
      76           0 :     SetStyle ( GetStyle()  | WB_DIALOGCONTROL | WB_HIDE );
      77           0 : }
      78             : 
      79             : 
      80             : 
      81           0 : IconChoicePage::~IconChoicePage()
      82             : {
      83           0 : }
      84             : 
      85             : /**********************************************************************
      86             : |
      87             : | Activate / Deaktivate
      88             : |
      89             : \**********************************************************************/
      90             : 
      91           0 : void IconChoicePage::ActivatePage( const SfxItemSet& )
      92             : {
      93           0 : }
      94             : 
      95             : 
      96             : 
      97           0 : int IconChoicePage::DeactivatePage( SfxItemSet* )
      98             : {
      99           0 :     return LEAVE_PAGE;
     100             : }
     101             : 
     102             : /**********************************************************************
     103             : |
     104             : | ...
     105             : |
     106             : \**********************************************************************/
     107             : 
     108           0 : void IconChoicePage::FillUserData()
     109             : {
     110           0 : }
     111             : 
     112             : 
     113             : 
     114           0 : sal_Bool IconChoicePage::IsReadOnly() const
     115             : {
     116           0 :     return sal_False;
     117             : }
     118             : 
     119             : 
     120             : 
     121           0 : sal_Bool IconChoicePage::QueryClose()
     122             : {
     123           0 :     return sal_True;
     124             : }
     125             : 
     126             : /**********************************************************************
     127             : |
     128             : | window-methods
     129             : |
     130             : \**********************************************************************/
     131             : 
     132           0 : void IconChoicePage::ImplInitSettings()
     133             : {
     134           0 :     Window* pParent = GetParent();
     135           0 :     if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
     136             :     {
     137           0 :         EnableChildTransparentMode( true );
     138           0 :         SetParentClipMode( PARENTCLIPMODE_NOCLIP );
     139           0 :         SetPaintTransparent( true );
     140           0 :         SetBackground();
     141             :     }
     142             :     else
     143             :     {
     144           0 :         EnableChildTransparentMode( false );
     145           0 :         SetParentClipMode( 0 );
     146           0 :         SetPaintTransparent( false );
     147             : 
     148           0 :         if ( IsControlBackground() )
     149           0 :             SetBackground( GetControlBackground() );
     150             :         else
     151           0 :             SetBackground( pParent->GetBackground() );
     152             :     }
     153           0 : }
     154             : 
     155             : 
     156             : 
     157           0 : void IconChoicePage::StateChanged( StateChangedType nType )
     158             : {
     159           0 :     Window::StateChanged( nType );
     160             : 
     161           0 :     if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
     162             :     {
     163           0 :         ImplInitSettings();
     164           0 :         Invalidate();
     165             :     }
     166           0 : }
     167             : 
     168             : 
     169             : 
     170           0 : void IconChoicePage::DataChanged( const DataChangedEvent& rDCEvt )
     171             : {
     172           0 :     Window::DataChanged( rDCEvt );
     173             : 
     174           0 :     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
     175           0 :          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
     176             :     {
     177           0 :         ImplInitSettings();
     178           0 :         Invalidate();
     179             :     }
     180           0 : }
     181             : 
     182             : 
     183             : 
     184             : // Class IconChoiceDialog
     185             : 
     186             : 
     187             : 
     188             : /**********************************************************************
     189             : |
     190             : | Ctor / Dtor
     191             : |
     192             : \**********************************************************************/
     193             : 
     194           0 : IconChoiceDialog::IconChoiceDialog ( Window* pParent, const ResId &rResId,
     195             :                                      const EIconChoicePos ePos,
     196             :                                      const SfxItemSet *pItemSet )
     197             : :   ModalDialog         ( pParent, rResId ),
     198             :     meChoicePos     ( ePos ),
     199             :     maIconCtrl      ( this, WB_3DLOOK | WB_ICON | WB_BORDER |
     200             :                             WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME |
     201             :                             WB_NODRAGSELECTION | WB_TABSTOP ),
     202             :     mnCurrentPageId ( USHRT_MAX ),
     203             : 
     204             :     aOKBtn          ( this, WB_DEFBUTTON ),
     205             :     aCancelBtn      ( this, WB_DEFBUTTON ),
     206             :     aHelpBtn        ( this ),
     207             :     aResetBtn       ( this ),
     208             :     pSet            ( pItemSet ),
     209             :     pOutSet         ( NULL ),
     210             :     pExampleSet     ( NULL ),
     211             :     pRanges         ( NULL ),
     212           0 :     nResId          ( rResId.GetId() ),
     213             : 
     214             :     bHideResetBtn   ( sal_False ),
     215             :     bModal          ( sal_False ),
     216             :     bInOK           ( sal_False ),
     217             :     bModified       ( sal_False ),
     218           0 :     bItemsReset     ( sal_False )
     219             : {
     220             : 
     221           0 :     maIconCtrl.SetStyle (WB_3DLOOK | WB_ICON | WB_BORDER | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN );
     222           0 :     SetCtrlPos ( meChoicePos );
     223           0 :     maIconCtrl.SetClickHdl ( LINK ( this, IconChoiceDialog , ChosePageHdl_Impl ) );
     224           0 :     maIconCtrl.Show();
     225           0 :     maIconCtrl.SetChoiceWithCursor ( true );
     226           0 :     maIconCtrl.SetSelectionMode( SINGLE_SELECTION );
     227           0 :     maIconCtrl.SetHelpId( HID_ICCDIALOG_CHOICECTRL );
     228             : 
     229             :     // ItemSet
     230           0 :     if ( pSet )
     231             :     {
     232           0 :         pExampleSet = new SfxItemSet( *pSet );
     233           0 :         pOutSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
     234             :     }
     235             : 
     236             :     // Buttons
     237           0 :     aOKBtn.SetClickHdl   ( LINK( this, IconChoiceDialog, OkHdl ) );
     238           0 :     aOKBtn.SetHelpId( HID_ICCDIALOG_OK_BTN );
     239           0 :     aCancelBtn.SetHelpId( HID_ICCDIALOG_CANCEL_BTN );
     240           0 :     aResetBtn.SetClickHdl( LINK( this, IconChoiceDialog, ResetHdl ) );
     241           0 :     aResetBtn.SetText( CUI_RESSTR(RID_SVXSTR_ICONCHOICEDLG_RESETBUT) );
     242           0 :     aResetBtn.SetHelpId( HID_ICCDIALOG_RESET_BTN );
     243           0 :     aOKBtn.Show();
     244           0 :     aCancelBtn.Show();
     245           0 :     aHelpBtn.Show();
     246           0 :     aResetBtn.Show();
     247             : 
     248           0 :     SetPosSizeCtrls ( sal_True );
     249           0 : }
     250             : 
     251             : 
     252             : 
     253           0 : IconChoiceDialog ::~IconChoiceDialog ()
     254             : {
     255             :     // save configuration at INI-Manager
     256             :     // and remove pages
     257           0 :     SvtViewOptions aTabDlgOpt( E_TABDIALOG, OUString::number(nResId) );
     258           0 :     aTabDlgOpt.SetWindowState(OStringToOUString(GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)), RTL_TEXTENCODING_ASCII_US));
     259           0 :     aTabDlgOpt.SetPageID( mnCurrentPageId );
     260             : 
     261           0 :     for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i )
     262             :     {
     263           0 :         IconChoicePageData* pData = maPageList[ i ];
     264             : 
     265           0 :         if ( pData->pPage )
     266             :         {
     267           0 :             pData->pPage->FillUserData();
     268           0 :             OUString aPageData(pData->pPage->GetUserData());
     269           0 :             if ( !aPageData.isEmpty() )
     270             :             {
     271           0 :                 SvtViewOptions aTabPageOpt( E_TABPAGE, OUString::number(pData->nId) );
     272             : 
     273           0 :                 SetViewOptUserItem( aTabPageOpt, aPageData );
     274             :             }
     275             : 
     276           0 :             if ( pData->bOnDemand )
     277           0 :                 delete (SfxItemSet*)&pData->pPage->GetItemSet();
     278           0 :             delete pData->pPage;
     279             :         }
     280           0 :         delete pData;
     281             :     }
     282             : 
     283             :     // remove Userdata from Icons
     284           0 :     for ( sal_uLong i=0; i < maIconCtrl.GetEntryCount(); i++)
     285             :     {
     286           0 :         SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i );
     287           0 :         sal_uInt16* pUserData = (sal_uInt16*) pEntry->GetUserData();
     288           0 :         delete pUserData;
     289             :     }
     290             : 
     291             : 
     292           0 :     if ( pRanges )
     293           0 :         delete pRanges;
     294           0 :     if ( pOutSet )
     295           0 :         delete pOutSet;
     296           0 : }
     297             : 
     298             : /**********************************************************************
     299             : |
     300             : | add new page
     301             : |
     302             : \**********************************************************************/
     303             : 
     304           0 : SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage(
     305             :     sal_uInt16          nId,
     306             :     const OUString&   rIconText,
     307             :     const Image&    rChoiceIcon,
     308             :     CreatePage      pCreateFunc /* != 0 */,
     309             :     GetPageRanges   pRangesFunc /* darf 0 sein */,
     310             :     sal_Bool            bItemsOnDemand,
     311             :     sal_uLong           /*nPos*/
     312             : )
     313             : {
     314             :     IconChoicePageData* pData = new IconChoicePageData ( nId, pCreateFunc,
     315             :                                                          pRangesFunc,
     316           0 :                                                          bItemsOnDemand );
     317           0 :     maPageList.push_back( pData );
     318             : 
     319           0 :     pData->fnGetRanges = pRangesFunc;
     320           0 :     pData->bOnDemand = bItemsOnDemand;
     321             : 
     322           0 :     sal_uInt16 *pId = new sal_uInt16 ( nId );
     323           0 :     SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.InsertEntry( rIconText, rChoiceIcon );
     324           0 :     pEntry->SetUserData ( (void*) pId );
     325           0 :     return pEntry;
     326             : }
     327             : 
     328             : /**********************************************************************
     329             : |
     330             : | Paint-method
     331             : |
     332             : \**********************************************************************/
     333             : 
     334           0 : void IconChoiceDialog::Paint( const Rectangle& rRect )
     335             : {
     336           0 :     Dialog::Paint ( rRect );
     337             : 
     338           0 :     for ( size_t i = 0; i < maPageList.size(); i++ )
     339             :     {
     340           0 :         IconChoicePageData* pData = maPageList[ i ];
     341             : 
     342           0 :         if ( pData->nId == mnCurrentPageId )
     343             :         {
     344           0 :             ShowPageImpl ( pData );
     345             :         }
     346             :         else
     347             :         {
     348           0 :             HidePageImpl ( pData );
     349             :         }
     350             :     }
     351           0 : }
     352             : 
     353           0 : EIconChoicePos IconChoiceDialog::SetCtrlPos( const EIconChoicePos& rPos )
     354             : {
     355           0 :     WinBits aWinBits = maIconCtrl.GetStyle ();
     356             : 
     357           0 :     switch ( meChoicePos )
     358             :     {
     359             :         case PosLeft :
     360           0 :             aWinBits &= ~WB_ALIGN_TOP & ~WB_NOVSCROLL;
     361           0 :             aWinBits |= WB_ALIGN_LEFT | WB_NOHSCROLL;
     362           0 :             break;
     363             :         case PosRight :
     364           0 :             aWinBits &= ~WB_ALIGN_TOP & ~WB_NOVSCROLL;
     365           0 :             aWinBits |= WB_ALIGN_LEFT | WB_NOHSCROLL;
     366           0 :             break;
     367             :         case PosTop :
     368           0 :             aWinBits &= ~WB_ALIGN_LEFT & ~WB_NOHSCROLL;
     369           0 :             aWinBits |= WB_ALIGN_TOP | WB_NOVSCROLL;
     370           0 :             break;
     371             :         case PosBottom :
     372           0 :             aWinBits &= ~WB_ALIGN_LEFT & ~WB_NOHSCROLL;
     373           0 :             aWinBits |= WB_ALIGN_TOP | WB_NOVSCROLL;
     374           0 :             break;
     375             :     };
     376           0 :     maIconCtrl.SetStyle ( aWinBits );
     377             : 
     378           0 :     SetPosSizeCtrls();
     379             : 
     380             : 
     381           0 :     EIconChoicePos eOldPos = meChoicePos;
     382           0 :     meChoicePos = rPos;
     383             : 
     384           0 :     return eOldPos;
     385             : }
     386             : 
     387             : /**********************************************************************
     388             : |
     389             : | Show / Hide page or button
     390             : |
     391             : \**********************************************************************/
     392             : 
     393           0 : void IconChoiceDialog::ShowPageImpl ( IconChoicePageData* pData )
     394             : {
     395           0 :     if ( pData->pPage )
     396           0 :         pData->pPage->Show();
     397           0 : }
     398             : 
     399             : 
     400             : 
     401           0 : void IconChoiceDialog::HidePageImpl ( IconChoicePageData* pData )
     402             : {
     403           0 :     if ( pData->pPage )
     404           0 :         pData->pPage->Hide();
     405           0 : }
     406             : 
     407             : 
     408             : 
     409           0 : void IconChoiceDialog::ShowPage( sal_uInt16 nId )
     410             : {
     411           0 :     bool bInvalidate = GetCurPageId() != nId;
     412           0 :     SetCurPageId( nId );
     413           0 :     ActivatePageImpl( );
     414           0 :     if(bInvalidate)
     415           0 :         Invalidate();
     416             : 
     417             :     // IA2 CWS. MT: I guess we want the event now, and not in Paint()?
     418           0 :     IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
     419           0 :     if(pData)
     420           0 :         ShowPageImpl ( pData );
     421           0 : }
     422             : 
     423             : /**********************************************************************
     424             : |
     425             : | Resize Dialog
     426             : |
     427             : \**********************************************************************/
     428             : 
     429             : #define ICONCTRL_WIDTH_PIXEL       110
     430             : #define ICONCTRL_HEIGHT_PIXEL       75
     431             : 
     432           0 : void IconChoiceDialog::Resize()
     433             : {
     434           0 :     Dialog::Resize ();
     435             : 
     436           0 :     if ( IsReallyVisible() )
     437             :     {
     438           0 :         SetPosSizeCtrls ();
     439             :     }
     440           0 : }
     441             : 
     442           0 : void IconChoiceDialog::SetPosSizeCtrls ( sal_Bool bInit )
     443             : {
     444           0 :     const Point aCtrlOffset ( LogicToPixel( Point( CTRLS_OFFSET, CTRLS_OFFSET ), MAP_APPFONT ) );
     445           0 :     Size aOutSize ( GetOutputSizePixel() );
     446             : 
     447             : 
     448             :     // Button-Defaults
     449             : 
     450           0 :     Size aDefaultButtonSize = LogicToPixel( Size( 50, 14 ), MAP_APPFONT );
     451             : 
     452             :     // Reset-Button
     453             :     Size aResetButtonSize ( bInit ? aDefaultButtonSize :
     454           0 :                                     aResetBtn.GetSizePixel () );
     455             : 
     456             : 
     457             :     // IconChoiceCtrl resizen & positionieren
     458             : 
     459           0 :     SvtTabAppearanceCfg aCfg;
     460           0 :     const long nDefaultWidth = (aCfg.GetScaleFactor() * ICONCTRL_WIDTH_PIXEL) / 100;
     461           0 :     const long nDefaultHeight = (aCfg.GetScaleFactor() * ICONCTRL_HEIGHT_PIXEL) / 100;
     462             : 
     463             :     Size aNewIconCtrlSize  ( nDefaultWidth,
     464           0 :                              aOutSize.Height()-(2*aCtrlOffset.X()) );
     465           0 :     Point aIconCtrlPos;
     466           0 :     switch ( meChoicePos )
     467             :     {
     468             :         case PosLeft :
     469           0 :             aIconCtrlPos = aCtrlOffset;
     470             :             aNewIconCtrlSize = Size ( nDefaultWidth,
     471           0 :                                       aOutSize.Height()-(2*aCtrlOffset.X()) );
     472           0 :             break;
     473             :         case PosRight :
     474           0 :             aIconCtrlPos = Point ( aOutSize.Width() - nDefaultWidth -
     475           0 :                                    aCtrlOffset.X(), aCtrlOffset.X() );
     476             :             aNewIconCtrlSize = Size ( nDefaultWidth,
     477           0 :                                       aOutSize.Height()-(2*aCtrlOffset.X()) );
     478           0 :             break;
     479             :         case PosTop :
     480           0 :             aIconCtrlPos = aCtrlOffset;
     481           0 :             aNewIconCtrlSize = Size ( aOutSize.Width()-(2*aCtrlOffset.X()),
     482           0 :                                       nDefaultHeight );
     483           0 :             break;
     484             :         case PosBottom :
     485           0 :             aIconCtrlPos = Point ( aCtrlOffset.X(), aOutSize.Height() -
     486           0 :                                    aResetButtonSize.Height() - (2*aCtrlOffset.X()) -
     487           0 :                                    nDefaultHeight );
     488           0 :             aNewIconCtrlSize = Size ( aOutSize.Width()-(2*aCtrlOffset.X()),
     489           0 :                                       nDefaultHeight );
     490           0 :             break;
     491             :     };
     492           0 :     maIconCtrl.SetPosSizePixel ( aIconCtrlPos, aNewIconCtrlSize );
     493           0 :     maIconCtrl.ArrangeIcons();
     494             : 
     495             : 
     496             :     // resize & position the pages
     497             : 
     498           0 :     for ( size_t i = 0; i < maPageList.size(); i++ )
     499             :     {
     500           0 :         IconChoicePageData* pData = maPageList[ i ];
     501             : 
     502           0 :         Point aNewPagePos;
     503           0 :         Size aNewPageSize;
     504           0 :         switch ( meChoicePos )
     505             :         {
     506             :             case PosLeft :
     507           0 :                 aNewPagePos = Point ( aNewIconCtrlSize.Width() + (2*CTRLS_OFFSET),
     508           0 :                                       CTRLS_OFFSET );
     509           0 :                 aNewPageSize = Size ( aOutSize.Width() - aNewIconCtrlSize.Width() -
     510             :                                       (3*CTRLS_OFFSET),
     511           0 :                                       aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
     512           0 :                                       (3*CTRLS_OFFSET) );
     513           0 :                 break;
     514             :             case PosRight :
     515           0 :                 aNewPagePos = aCtrlOffset;
     516           0 :                 aNewPageSize = Size ( aOutSize.Width() - aNewIconCtrlSize.Width() -
     517           0 :                                       (3*aCtrlOffset.X()),
     518           0 :                                       aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
     519           0 :                                       (3*aCtrlOffset.X()) );
     520           0 :                 break;
     521             :             case PosTop :
     522           0 :                 aNewPagePos = Point ( aCtrlOffset.X(), aNewIconCtrlSize.Height() +
     523           0 :                                       (2*aCtrlOffset.X()) );
     524           0 :                 aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()),
     525           0 :                                       aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
     526           0 :                                       aNewIconCtrlSize.Height() - (4*aCtrlOffset.X()) );
     527           0 :                 break;
     528             :             case PosBottom :
     529           0 :                 aNewPagePos = aCtrlOffset;
     530           0 :                 aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()),
     531           0 :                                       aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
     532           0 :                                       aNewIconCtrlSize.Height() - (4*aCtrlOffset.X()) );
     533           0 :                 break;
     534             :         };
     535             : 
     536           0 :         if ( pData->pPage )
     537           0 :             pData->pPage->SetPosSizePixel ( aNewPagePos, aNewPageSize );
     538             :     }
     539             : 
     540             : 
     541             :     // position the buttons
     542             : 
     543           0 :     sal_uLong nXOffset=0;
     544           0 :     if ( meChoicePos == PosRight )
     545           0 :         nXOffset = aNewIconCtrlSize.Width()+(2*aCtrlOffset.X());
     546             : 
     547           0 :     aResetBtn.SetPosSizePixel ( Point( aOutSize.Width() - nXOffset -
     548           0 :                                        aResetButtonSize.Width()-aCtrlOffset.X(),
     549           0 :                                        aOutSize.Height()-aResetButtonSize.Height()-
     550           0 :                                        aCtrlOffset.X() ),
     551           0 :                                aResetButtonSize );
     552             :     // Help-Button
     553             :     Size aHelpButtonSize ( bInit ? aDefaultButtonSize :
     554           0 :                                    aHelpBtn.GetSizePixel () );
     555           0 :     aHelpBtn.SetPosSizePixel ( Point( aOutSize.Width()-aResetButtonSize.Width()-
     556           0 :                                       aHelpButtonSize.Width()- nXOffset -
     557           0 :                                       (2*aCtrlOffset.X()),
     558           0 :                                       aOutSize.Height()-aHelpButtonSize.Height()-
     559           0 :                                       aCtrlOffset.X() ),
     560           0 :                                aHelpButtonSize );
     561             :     // Cancel-Button
     562             :     Size aCancelButtonSize ( bInit ? aDefaultButtonSize :
     563           0 :                                      aCancelBtn.GetSizePixel () );
     564           0 :     aCancelBtn.SetPosSizePixel ( Point( aOutSize.Width()-aCancelButtonSize.Width()-
     565           0 :                                         aResetButtonSize.Width()-aHelpButtonSize.Width()-
     566           0 :                                         (3*aCtrlOffset.X()) -  nXOffset,
     567           0 :                                         aOutSize.Height()-aCancelButtonSize.Height()-
     568           0 :                                         aCtrlOffset.X() ),
     569           0 :                                 aCancelButtonSize );
     570             :     // OK-Button
     571           0 :     Size aOKButtonSize ( bInit ? aDefaultButtonSize : aOKBtn.GetSizePixel () );
     572           0 :     aOKBtn.SetPosSizePixel ( Point( aOutSize.Width()-aOKButtonSize.Width()-
     573           0 :                                     aCancelButtonSize.Width()-aResetButtonSize.Width()-
     574           0 :                                     aHelpButtonSize.Width()-(4*aCtrlOffset.X())-  nXOffset,
     575           0 :                                     aOutSize.Height()-aOKButtonSize.Height()-aCtrlOffset.X() ),
     576           0 :                             aOKButtonSize );
     577             : 
     578           0 :     Invalidate();
     579           0 : }
     580             : 
     581           0 : void IconChoiceDialog::SetPosSizePages ( sal_uInt16 nId )
     582             : {
     583           0 :     const Point aCtrlOffset ( LogicToPixel( Point( CTRLS_OFFSET, CTRLS_OFFSET ), MAP_APPFONT ) );
     584           0 :     IconChoicePageData* pData = GetPageData ( nId );
     585             : 
     586           0 :     if ( pData->pPage )
     587             :     {
     588           0 :         Size aOutSize ( GetOutputSizePixel() );
     589           0 :         Size aIconCtrlSize ( maIconCtrl.GetSizePixel() );
     590             : 
     591           0 :         Point aNewPagePos;
     592           0 :         Size aNewPageSize;
     593           0 :         switch ( meChoicePos )
     594             :         {
     595             :             case PosLeft :
     596           0 :                 aNewPagePos = Point ( aIconCtrlSize.Width() + (2*aCtrlOffset.X()),
     597           0 :                                       aCtrlOffset.X() );
     598           0 :                 aNewPageSize = Size ( aOutSize.Width() - maIconCtrl.GetSizePixel().Width() -
     599           0 :                                       (3*aCtrlOffset.X()),
     600           0 :                                       aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
     601           0 :                                       (3*aCtrlOffset.X()) );
     602           0 :                 break;
     603             :             case PosRight :
     604           0 :                 aNewPagePos = aCtrlOffset;
     605           0 :                 aNewPageSize = Size ( aOutSize.Width() - maIconCtrl.GetSizePixel().Width() -
     606           0 :                                       (3*aCtrlOffset.X()),
     607           0 :                                       aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
     608           0 :                                       (3*aCtrlOffset.X()) );
     609           0 :                 break;
     610             :             case PosTop :
     611           0 :                 aNewPagePos = Point ( aCtrlOffset.X(), aIconCtrlSize.Height() +
     612           0 :                                       (2*aCtrlOffset.X()) );
     613           0 :                 aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()),
     614           0 :                                       aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
     615           0 :                                       maIconCtrl.GetSizePixel().Height() - (4*aCtrlOffset.X()) );
     616           0 :                 break;
     617             :             case PosBottom :
     618           0 :                 aNewPagePos = aCtrlOffset;
     619           0 :                 aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()),
     620           0 :                                       aOutSize.Height() - aOKBtn.GetSizePixel().Height() -
     621           0 :                                       maIconCtrl.GetSizePixel().Height() - (4*aCtrlOffset.X()) );
     622           0 :                 break;
     623             :         };
     624             : 
     625           0 :         pData->pPage->SetPosSizePixel ( aNewPagePos, aNewPageSize );
     626             :     }
     627           0 : }
     628             : 
     629             : /**********************************************************************
     630             : |
     631             : | select a page
     632             : |
     633             : \**********************************************************************/
     634             : 
     635           0 : IMPL_LINK_NOARG(IconChoiceDialog , ChosePageHdl_Impl)
     636             : {
     637             :     sal_uLong nPos;
     638             : 
     639           0 :     SvxIconChoiceCtrlEntry *pEntry = maIconCtrl.GetSelectedEntry ( nPos );
     640           0 :     if ( !pEntry )
     641           0 :         pEntry = maIconCtrl.GetCursor( );
     642             : 
     643           0 :     sal_uInt16 *pId = (sal_uInt16*)pEntry->GetUserData ();
     644             : 
     645           0 :     if( *pId != mnCurrentPageId )
     646             :     {
     647           0 :         IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
     648           0 :         if ( pData->pPage )
     649           0 :             DeActivatePageImpl();
     650             : 
     651           0 :         SetCurPageId ( *pId );
     652             : 
     653           0 :         ActivatePageImpl();
     654           0 :         Invalidate();
     655             :     }
     656             : 
     657           0 :     return 0L;
     658             : }
     659             : 
     660             : /**********************************************************************
     661             : |
     662             : | Button-handler
     663             : |
     664             : \**********************************************************************/
     665             : 
     666           0 : IMPL_LINK_NOARG(IconChoiceDialog, OkHdl)
     667             : {
     668           0 :     bInOK = sal_True;
     669             : 
     670           0 :     if ( OK_Impl() )
     671             :     {
     672           0 :         if ( bModal )
     673           0 :             EndDialog( Ok() );
     674             :         else
     675             :         {
     676           0 :             Ok();
     677           0 :             Close();
     678             :         }
     679             :     }
     680           0 :     return 0;
     681             : }
     682             : 
     683             : 
     684             : 
     685           0 : IMPL_LINK_NOARG(IconChoiceDialog, ResetHdl)
     686             : {
     687           0 :     ResetPageImpl ();
     688             : 
     689           0 :     IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
     690             :     DBG_ASSERT( pData, "Id nicht bekannt" );
     691             : 
     692           0 :     if ( pData->bOnDemand )
     693             :     {
     694             :         // CSet on AIS has problems here, therefore separated
     695           0 :         const SfxItemSet* _pSet = &( pData->pPage->GetItemSet() );
     696           0 :         pData->pPage->Reset( *(SfxItemSet*)_pSet );
     697             :     }
     698             :     else
     699           0 :         pData->pPage->Reset( *pSet );
     700             : 
     701             : 
     702           0 :     return 0;
     703             : }
     704             : 
     705             : 
     706             : 
     707           0 : IMPL_LINK_NOARG(IconChoiceDialog, CancelHdl)
     708             : {
     709           0 :     Close();
     710             : 
     711           0 :     return 0;
     712             : }
     713             : 
     714             : /**********************************************************************
     715             : |
     716             : | call page
     717             : |
     718             : \**********************************************************************/
     719             : 
     720           0 : void IconChoiceDialog::ActivatePageImpl ()
     721             : {
     722             :     DBG_ASSERT( !maPageList.empty(), "keine Pages angemeldet" );
     723           0 :     IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
     724             :     DBG_ASSERT( pData, "Id nicht bekannt" );
     725           0 :     bool bReadOnly = false;
     726           0 :     if ( pData )
     727             :     {
     728           0 :         if ( !pData->pPage )
     729             :         {
     730           0 :             const SfxItemSet* pTmpSet = 0;
     731             : 
     732           0 :             if ( pSet )
     733             :             {
     734           0 :                 if ( bItemsReset && pSet->GetParent() )
     735           0 :                     pTmpSet = pSet->GetParent();
     736             :                 else
     737           0 :                     pTmpSet = pSet;
     738             :             }
     739             : 
     740           0 :             if ( pTmpSet && !pData->bOnDemand )
     741           0 :                 pData->pPage = (pData->fnCreatePage)( this, *pTmpSet );
     742             :             else
     743           0 :                 pData->pPage = (pData->fnCreatePage)( this, *CreateInputItemSet( mnCurrentPageId ) );
     744             : 
     745           0 :             SvtViewOptions aTabPageOpt( E_TABPAGE, OUString::number(pData->nId) );
     746           0 :             pData->pPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) );
     747           0 :             SetPosSizePages ( pData->nId );
     748             : 
     749           0 :             if ( pData->bOnDemand )
     750           0 :                 pData->pPage->Reset( (SfxItemSet &)pData->pPage->GetItemSet() );
     751             :             else
     752           0 :                 pData->pPage->Reset( *pSet );
     753             : 
     754           0 :             PageCreated( mnCurrentPageId, *pData->pPage );
     755             :         }
     756           0 :         else if ( pData->bRefresh )
     757             :         {
     758           0 :             pData->pPage->Reset( *pSet );
     759             :         }
     760             : 
     761           0 :         pData->bRefresh = sal_False;
     762             : 
     763           0 :         if ( pExampleSet )
     764           0 :             pData->pPage->ActivatePage( *pExampleSet );
     765           0 :         SetHelpId( pData->pPage->GetHelpId() );
     766           0 :         bReadOnly = pData->pPage->IsReadOnly();
     767             :     }
     768             : 
     769             : 
     770           0 :     if ( bReadOnly || bHideResetBtn )
     771           0 :         aResetBtn.Hide();
     772             :     else
     773           0 :         aResetBtn.Show();
     774             : 
     775           0 : }
     776             : 
     777             : 
     778             : 
     779           0 : sal_Bool IconChoiceDialog::DeActivatePageImpl ()
     780             : {
     781           0 :     IconChoicePageData *pData = GetPageData ( mnCurrentPageId );
     782             : 
     783           0 :     int nRet = IconChoicePage::LEAVE_PAGE;
     784             : 
     785           0 :     if ( pData )
     786             :     {
     787           0 :         IconChoicePage * pPage = pData->pPage;
     788             : 
     789           0 :         if ( !pExampleSet && pPage->HasExchangeSupport() && pSet )
     790           0 :             pExampleSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
     791             : 
     792           0 :         if ( pSet )
     793             :         {
     794           0 :             SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() );
     795             : 
     796           0 :             if ( pPage->HasExchangeSupport() )
     797           0 :                 nRet = pPage->DeactivatePage( &aTmp );
     798             : 
     799           0 :             if ( ( IconChoicePage::LEAVE_PAGE & nRet ) == IconChoicePage::LEAVE_PAGE &&
     800           0 :                  aTmp.Count() )
     801             :             {
     802           0 :                 pExampleSet->Put( aTmp );
     803           0 :                 pOutSet->Put( aTmp );
     804           0 :             }
     805             :         }
     806             :         else
     807             :         {
     808           0 :             if ( pPage->HasExchangeSupport() ) //!!!
     809             :             {
     810           0 :                 if ( !pExampleSet )
     811             :                 {
     812           0 :                     SfxItemPool* pPool = pPage->GetItemSet().GetPool();
     813             :                     pExampleSet =
     814           0 :                         new SfxItemSet( *pPool, GetInputRanges( *pPool ) );
     815             :                 }
     816           0 :                 nRet = pPage->DeactivatePage( pExampleSet );
     817             :             }
     818             :             else
     819           0 :                 nRet = pPage->DeactivatePage( NULL );
     820             :         }
     821             : 
     822           0 :         if ( nRet & IconChoicePage::REFRESH_SET )
     823             :         {
     824           0 :             pSet = GetRefreshedSet();
     825             :             DBG_ASSERT( pSet, "GetRefreshedSet() liefert NULL" );
     826             :             // flag all pages to be newly initialized
     827           0 :             for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i )
     828             :             {
     829           0 :                 IconChoicePageData* pObj = maPageList[ i ];
     830           0 :                 if ( pObj->pPage != pPage )
     831           0 :                     pObj->bRefresh = sal_True;
     832             :                 else
     833           0 :                     pObj->bRefresh = sal_False;
     834             :             }
     835             :         }
     836             :     }
     837             : 
     838           0 :     if ( nRet & IconChoicePage::LEAVE_PAGE )
     839           0 :         return sal_True;
     840             :     else
     841           0 :         return sal_False;
     842             : }
     843             : 
     844             : 
     845             : 
     846           0 : void IconChoiceDialog::ResetPageImpl ()
     847             : {
     848           0 :     IconChoicePageData *pData = GetPageData ( mnCurrentPageId );
     849             : 
     850             :     DBG_ASSERT( pData, "Id nicht bekannt" );
     851             : 
     852           0 :     if ( pData->bOnDemand )
     853             :     {
     854             :         // CSet on AIS has problems here, therefore separated
     855           0 :         const SfxItemSet* _pSet = &pData->pPage->GetItemSet();
     856           0 :         pData->pPage->Reset( *(SfxItemSet*)_pSet );
     857             :     }
     858             :     else
     859           0 :         pData->pPage->Reset( *pSet );
     860           0 : }
     861             : 
     862             : /**********************************************************************
     863             : |
     864             : | handling itemsets
     865             : |
     866             : \**********************************************************************/
     867             : 
     868           0 : const sal_uInt16* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool )
     869             : {
     870           0 :     if ( pSet )
     871             :     {
     872             :         SAL_WARN( "cui.dialogs", "Set does already exist!" );
     873           0 :         return pSet->GetRanges();
     874             :     }
     875             : 
     876           0 :     if ( pRanges )
     877           0 :         return pRanges;
     878           0 :     std::vector<sal_uInt16> aUS;
     879             : 
     880           0 :     size_t nCount = maPageList.size();
     881           0 :     for ( size_t i = 0; i < nCount; ++i )
     882             :     {
     883           0 :         IconChoicePageData* pData = maPageList[ i ];
     884           0 :         if ( pData->fnGetRanges )
     885             :         {
     886           0 :             const sal_uInt16* pTmpRanges = (pData->fnGetRanges)();
     887           0 :             const sal_uInt16* pIter = pTmpRanges;
     888             : 
     889             :             sal_uInt16 nLen;
     890           0 :             for( nLen = 0; *pIter; ++nLen, ++pIter )
     891             :                 ;
     892           0 :             aUS.insert( aUS.end(), pTmpRanges, pTmpRanges + nLen );
     893             :         }
     894             :     }
     895             : 
     896             :     // remove double Id's
     897             :     {
     898           0 :         nCount = aUS.size();
     899           0 :         for ( size_t i = 0; i < nCount; ++i )
     900           0 :             aUS[i] = rPool.GetWhich( aUS[i] );
     901             :     }
     902             : 
     903           0 :     if ( aUS.size() > 1 )
     904             :     {
     905           0 :         std::sort( aUS.begin(), aUS.end() );
     906             :     }
     907             : 
     908           0 :     pRanges = new sal_uInt16[aUS.size() + 1];
     909           0 :     std::copy( aUS.begin(), aUS.end(), pRanges );
     910           0 :     pRanges[aUS.size()] = 0;
     911             : 
     912           0 :     return pRanges;
     913             : }
     914             : 
     915             : 
     916             : 
     917           0 : void IconChoiceDialog::SetInputSet( const SfxItemSet* pInSet )
     918             : {
     919           0 :     bool bSet = ( pSet != NULL );
     920             : 
     921           0 :     pSet = pInSet;
     922             : 
     923           0 :     if ( !bSet && !pExampleSet && !pOutSet )
     924             :     {
     925           0 :         pExampleSet = new SfxItemSet( *pSet );
     926           0 :         pOutSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
     927             :     }
     928           0 : }
     929             : 
     930             : 
     931             : 
     932           0 : void IconChoiceDialog::PageCreated( sal_uInt16 /*nId*/, IconChoicePage& /*rPage*/ )
     933             : {
     934             :     // not interested in
     935           0 : }
     936             : 
     937             : 
     938             : 
     939           0 : SfxItemSet* IconChoiceDialog::CreateInputItemSet( sal_uInt16 )
     940             : {
     941             :     SAL_INFO( "cui.dialogs", "CreateInputItemSet not implemented" );
     942             : 
     943           0 :     return 0;
     944             : }
     945             : 
     946             : /**********************************************************************
     947             : |
     948             : | start dialog
     949             : |
     950             : \**********************************************************************/
     951             : 
     952           0 : short IconChoiceDialog::Execute()
     953             : {
     954           0 :     if ( maPageList.empty() )
     955           0 :         return RET_CANCEL;
     956             : 
     957           0 :     Start_Impl();
     958             : 
     959           0 :     return Dialog::Execute();
     960             : }
     961             : 
     962             : 
     963             : 
     964           0 : void IconChoiceDialog::Start( sal_Bool bShow )
     965             : {
     966             : 
     967           0 :     aCancelBtn.SetClickHdl( LINK( this, IconChoiceDialog, CancelHdl ) );
     968           0 :     bModal = sal_False;
     969             : 
     970           0 :     Start_Impl();
     971             : 
     972           0 :     if ( bShow )
     973           0 :         Window::Show();
     974             : 
     975           0 : }
     976             : 
     977             : 
     978             : 
     979           0 : sal_Bool IconChoiceDialog::QueryClose()
     980             : {
     981           0 :     sal_Bool bRet = sal_True;
     982           0 :     for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i )
     983             :     {
     984           0 :         IconChoicePageData* pData = maPageList[i ];
     985           0 :         if ( pData->pPage && !pData->pPage->QueryClose() )
     986             :         {
     987           0 :             bRet = sal_False;
     988           0 :             break;
     989             :         }
     990             :     }
     991           0 :     return bRet;
     992             : }
     993             : 
     994             : 
     995             : 
     996           0 : void IconChoiceDialog::Start_Impl()
     997             : {
     998             :     sal_uInt16 nActPage;
     999             : 
    1000           0 :     if ( mnCurrentPageId == 0 || mnCurrentPageId == USHRT_MAX )
    1001           0 :         nActPage = maPageList.front()->nId;
    1002             :     else
    1003           0 :         nActPage = mnCurrentPageId;
    1004             : 
    1005             :     // configuration existing?
    1006           0 :     SvtViewOptions aTabDlgOpt( E_TABDIALOG, OUString::number(nResId) );
    1007             : 
    1008           0 :     if ( aTabDlgOpt.Exists() )
    1009             :     {
    1010             :         // possibly position from config
    1011           0 :         SetWindowState(OUStringToOString(aTabDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US));
    1012             : 
    1013             :         // initial TabPage from program/help/config
    1014           0 :         nActPage = (sal_uInt16)aTabDlgOpt.GetPageID();
    1015             : 
    1016           0 :         if ( USHRT_MAX != mnCurrentPageId )
    1017           0 :             nActPage = mnCurrentPageId;
    1018             : 
    1019           0 :         if ( GetPageData ( nActPage ) == NULL )
    1020           0 :             nActPage = maPageList.front()->nId;
    1021             :     }
    1022           0 :     else if ( USHRT_MAX != mnCurrentPageId && GetPageData ( mnCurrentPageId ) != NULL )
    1023           0 :         nActPage = mnCurrentPageId;
    1024             : 
    1025           0 :     mnCurrentPageId = nActPage;
    1026             : 
    1027           0 :     FocusOnIcon( mnCurrentPageId );
    1028             : 
    1029           0 :     ActivatePageImpl();
    1030           0 : }
    1031             : 
    1032             : 
    1033             : 
    1034           0 : const SfxItemSet* IconChoiceDialog::GetRefreshedSet()
    1035             : {
    1036             :     SAL_WARN( "cui.dialogs", "GetRefreshedSet not implemented" );
    1037           0 :     return 0;
    1038             : }
    1039             : 
    1040             : /**********************************************************************
    1041             : |
    1042             : | tool-methods
    1043             : |
    1044             : \**********************************************************************/
    1045             : 
    1046           0 : IconChoicePageData* IconChoiceDialog::GetPageData ( sal_uInt16 nId )
    1047             : {
    1048           0 :     IconChoicePageData *pRet = NULL;
    1049           0 :     for ( size_t i=0; i < maPageList.size(); i++ )
    1050             :     {
    1051           0 :         IconChoicePageData* pData = maPageList[ i ];
    1052           0 :         if ( pData->nId == nId )
    1053             :         {
    1054           0 :             pRet = pData;
    1055           0 :             break;
    1056             :         }
    1057             :     }
    1058           0 :     return pRet;
    1059             : }
    1060             : 
    1061             : /**********************************************************************
    1062             : |
    1063             : | OK-Status
    1064             : |
    1065             : \**********************************************************************/
    1066             : 
    1067           0 : sal_Bool IconChoiceDialog::OK_Impl()
    1068             : {
    1069           0 :     IconChoicePage* pPage = GetPageData ( mnCurrentPageId )->pPage;
    1070             : 
    1071           0 :     bool bEnd = !pPage;
    1072           0 :     if ( pPage )
    1073             :     {
    1074           0 :         int nRet = IconChoicePage::LEAVE_PAGE;
    1075           0 :         if ( pSet )
    1076             :         {
    1077           0 :             SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() );
    1078           0 :             sal_Bool bRet = sal_False;
    1079             : 
    1080           0 :             if ( pPage->HasExchangeSupport() )
    1081           0 :                 nRet = pPage->DeactivatePage( &aTmp );
    1082             : 
    1083           0 :             if ( ( IconChoicePage::LEAVE_PAGE & nRet ) == IconChoicePage::LEAVE_PAGE
    1084           0 :                  && aTmp.Count() )
    1085             :             {
    1086           0 :                 pExampleSet->Put( aTmp );
    1087           0 :                 pOutSet->Put( aTmp );
    1088             :             }
    1089           0 :             else if ( bRet )
    1090           0 :                 bModified |= sal_True;
    1091             :         }
    1092             :         else
    1093           0 :             nRet = pPage->DeactivatePage( NULL );
    1094           0 :         bEnd = nRet;
    1095             :     }
    1096             : 
    1097           0 :     return bEnd;
    1098             : }
    1099             : 
    1100             : 
    1101             : 
    1102           0 : short IconChoiceDialog::Ok()
    1103             : {
    1104           0 :     bInOK = sal_True;
    1105             : 
    1106           0 :     if ( !pOutSet )
    1107             :     {
    1108           0 :         if ( !pExampleSet && pSet )
    1109           0 :             pOutSet = pSet->Clone( false ); // without items
    1110           0 :         else if ( pExampleSet )
    1111           0 :             pOutSet = new SfxItemSet( *pExampleSet );
    1112             :     }
    1113           0 :     bool _bModified = false;
    1114             : 
    1115           0 :     for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i )
    1116             :     {
    1117           0 :         IconChoicePageData* pData = GetPageData ( i );
    1118             : 
    1119           0 :         IconChoicePage* pPage = pData->pPage;
    1120             : 
    1121           0 :         if ( pPage )
    1122             :         {
    1123           0 :             if ( pData->bOnDemand )
    1124             :             {
    1125           0 :                 SfxItemSet& rSet = (SfxItemSet&)pPage->GetItemSet();
    1126           0 :                 rSet.ClearItem();
    1127           0 :                 _bModified |= pPage->FillItemSet( rSet );
    1128             :             }
    1129           0 :             else if ( pSet && !pPage->HasExchangeSupport() )
    1130             :             {
    1131           0 :                 SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() );
    1132             : 
    1133           0 :                 if ( pPage->FillItemSet( aTmp ) )
    1134             :                 {
    1135           0 :                     _bModified |= true;
    1136           0 :                     pExampleSet->Put( aTmp );
    1137           0 :                     pOutSet->Put( aTmp );
    1138           0 :                 }
    1139             :             }
    1140             :         }
    1141             :     }
    1142             : 
    1143           0 :     if ( _bModified || ( pOutSet && pOutSet->Count() > 0 ) )
    1144           0 :         _bModified |= true;
    1145             : 
    1146           0 :     return _bModified ? RET_OK : RET_CANCEL;
    1147             : }
    1148             : 
    1149             : 
    1150             : 
    1151           0 : void IconChoiceDialog::FocusOnIcon( sal_uInt16 nId )
    1152             : {
    1153             :     // set focus to icon for the current visible page
    1154           0 :     for ( sal_uInt16 i=0; i<maIconCtrl.GetEntryCount(); i++)
    1155             :     {
    1156           0 :         SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i );
    1157           0 :         sal_uInt16* pUserData = (sal_uInt16*) pEntry->GetUserData();
    1158             : 
    1159           0 :         if ( pUserData && *pUserData == nId )
    1160             :         {
    1161           0 :             maIconCtrl.SetCursor( pEntry );
    1162           0 :             break;
    1163             :         }
    1164             :     }
    1165           0 : }
    1166             : 
    1167             : 
    1168             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10