Commits

Anonymous committed d289a06

#i115372# - context menu for places window (remove, rename, add current place). rename, removeincl. key bindings n.y.i.

  • Participants
  • Parent commits de41435

Comments (0)

Files changed (12)

File fpicker/source/office/OfficeFilePicker.src

     Text [ en-US ] = "~Open" ;
 };
 
-String STR_SVT_FILEPICKER_ADDTOPLACES
+String STR_SVT_FILEPICKER_ADD_TO_PLACES
 {
     Text [ en-US ] = "~Add to Places..." ;
 };
 
-String STR_SVT_ERRORCREATINGPLACE
+String STR_SVT_FILEPICKER_ADD_CURRENT_LOCATION
+{
+    Text [ en-US ] = "~Add Current Location..." ;
+};
+
+String STR_SVT_FILEPICKER_RENAME_PLACE
+{
+    Text [ en-US ] = "~Rename" ;
+};
+
+String STR_SVT_FILEPICKER_REMOVE_PLACE
+{
+    Text [ en-US ] = "Re~move" ;
+};
+
+String STR_SVT_ERROR_CREATING_PLACE
 {
     Text [ en-US ] = "Creating new place failed." ;
 };

File fpicker/source/office/iodlg.cxx

     if ( m_bHasPlaces )
     {
         _pPlacesWin->SetClickHdl( LINK( this, SvtFileDialog, PlacesIconClickHdl_Impl ) );
+        _pPlacesWin->SetContextMenuCreatedHdl(
+            LINK( this, SvtFileDialog, PlacesContextMenuCreatedHdl_Impl ) );
+        _pPlacesWin->SetContextMenuSelectedHdl(
+            LINK( this, SvtFileDialog, PlacesContextMenuSelectedHdl_Impl ) );
 
         aDlgSize.Width() += PLACES_DEFAULT_WIDTH;
         SetOutputSizePixel( aDlgSize );
 {
     if ( m_bHasPlaces )
     {
-        sal_uLong nPos = 0;
-        if ( _pPlacesWin->GetEntryPos( _pFileView->GetViewURL(), nPos ) )
-            _pPlacesWin->SetCursor( nPos, bShow );
+        if ( bShow )
+        {
+            sal_uLong nPos = 0;
+            if ( _pPlacesWin->GetEntryPos( _pFileView->GetViewURL(), nPos ) )
+                _pPlacesWin->SetCursor( nPos );
+        }
+        else
+        {
+            _pPlacesWin->ClearCursor();
+        }
     }
 }
 
             {
                 // Not a serious issue.
             }
-
         }
         OpenURL_Impl( aURL );
     }
 
 //*****************************************************************************
 
+IMPL_LINK( SvtFileDialog, PlacesContextMenuCreatedHdl_Impl, ContextMenuCreatedHdlParam*, pParam )
+{
+    // no duplicates.
+    //sal_uLong nPos = 0;
+    //if ( !_pPlacesWin->GetEntryPos( _pFileView->GetViewURL(), nPos ) )
+    {
+        PopupMenu* pMenu = pParam->pMenu;
+
+        if ( pMenu->GetItemCount() > 0 )
+            pMenu->InsertSeparator( 0 );
+
+        pMenu->InsertItem( STR_SVT_FILEPICKER_ADD_CURRENT_LOCATION,
+                           String( FpoResId( STR_SVT_FILEPICKER_ADD_CURRENT_LOCATION ) ),
+                           0,
+                           0 );
+    }
+    return 0;
+}
+
+//*****************************************************************************
+
+IMPL_LINK( SvtFileDialog, PlacesContextMenuSelectedHdl_Impl, sal_uInt16*, pItemId )
+{
+    switch ( *pItemId )
+    {
+    case STR_SVT_FILEPICKER_ADD_CURRENT_LOCATION:
+        AddPlace( _pFileView->GetViewURL() );
+        break;
+    }
+    return 0;
+}
+
+//*****************************************************************************
+
 IMPL_LINK( SvtFileDialog, FileviewContextMenuCreatedHdl_Impl, PopupMenu*, pMenu )
 {
+    SvLBoxEntry* pEntry = _pFileView->FirstSelected();
+    if ( !pEntry )
+        return 0; // context menu over free space requested
+
     if ( _pFileView->GetSelectionCount() == 1 )
     {
         // single selection : "Add to Places" : if folder selected
         //                    "Open"          : save dialog : if folder selected
         //                                    : open dialog : always
 
-        SvLBoxEntry* pEntry = _pFileView->FirstSelected();
         SvtContentEntry* pUserData
             = static_cast< SvtContentEntry * >( pEntry->GetUserData() );
         if ( pUserData->mbIsFolder )
         {
-            pMenu->InsertItem( STR_SVT_FILEPICKER_ADDTOPLACES,
-                               String( FpoResId( STR_SVT_FILEPICKER_ADDTOPLACES ) ),
+            pMenu->InsertItem( STR_SVT_FILEPICKER_ADD_TO_PLACES,
+                               String( FpoResId( STR_SVT_FILEPICKER_ADD_TO_PLACES ) ),
                                0,
                                0 );
         }
     {
         // multi selection : "Add to Places" : never
         //                   "Open"          : only if no folders selected
-        SvLBoxEntry* pEntry = _pFileView->FirstSelected();
         do
         {
             SvtContentEntry* pUserData
         OpenHdl_Impl( this, NULL );
         break;
 
-    case STR_SVT_FILEPICKER_ADDTOPLACES:
+    case STR_SVT_FILEPICKER_ADD_TO_PLACES:
         {
             SvLBoxEntry* pEntry = _pFileView->FirstSelected();
             SvtContentEntry* pUserData
                 = static_cast< SvtContentEntry * >( pEntry->GetUserData() );
-            INetURLObject aURL( pUserData->maURL );
-            String aSuggestedName(
-                aURL.getName( INetURLObject::LAST_SEGMENT,
-                              true,
-                              INetURLObject::DECODE_WITH_CHARSET,
-                              RTL_TEXTENCODING_UTF8 ) );
-
-            AddToPlacesDialog aDlg( this, aSuggestedName );
-            if ( aDlg.Execute() == RET_OK )
-            {
-                if ( !_pPlacesWin->AddPlace(
-                         aDlg.GetPlaceTitle(),
-                         pUserData->maURL,
-                         false /*bReadOnly*/,
-                         false /*bFolder*/,
-                         rtl::OUString() /* rIconURL */,
-                         pUserData->maURL /* rQuickHelpText */ ) )
-                {
-                    ErrorBox aError( this, WB_OK, FpoResId( STR_SVT_ERRORCREATINGPLACE ) );
-                    aError.Execute();
-                }
-            }
+            AddPlace( pUserData->maURL );
             break;
         }
     }
 
 //*****************************************************************************
 
+bool SvtFileDialog::AddPlace( const String& rURL )
+{
+    INetURLObject aURL( rURL );
+    String aSuggestedName( aURL.getName( INetURLObject::LAST_SEGMENT,
+                                         true,
+                                         INetURLObject::DECODE_WITH_CHARSET,
+                                         RTL_TEXTENCODING_UTF8 ) );
+
+    AddToPlacesDialog aDlg( this, aSuggestedName );
+    if ( aDlg.Execute() == RET_OK )
+    {
+        if ( !_pPlacesWin->AddPlace( aDlg.GetPlaceTitle(),
+                                     rURL,
+                                     false /*bReadOnly*/,
+                                     false /*bFolder*/,
+                                     rtl::OUString() /* rIconURL */,
+                                     rURL /* rQuickHelpText */ ) )
+        {
+            ErrorBox aError( this, WB_OK, FpoResId( STR_SVT_ERROR_CREATING_PLACE ) );
+            aError.Execute();
+            return false;
+        }
+        return true;
+    }
+    return false;
+}
+
+//*****************************************************************************
+
 long SvtFileDialog::Notify( NotifyEvent& rNEvt )
 
 /*  [Beschreibung]

File fpicker/source/office/iodlg.hxx

 // SvtFileDialog
 //*****************************************************************************
 
+struct ContextMenuCreatedHdlParam;
+
 class SvtExpFileDlg_Impl;
 class SvtFileDialog : public ModalDialog, public ::svt::IFilePickerController
 {
     DECL_LINK( FileviewContextMenuCreatedHdl_Impl, PopupMenu* );
     DECL_LINK( FileviewContextMenuSelectedHdl_Impl, sal_uInt16* );
 
+    DECL_LINK( PlacesContextMenuCreatedHdl_Impl, ContextMenuCreatedHdlParam* );
+    DECL_LINK( PlacesContextMenuSelectedHdl_Impl, sal_uInt16* );
+
     // entfernt einen Filter mit Wildcards aus dem Path und gibt in zurueck
     sal_Bool IsolateFilterFromPath_Impl( String& rPath, String& rFilter );
 
     void implChangeControlWidth( long nDeltaX );
 
     void UpdatePlacesSelection( bool bShow ) const;
+    bool AddPlace( const String& rURL );
 
 protected:
     virtual long Notify( NotifyEvent& rNEvt );
-    void EnableInternet( sal_Bool bInternet );
 
     Link   _aOKHdl;
     Link   _aFileSelectHdl;

File fpicker/source/office/placeswin.cxx

 
 namespace fpicker { namespace office {
 
+struct IconChoiceCtrlEntryUserData
+{
+    String aPlaceURL;
+    bool   bReadOnly;
+
+    IconChoiceCtrlEntryUserData( const String & _rPlaceURL,
+                                 bool _bReadOnly )
+        : aPlaceURL( _rPlaceURL ), bReadOnly( _bReadOnly ) {}
+};
+
 // class PlacesWindow ----------------------------------------------
 
 PlacesWindow::PlacesWindow( Window* pParent,
         const String aPlaceURL( aPathOpts.SubstituteVariable( *it1 ) );
 
         // Ignore duplicates.
-        if ( !getEntry( aPlaceURL ) )
+        // if ( !getEntry( aPlaceURL ) )
         {
             const INetURLObject aURLObj( aPlaceURL );
             const String aTitle(
 
             SvxIconChoiceCtrlEntry* pEntry =
                 m_aIconCtrl.InsertEntry( aTitle, aFolderImage, nInsertPos );
-            pEntry->SetUserData( new String ( aPlaceURL ) );
+            pEntry->SetUserData( new IconChoiceCtrlEntryUserData( aPlaceURL, true ) );
             pEntry->SetQuickHelpText( aQuickHelp );
             m_aIconCtrl.SetEntryTextMode( IcnShowTextFull, pEntry );
 
 
     m_aIconCtrl.CreateAutoMnemonics();
 
+    m_aIconCtrl.SetContextMenuCreatedHdl(
+        LINK( this, PlacesWindow, IconControlContextMenuCreatedHdl_Impl ) );
+    m_aIconCtrl.SetContextMenuSelectedHdl(
+        LINK( this, PlacesWindow, IconControlContextMenuSelectedHdl_Impl ) );
+
     initHeaderbar( rTitle );
 }
 
 PlacesWindow::~PlacesWindow()
 {
     for ( sal_uLong i = 0; i < m_aIconCtrl.GetEntryCount(); ++i )
-    {
-        SvxIconChoiceCtrlEntry* pEntry = m_aIconCtrl.GetEntry( i );
-        delete static_cast< String* >( pEntry->GetUserData() );
-    }
+        delete getEntryUserData( m_aIconCtrl.GetEntry( i ) );
+
     delete m_pHeaderBar;
 }
 
 {
     sal_uLong nPos = 0;
     SvxIconChoiceCtrlEntry* pEntry = m_aIconCtrl.GetSelectedEntry( nPos );
-    String aURL;
     if ( pEntry )
-        aURL = *static_cast< String* >( pEntry->GetUserData() );
-    return aURL;
+    {
+        IconChoiceCtrlEntryUserData* pData = getEntryUserData( pEntry );
+        return pData->aPlaceURL;
+    }
+    return String();
 }
 
 bool PlacesWindow::GetEntryPos( const String& rURL, sal_uLong& rPos ) const
     return m_aIconCtrl.GetEntryCount();
 }
 
-bool PlacesWindow::SetCursor( sal_uLong nPos, bool bSet )
+bool PlacesWindow::ClearCursor()
 {
-    SvxIconChoiceCtrlEntry* pEntry = bSet ? m_aIconCtrl.GetEntry( nPos ) : 0;
-    if ( !bSet || ( bSet && pEntry ) )
+    m_aIconCtrl.SetCursor( 0, sal_False );
+    return true;
+}
+
+bool PlacesWindow::SetCursor( sal_uLong nPos )
+{
+    SvxIconChoiceCtrlEntry* pEntry = m_aIconCtrl.GetEntry( nPos );
+    if ( pEntry )
     {
         m_aIconCtrl.SetCursor( pEntry, sal_False );
         return true;
     return false;
 }
 
+IMPL_LINK( PlacesWindow, IconControlContextMenuCreatedHdl_Impl, ContextMenuCreatedHdlParam*, pParam )
+{
+    SvxIconChoiceCtrlEntry* pEntry = m_aIconCtrl.GetEntry( pParam->aPos );
+
+    if ( pEntry )
+        fprintf( stderr, "created: entry: %s\n", rtl::OUStringToOString( pEntry->GetText(), RTL_TEXTENCODING_UTF8 ).getStr() );
+    else
+        fprintf( stderr, "created: no entry\n" );
+
+    if ( pEntry )
+    {
+        PopupMenu* pMenu = pParam->pMenu;
+        IconChoiceCtrlEntryUserData* pData = getEntryUserData( pEntry );
+        if ( !pData->bReadOnly )
+        {
+            pMenu->InsertItem(
+                STR_SVT_FILEPICKER_RENAME_PLACE,
+                String( FpoResId( STR_SVT_FILEPICKER_RENAME_PLACE ) ),
+                0,
+                0 );
+            pMenu->InsertItem(
+                STR_SVT_FILEPICKER_REMOVE_PLACE,
+                String( FpoResId( STR_SVT_FILEPICKER_REMOVE_PLACE ) ),
+                0,
+                0 );
+        }
+    }
+
+    if ( m_aContextMenuCreatedHdl.IsSet() )
+        m_aContextMenuCreatedHdl.Call( pParam );
+
+    return 0;
+}
+
+IMPL_LINK( PlacesWindow, IconControlContextMenuSelectedHdl_Impl, sal_uInt16*, pItemId )
+{
+    if ( m_aContextMenuSelectedHdl.IsSet() )
+        m_aContextMenuSelectedHdl.Call( pItemId );
+
+    sal_uLong nPos = 0;
+    SvxIconChoiceCtrlEntry* pEntry = m_aIconCtrl.GetSelectedEntry( nPos );
+    if ( pEntry )
+        fprintf( stderr, "%s\n", rtl::OUStringToOString( pEntry->GetText(), RTL_TEXTENCODING_UTF8 ).getStr() );
+
+    switch ( *pItemId )
+    {
+    case STR_SVT_FILEPICKER_RENAME_PLACE:
+        fprintf( stderr, "Rename\n" );
+        break;
+
+    case STR_SVT_FILEPICKER_REMOVE_PLACE:
+        fprintf( stderr, "Remove\n" );
+        break;
+    }
+    return 0;
+}
+
 void PlacesWindow::initHeaderbar( const String& rTitle )
 {
     m_pHeaderBar = new HeaderBar( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
     }
 
     // Ignore duplicates and forbidden URLs.
-    if ( !getEntry( aPlaceURL ) &&
+    if ( /*!getEntry( aPlaceURL ) &&*/
          !m_pUrlFilter || m_pUrlFilter->isUrlAllowed( aPlaceURL ) )
     {
         const String aTitle( rPlace.getTitle() );
             aImage = /*rPlace.isFolder() ?*/ rFolderImage /*: rLinkImage*/;
 
         // ReadOnly mode (optional)
-        //bool bReadOnly = rPlace.queryReadOnly();
+        bool bReadOnly = rPlace.queryReadOnly();
 
         SvxIconChoiceCtrlEntry* pEntry =
             m_aIconCtrl.InsertEntry( aTitle, aImage, nInsertPos );
-        pEntry->SetUserData( new String ( aPlaceURL ) );
+        pEntry->SetUserData(
+            new IconChoiceCtrlEntryUserData( aPlaceURL, bReadOnly ) );
         pEntry->SetQuickHelpText( aQuickHelp );
         m_aIconCtrl.SetEntryTextMode( IcnShowTextFull, pEntry );
 
     for ( sal_uLong i = 0; i < m_aIconCtrl.GetEntryCount(); ++i )
     {
         SvxIconChoiceCtrlEntry* pTemp = m_aIconCtrl.GetEntry( i );
-        String aCurrentURL( *static_cast< String* >( pTemp->GetUserData() ) );
+        IconChoiceCtrlEntryUserData* pData = getEntryUserData( pTemp );
+        String aCurrentURL( pData->aPlaceURL );
         nLength = aCurrentURL.Len();
         if ( nLength &&
              aCurrentURL.GetChar( nLength - 1 ) == sal_Unicode( '/' ) )

File fpicker/source/office/placeswin.hxx

 #ifndef _FPO_PLACESWIN_HXX
 #define _FPO_PLACESWIN_HXX
 
-#include <vcl/window.hxx>
-#include <svtools/ivctrl.hxx>
+#include "vcl/window.hxx"
+#include "svtools/ivctrl.hxx"
 
 class HeaderBar;
+class PopupMenu;
 class SvtPathOptions;
 
 namespace svt {
 namespace fpicker { namespace office {
 
 class Place;
+struct IconChoiceCtrlEntryUserData;
 
 class PlacesWindow : public Control
 {
 private:
-    SvtIconChoiceCtrl          m_aIconCtrl;
-    HeaderBar                  *m_pHeaderBar;
-    const svt::RestrictedPaths *m_pUrlFilter;
+    SvtIconChoiceCtrl           m_aIconCtrl;
+    HeaderBar*                  m_pHeaderBar;
+    const svt::RestrictedPaths* m_pUrlFilter;
+    Link                        m_aContextMenuCreatedHdl;
+    Link                        m_aContextMenuSelectedHdl;
+
+    DECL_LINK( IconControlContextMenuCreatedHdl_Impl, ContextMenuCreatedHdlParam* );
+    DECL_LINK( IconControlContextMenuSelectedHdl_Impl, sal_uInt16* );
 
     void          initHeaderbar( const String& rTitle );
     SvxIconChoiceCtrlEntry*
                                        const Size aSize,
                                        Image& rImage,
                                        bool bHiContrast );
+    static IconChoiceCtrlEntryUserData*
+                  getEntryUserData( SvxIconChoiceCtrlEntry* pEntry )
+    { return static_cast< IconChoiceCtrlEntryUserData* >( pEntry->GetUserData() ); }
 
 public:
     PlacesWindow( Window* pParent,
 
     virtual void Resize();
 
-    inline void  SetClickHdl( const Link& rLink ) { m_aIconCtrl.SetClickHdl( rLink ); }
+    void         SetClickHdl( const Link& rLink )
+    { m_aIconCtrl.SetClickHdl( rLink ); }
+    void         SetContextMenuCreatedHdl( const Link& rLink )
+    { m_aContextMenuCreatedHdl = rLink; }
+    void         SetContextMenuSelectedHdl( const Link& rLink )
+    { m_aContextMenuSelectedHdl = rLink; }
 
     String       GetSelectedIconURL() const;
 
     sal_uLong    GetEntryCount() const;
     bool         GetEntryPos( const String& rURL, sal_uLong& rPos ) const;
 
-    bool         SetCursor( sal_uLong nPos, bool bSet );
+    bool         SetCursor( sal_uLong nPos );
+    bool         ClearCursor();
 
     inline sal_Bool ProcessKeyEvent( const KeyEvent& rKEvt );
 

File officecfg/registry/data/org/openoffice/ucb/Places.xcu

           <prop oor:name="Type" oor:type="xs:int">
             <value>0</value>
           </prop>
+          <prop oor:name="ReadOnly" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
         </node>
 
         <node oor:name="File_System" oor:op="replace">
           <prop oor:name="Type" oor:type="xs:int">
             <value>0</value>
           </prop>
+          <prop oor:name="ReadOnly" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
         </node>
 
 <!--    <node oor:name="Desktop" oor:op="replace">
           <prop oor:name="Type" oor:type="xs:int">
             <value>0</value>
           </prop>
+          <prop oor:name="ReadOnly" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
         </node>
 -->
         <node oor:name="Templates" oor:op="replace">
           <prop oor:name="Type" oor:type="xs:int">
             <value>0</value>
           </prop>
+          <prop oor:name="ReadOnly" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
         </node>
 
         <node oor:name="Sample_Docs" oor:op="replace">
           <prop oor:name="Type" oor:type="xs:int">
             <value>0</value>
           </prop>
+          <prop oor:name="ReadOnly" oor:type="xs:boolean">
+            <value>true</value>
+          </prop>
         </node>
       </node>
     </node>

File officecfg/registry/schema/org/openoffice/ucb/Places.xcs

         </set>
     </component>
 </oor:component-schema>
-
-
-
-
-
-
-
-
-
-
-
-
-
-

File svtools/inc/svtools/ivctrl.hxx

 class SvxIconChoiceCtrl_Impl;
 class Image;
 
-#define ICNVIEW_FLAG_POS_LOCKED		0x0001
-#define ICNVIEW_FLAG_SELECTED		0x0002
-#define ICNVIEW_FLAG_FOCUSED		0x0004
-#define ICNVIEW_FLAG_IN_USE			0x0008
-#define ICNVIEW_FLAG_CURSORED	        0x0010 // Rahmen um Image
+#define ICNVIEW_FLAG_POS_LOCKED     0x0001
+#define ICNVIEW_FLAG_SELECTED       0x0002
+#define ICNVIEW_FLAG_FOCUSED        0x0004
+#define ICNVIEW_FLAG_IN_USE         0x0008
+#define ICNVIEW_FLAG_CURSORED       0x0010 // Rahmen um Image
 #define ICNVIEW_FLAG_POS_MOVED      0x0020 // per D&D verschoben aber nicht gelockt
-#define ICNVIEW_FLAG_DROP_TARGET	0x0040 // im QueryDrop gesetzt
-#define ICNVIEW_FLAG_BLOCK_EMPHASIS	0x0080 // Emphasis nicht painten
-#define ICNVIEW_FLAG_USER1			0x0100
-#define ICNVIEW_FLAG_USER2			0x0200
-#define ICNVIEW_FLAG_PRED_SET		0x0400 // Predecessor wurde umgesetzt
+#define ICNVIEW_FLAG_DROP_TARGET    0x0040 // im QueryDrop gesetzt
+#define ICNVIEW_FLAG_BLOCK_EMPHASIS 0x0080 // Emphasis nicht painten
+#define ICNVIEW_FLAG_USER1          0x0100
+#define ICNVIEW_FLAG_USER2          0x0200
+#define ICNVIEW_FLAG_PRED_SET       0x0400 // Predecessor wurde umgesetzt
 
 enum SvxIconChoiceCtrlTextMode
 {
-    IcnShowTextFull = 1,		// BoundRect nach unten aufplustern
-    IcnShowTextShort,               // Abkuerzung mit "..."
-    IcnShowTextSmart,			// Text komplett anzeigen, wenn moeglich (n.i.)
-    IcnShowTextDontKnow			// Einstellung der View
+    IcnShowTextFull = 1,        // BoundRect nach unten aufplustern
+    IcnShowTextShort,           // Abkuerzung mit "..."
+    IcnShowTextSmart,           // Text komplett anzeigen, wenn moeglich (n.i.)
+    IcnShowTextDontKnow         // Einstellung der View
 };
 
 enum SvxIconChoiceCtrlPositionMode
 {
-    IcnViewPositionModeFree = 0,			    // freies pixelgenaues Positionieren
+    IcnViewPositionModeFree = 0,                // freies pixelgenaues Positionieren
     IcnViewPositionModeAutoArrange = 1,         // automatisches Ausrichten
     IcnViewPositionModeAutoAdjust = 2,          // automatisches Anordnen
     IcnViewPositionModeLast = IcnViewPositionModeAutoAdjust
     friend class EntryList_Impl;
     friend class IcnGridMap_Impl;
 
-    Rectangle               aRect;				// Bounding-Rect des Entries
-    Rectangle               aGridRect;			// nur gesetzt im Grid-Modus
-    sal_uLong					nPos;
+    Rectangle               aRect;              // Bounding-Rect des Entries
+    Rectangle               aGridRect;          // nur gesetzt im Grid-Modus
+    sal_uLong               nPos;
 
     // die Eintragsposition in der Eintragsliste entspricht der beim Insert vorgegebenen
     // [Sortier-]Reihenfolge (->Reihenfolge der Anker in der Ankerliste!). Im AutoArrange-Modus
     // kann die sichtbare Reihenfolge aber anders sein. Die Eintraege werden deshalb dann
     // verkettet
-    SvxIconChoiceCtrlEntry*			pblink;		// backward (linker Nachbar)
-    SvxIconChoiceCtrlEntry*			pflink;     // forward  (rechter Nachbar)
+    SvxIconChoiceCtrlEntry*         pblink;     // backward (linker Nachbar)
+    SvxIconChoiceCtrlEntry*         pflink;     // forward  (rechter Nachbar)
 
     SvxIconChoiceCtrlTextMode       eTextMode;
-    sal_uInt16                      nX,nY;		// fuer Tastatursteuerung
-    sal_uInt16					nFlags;
+    sal_uInt16                      nX,nY;      // fuer Tastatursteuerung
+    sal_uInt16                      nFlags;
 
-    void					ClearFlags( sal_uInt16 nMask ) { nFlags &= (~nMask); }
-    void					SetFlags( sal_uInt16 nMask ) { nFlags |= nMask; }
-    void					AssignFlags( sal_uInt16 _nFlags ) { nFlags = _nFlags; }
+    void                    ClearFlags( sal_uInt16 nMask ) { nFlags &= (~nMask); }
+    void                    SetFlags( sal_uInt16 nMask ) { nFlags |= nMask; }
+    void                    AssignFlags( sal_uInt16 _nFlags ) { nFlags = _nFlags; }
 
     // setzt den linken Nachbarn (A <-> B  ==>  A <-> this <-> B)
-    void					SetBacklink( SvxIconChoiceCtrlEntry* pA )
+    void                    SetBacklink( SvxIconChoiceCtrlEntry* pA )
                             {
                                 pA->pflink->pblink = this;      // X <- B
                                 this->pflink = pA->pflink;          // X -> B
                                 pA->pflink = this;              // A -> X
                             }
     // loest eine Verbindung (A <-> this <-> B  ==>  A <-> B)
-    void					Unlink()
+    void                    Unlink()
                             {
                                 this->pblink->pflink = this->pflink;
                                 this->pflink->pblink = this->pblink;
                             SvxIconChoiceCtrlEntry( const String& rText, const Image& rImage, const Image& rImageHC, sal_uInt16 nFlags = 0 );
                             ~SvxIconChoiceCtrlEntry () {}
 
-    void					SetImage ( const Image& rImage ) { aImage = rImage; }
-    void					SetImageHC ( const Image& rImage ) { aImageHC = rImage; }
-    Image					GetImage () const { return aImage; }
-    Image					GetImageHC () const { return aImageHC; }
-    void					SetText ( const String& rText ) { aText = rText; }
-    String					GetText () const { return aText; }
-    String SVT_DLLPUBLIC                    GetDisplayText() const;
-    void					SetQuickHelpText( const String& rText ) { aQuickHelpText = rText; }
-    String					GetQuickHelpText() const { return aQuickHelpText; }
-    void					SetUserData ( void* _pUserData ) { pUserData = _pUserData; }
-    void*					GetUserData () { return pUserData; }
+    void                    SetImage ( const Image& rImage ) { aImage = rImage; }
+    void                    SetImageHC ( const Image& rImage ) { aImageHC = rImage; }
+    Image                   GetImage () const { return aImage; }
+    Image                   GetImageHC () const { return aImageHC; }
+    void                    SetText ( const String& rText ) { aText = rText; }
+    String                  GetText () const { return aText; }
+    String SVT_DLLPUBLIC    GetDisplayText() const;
+    void                    SetQuickHelpText( const String& rText ) { aQuickHelpText = rText; }
+    String                  GetQuickHelpText() const { return aQuickHelpText; }
+    void                    SetUserData ( void* _pUserData ) { pUserData = _pUserData; }
+    void*                   GetUserData () { return pUserData; }
 
     const Rectangle &       GetBoundRect() const { return aRect; }
 
-    void					SetFocus ( sal_Bool bSet )
+    void                    SetFocus ( sal_Bool bSet )
                                      { nFlags = ( bSet ? nFlags | ICNVIEW_FLAG_FOCUSED : nFlags & ~ICNVIEW_FLAG_FOCUSED ); }
 
-    SvxIconChoiceCtrlTextMode       GetTextMode() const { return eTextMode; }
-    sal_uInt16					GetFlags() const { return nFlags; }
-    sal_Bool					IsSelected() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_SELECTED) !=0); }
-    sal_Bool					IsFocused() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_FOCUSED) !=0); }
-    sal_Bool					IsInUse() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_IN_USE) !=0); }
-    sal_Bool					IsCursored() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_CURSORED) !=0); }
-    sal_Bool					IsDropTarget() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_DROP_TARGET) !=0); }
-    sal_Bool					IsBlockingEmphasis() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_BLOCK_EMPHASIS) !=0); }
-    sal_Bool					WasMoved() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_POS_MOVED) !=0); }
-    void					SetMoved( sal_Bool bMoved );
-    sal_Bool					IsPosLocked() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_POS_LOCKED) !=0); }
-    void					LockPos( sal_Bool bLock );
+    SvxIconChoiceCtrlTextMode   GetTextMode() const { return eTextMode; }
+    sal_uInt16                  GetFlags() const { return nFlags; }
+    sal_Bool                    IsSelected() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_SELECTED) !=0); }
+    sal_Bool                    IsFocused() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_FOCUSED) !=0); }
+    sal_Bool                    IsInUse() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_IN_USE) !=0); }
+    sal_Bool                    IsCursored() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_CURSORED) !=0); }
+    sal_Bool                    IsDropTarget() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_DROP_TARGET) !=0); }
+    sal_Bool                    IsBlockingEmphasis() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_BLOCK_EMPHASIS) !=0); }
+    sal_Bool                    WasMoved() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_POS_MOVED) !=0); }
+    void                        SetMoved( sal_Bool bMoved );
+    sal_Bool                    IsPosLocked() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_POS_LOCKED) !=0); }
+    void                        LockPos( sal_Bool bLock );
     // Nur bei AutoArrange gesetzt. Den Kopf der Liste gibts per SvxIconChoiceCtrl::GetPredecessorHead
-    SvxIconChoiceCtrlEntry*			GetSuccessor() const { return pflink; }
-    SvxIconChoiceCtrlEntry*			GetPredecessor() const { return pblink; }
-
-//	sal_Unicode				GetMnemonicChar() const;
+    SvxIconChoiceCtrlEntry*     GetSuccessor() const { return pflink; }
+    SvxIconChoiceCtrlEntry*     GetPredecessor() const { return pblink; }
 };
 
 enum SvxIconChoiceCtrlColumnAlign
 
 class SvxIconChoiceCtrlColumnInfo
 {
-    String					aColText;
-    Image					aColImage;
-    long					nWidth;
-    SvxIconChoiceCtrlColumnAlign	eAlignment;
-    sal_uInt16                      nSubItem;
+    String                       aColText;
+    Image                        aColImage;
+    long                         nWidth;
+    SvxIconChoiceCtrlColumnAlign eAlignment;
+    sal_uInt16                   nSubItem;
 
 public:
                             SvxIconChoiceCtrlColumnInfo( sal_uInt16 nSub, long nWd,
                                 nWidth( nWd ), eAlignment( eAlign ), nSubItem( nSub ) {}
                             SvxIconChoiceCtrlColumnInfo( const SvxIconChoiceCtrlColumnInfo& );
 
-    void					SetText( const String& rText ) { aColText = rText; }
-    void					SetImage( const Image& rImg ) { aColImage = rImg; }
-    void					SetWidth( long nWd ) { nWidth = nWd; }
-    void					SetAlignment( SvxIconChoiceCtrlColumnAlign eAlign ) { eAlignment = eAlign; }
-    void					SetSubItem( sal_uInt16 nSub) { nSubItem = nSub; }
+    void                    SetText( const String& rText ) { aColText = rText; }
+    void                    SetImage( const Image& rImg ) { aColImage = rImg; }
+    void                    SetWidth( long nWd ) { nWidth = nWd; }
+    void                    SetAlignment( SvxIconChoiceCtrlColumnAlign eAlign ) { eAlignment = eAlign; }
+    void                    SetSubItem( sal_uInt16 nSub) { nSubItem = nSub; }
 
     const String&           GetText() const { return aColText; }
-    const Image&			GetImage() const { return aColImage; }
-    long					GetWidth() const { return nWidth; }
-    SvxIconChoiceCtrlColumnAlign	GetAlignment() const { return eAlignment; }
-    sal_uInt16					GetSubItem() const { return nSubItem; }
+    const Image&            GetImage() const { return aColImage; }
+    long                    GetWidth() const { return nWidth; }
+    SvxIconChoiceCtrlColumnAlign GetAlignment() const { return eAlignment; }
+    sal_uInt16                   GetSubItem() const { return nSubItem; }
 };
 
 //###################################################################################################################################
 /*
     Window-Bits:
-        WB_ICON				// Text unter dem Icon
-        WB_SMALL_ICON		// Text rechts neben Icon, beliebige Positionierung
-        WB_DETAILS			// Text rechts neben Icon, eingeschraenkte Posit.
+        WB_ICON             // Text unter dem Icon
+        WB_SMALLICON        // Text rechts neben Icon, beliebige Positionierung
+        WB_DETAILS          // Text rechts neben Icon, eingeschraenkte Posit.
         WB_BORDER
-        WB_NOHIDESELECTION	// Selektion inaktiv zeichnen, wenn kein Fokus
+        WB_NOHIDESELECTION  // Selektion inaktiv zeichnen, wenn kein Fokus
         WB_NOHSCROLL
         WB_NOVSCROLL
         WB_NOSELECTION
         WB_SMART_ARRANGE    // im Arrange die Vis-Area beibehalten
-        WB_ALIGN_TOP		// Anordnung zeilenweise von links nach rechts
+        WB_ALIGN_TOP        // Anordnung zeilenweise von links nach rechts
         WB_ALIGN_LEFT       // Anordnung spaltenweise von oben nach unten
-        WB_NODRAGSELECTION	// Keine Selektion per Tracking-Rect
-        WB_NOCOLUMNHEADER	// keine Headerbar in Detailsview (Headerbar not implemented)
-        WB_NOPOINTERFOCUS	// Kein GrabFocus im MouseButtonDown
-        WB_HIGHLIGHTFRAME	// der unter der Maus befindliche Eintrag wird hervorgehoben
-        WB_NOASYNCSELECTHDL	// Selektionshandler synchron aufrufen, d.h. Events nicht sammeln
+        WB_NODRAGSELECTION  // Keine Selektion per Tracking-Rect
+        WB_NOCOLUMNHEADER   // keine Headerbar in Detailsview (Headerbar not implemented)
+        WB_NOPOINTERFOCUS   // Kein GrabFocus im MouseButtonDown
+        WB_HIGHLIGHTFRAME   // der unter der Maus befindliche Eintrag wird hervorgehoben
+        WB_NOASYNCSELECTHDL // Selektionshandler synchron aufrufen, d.h. Events nicht sammeln
 */
 
-#define WB_ICON					WB_RECTSTYLE
-#define WB_SMALLICON                WB_SMALLSTYLE
-#define WB_DETAILS				WB_VCENTER
-#define WB_NOHSCROLL			WB_SPIN
-#define WB_NOVSCROLL			WB_DRAG
-#define WB_NOSELECTION			WB_REPEAT
-#define WB_NODRAGSELECTION		WB_PATHELLIPSIS
-#define WB_SMART_ARRANGE		WB_PASSWORD
-#define WB_ALIGN_TOP			WB_TOP
-#define WB_ALIGN_LEFT			WB_LEFT
-#define WB_NOCOLUMNHEADER		WB_CENTER
-#define WB_HIGHLIGHTFRAME		WB_INFO
-#define WB_NOASYNCSELECTHDL		WB_NOLABEL
+#define WB_ICON                 WB_RECTSTYLE
+#define WB_SMALLICON            WB_SMALLSTYLE
+#define WB_DETAILS              WB_VCENTER
+#define WB_NOHSCROLL            WB_SPIN
+#define WB_NOVSCROLL            WB_DRAG
+#define WB_NOSELECTION          WB_REPEAT
+#define WB_NODRAGSELECTION      WB_PATHELLIPSIS
+#define WB_SMART_ARRANGE        WB_PASSWORD
+#define WB_ALIGN_TOP            WB_TOP
+#define WB_ALIGN_LEFT           WB_LEFT
+#define WB_NOCOLUMNHEADER       WB_CENTER
+#define WB_HIGHLIGHTFRAME       WB_INFO
+#define WB_NOASYNCSELECTHDL     WB_NOLABEL
 
 class MnemonicGenerator;
+class PopupMenu;
+
+struct ContextMenuCreatedHdlParam
+{
+    PopupMenu* pMenu;
+    Point      aPos;
+
+    ContextMenuCreatedHdlParam( PopupMenu* _pMenu, const Point & _rPos )
+        : pMenu( _pMenu ), aPos( _rPos ) {}
+};
 
 class SVT_DLLPUBLIC SvtIconChoiceCtrl : public Control
 {
     friend class SvxIconChoiceCtrl_Impl;
 
-    Link					_aClickIconHdl;
-    Link					_aDocRectChangedHdl;
-    Link					_aVisRectChangedHdl;
-    KeyEvent*				_pCurKeyEvent;
-    SvxIconChoiceCtrl_Impl*	_pImp;
-    sal_Bool					_bAutoFontColor;
+    Link                    _aClickIconHdl;
+    Link                    _aDocRectChangedHdl;
+    Link                    _aVisRectChangedHdl;
+    KeyEvent*               _pCurKeyEvent;
+    SvxIconChoiceCtrl_Impl* _pImp;
+    sal_Bool                _bAutoFontColor;
 
 protected:
 
     virtual void        KeyInput( const KeyEvent& rKEvt );
-    virtual sal_Bool		EditedEntry( SvxIconChoiceCtrlEntry*, const XubString& rNewText, sal_Bool bCancelled );
-    virtual void		DocumentRectChanged();
-    virtual void		VisibleRectChanged();
-    virtual sal_Bool		EditingEntry( SvxIconChoiceCtrlEntry* pEntry );
+    virtual sal_Bool    EditedEntry( SvxIconChoiceCtrlEntry*, const XubString& rNewText, sal_Bool bCancelled );
+    virtual void        DocumentRectChanged();
+    virtual void        VisibleRectChanged();
+    virtual sal_Bool    EditingEntry( SvxIconChoiceCtrlEntry* pEntry );
     virtual void        Command( const CommandEvent& rCEvt );
     virtual void        Paint( const Rectangle& rRect );
     virtual void        MouseButtonDown( const MouseEvent& rMEvt );
     virtual void        Resize();
     virtual void        GetFocus();
     virtual void        LoseFocus();
-    virtual void		ClickIcon();
+    virtual void        ClickIcon();
     virtual void        StateChanged( StateChangedType nType );
     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
-    virtual void		RequestHelp( const HelpEvent& rHEvt );
-    virtual void		DrawEntryImage(
+    virtual void        RequestHelp( const HelpEvent& rHEvt );
+    virtual void        DrawEntryImage(
                             SvxIconChoiceCtrlEntry* pEntry,
                             const Point& rPos,
                             OutputDevice& rDev );
 
-    virtual String		GetEntryText(
+    virtual String      GetEntryText(
                             SvxIconChoiceCtrlEntry* pEntry,
                             sal_Bool bInplaceEdit );
 
-    virtual void		FillLayoutData() const;
+    virtual void        FillLayoutData() const;
 
-    void				CallImplEventListeners(sal_uLong nEvent, void* pData);
+    void                CallImplEventListeners(sal_uLong nEvent, void* pData);
 
 public:
 
                         SvtIconChoiceCtrl( Window* pParent, const ResId& rResId );
     virtual             ~SvtIconChoiceCtrl();
 
-    void				SetStyle( WinBits nWinStyle );
-    WinBits				GetStyle() const;
+    void                SetStyle( WinBits nWinStyle );
+    WinBits             GetStyle() const;
 
-    sal_Bool				SetChoiceWithCursor ( sal_Bool bDo = sal_True );
+    sal_Bool            SetChoiceWithCursor ( sal_Bool bDo = sal_True );
 
 
     void                SetUpdateMode( sal_Bool bUpdateMode );
-    void				SetFont( const Font& rFont );
-    void				SetPointFont( const Font& rFont );
+    void                SetFont( const Font& rFont );
+    void                SetPointFont( const Font& rFont );
 
     void                SetClickHdl( const Link& rLink ) { _aClickIconHdl = rLink; }
     const Link&         GetClickHdl() const { return _aClickIconHdl; }
 
+    void                SetContextMenuCreatedHdl( const Link& rHdl );
+    void                SetContextMenuSelectedHdl( const Link& rHdl );
+
     using OutputDevice::SetBackground;
-    void				SetBackground( const Wallpaper& rWallpaper );
+    void                SetBackground( const Wallpaper& rWallpaper );
 
-    void				ArrangeIcons();
+    void                ArrangeIcons();
 
 
-    SvxIconChoiceCtrlEntry*	InsertEntry( sal_uLong nPos = LIST_APPEND,
+    SvxIconChoiceCtrlEntry*     InsertEntry( sal_uLong nPos = LIST_APPEND,
                                              const Point* pPos = 0,
                                              sal_uInt16 nFlags = 0 );
-    SvxIconChoiceCtrlEntry*	InsertEntry( const String& rText, const Image& rImage,
+    SvxIconChoiceCtrlEntry*     InsertEntry( const String& rText, const Image& rImage,
                                              sal_uLong nPos = LIST_APPEND,
                                              const Point* pPos = 0,
                                              sal_uInt16 nFlags = 0 );
-    SvxIconChoiceCtrlEntry*	InsertEntry( const String& rText, const Image& rImage, const Image& rImageHC,
+    SvxIconChoiceCtrlEntry*     InsertEntry( const String& rText, const Image& rImage, const Image& rImageHC,
                                              sal_uLong nPos = LIST_APPEND,
                                              const Point* pPos = 0,
                                              sal_uInt16 nFlags = 0 );
 
     /** creates automatic mnemonics for all icon texts in the control
     */
-    void				CreateAutoMnemonics( void );
+    void                CreateAutoMnemonics( void );
 
     /** creates automatic mnemonics for all icon texts in the control
 
         This can be used if the control needs to share the "mnemonic space" with other elements,
         such as a menu bar.
     */
-    void				CreateAutoMnemonics( MnemonicGenerator& _rUsedMnemonics );
+    void                CreateAutoMnemonics( MnemonicGenerator& _rUsedMnemonics );
 
-    void				RemoveEntry( SvxIconChoiceCtrlEntry* pEntry );
+    void                RemoveEntry( SvxIconChoiceCtrlEntry* pEntry );
 
-    sal_Bool				DoKeyInput( const KeyEvent& rKEvt );
+    sal_Bool            DoKeyInput( const KeyEvent& rKEvt );
 
-    sal_Bool				IsEntryEditing() const;
-    void				Clear();
+    sal_Bool            IsEntryEditing() const;
+    void                Clear();
 
-    sal_uLong					GetEntryCount() const;
-    SvxIconChoiceCtrlEntry*	GetEntry( sal_uLong nPos ) const;
-    sal_uLong					GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const;
+    sal_uLong                   GetEntryCount() const;
+    SvxIconChoiceCtrlEntry*     GetEntry( sal_uLong nPos ) const;
+    sal_uLong                   GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const;
     using Window::SetCursor;
-    void					    SetCursor( SvxIconChoiceCtrlEntry* pEntry );
+    void                        SetCursor( SvxIconChoiceCtrlEntry* pEntry );
     void                        SetCursor( SvxIconChoiceCtrlEntry* pEntry,
                                            sal_Bool bCallHdl );
-    SvxIconChoiceCtrlEntry*	GetCursor() const;
+    SvxIconChoiceCtrlEntry*     GetCursor() const;
 
     // Neu-Berechnung gecachter View-Daten und Invalidierung im Fenster
-    void					InvalidateEntry( SvxIconChoiceCtrlEntry* pEntry );
+    void                        InvalidateEntry( SvxIconChoiceCtrlEntry* pEntry );
 
     // bHit==sal_False: Eintrag gilt als getroffen, wenn Position im BoundRect liegt
     //     ==sal_True : Bitmap oder Text muss getroffen sein
-    SvxIconChoiceCtrlEntry*	GetEntry( const Point& rPosPixel, sal_Bool bHit = sal_False ) const;
+    SvxIconChoiceCtrlEntry*     GetEntry( const Point& rPosPixel, sal_Bool bHit = sal_False ) const;
     // Gibt den naechsten ueber pCurEntry liegenden Eintrag (ZOrder)
-    SvxIconChoiceCtrlEntry*	GetNextEntry( const Point& rPosPixel, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool  ) const;
+    SvxIconChoiceCtrlEntry*     GetNextEntry( const Point& rPosPixel, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool  ) const;
     // Gibt den naechsten unter pCurEntry liegenden Eintrag (ZOrder)
-    SvxIconChoiceCtrlEntry*	GetPrevEntry( const Point& rPosPixel, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool  ) const;
+    SvxIconChoiceCtrlEntry*     GetPrevEntry( const Point& rPosPixel, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool  ) const;
 
     // in dem sal_uLong wird die Position in der Liste des gefunden Eintrags zurueckgegeben
-    SvxIconChoiceCtrlEntry*	GetSelectedEntry( sal_uLong& rPos ) const;
+    SvxIconChoiceCtrlEntry*     GetSelectedEntry( sal_uLong& rPos ) const;
 
-    void						SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry = 0 );
-    SvxIconChoiceCtrlTextMode	GetEntryTextMode( const SvxIconChoiceCtrlEntry* pEntry = 0 ) const;
+    void                        SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry = 0 );
+    SvxIconChoiceCtrlTextMode   GetEntryTextMode( const SvxIconChoiceCtrlEntry* pEntry = 0 ) const;
 
     // offene asynchron abzuarbeitende Aktionen ausfuehren. Muss vor dem Speichern von
     // Eintragspositionen etc. gerufen werden
-    void				Flush();
+    void                    Flush();
 
 
-    virtual sal_Bool		HasBackground() const;
-    virtual sal_Bool		HasFont() const;
-    virtual sal_Bool		HasFontTextColor() const;
-    virtual sal_Bool		HasFontFillColor() const;
+    virtual sal_Bool        HasBackground() const;
+    virtual sal_Bool        HasFont() const;
+    virtual sal_Bool        HasFontTextColor() const;
+    virtual sal_Bool        HasFontFillColor() const;
 
-    void				SetFontColorToBackground ( sal_Bool bDo = sal_True ) { _bAutoFontColor = bDo; }
-    sal_Bool				AutoFontColor () { return _bAutoFontColor; }
+    void                    SetFontColorToBackground ( sal_Bool bDo = sal_True ) { _bAutoFontColor = bDo; }
+    sal_Bool                AutoFontColor () { return _bAutoFontColor; }
 
-    Point				GetLogicPos( const Point& rPosPixel ) const;
-    Point		            GetPixelPos( const Point& rPosLogic ) const;
-    void				SetSelectionMode( SelectionMode eMode );
+    Point                   GetLogicPos( const Point& rPosPixel ) const;
+    Point                   GetPixelPos( const Point& rPosLogic ) const;
+    void                    SetSelectionMode( SelectionMode eMode );
 
-    sal_Bool				HandleShortCutKey( const KeyEvent& rKeyEvent );
+    sal_Bool                HandleShortCutKey( const KeyEvent& rKeyEvent );
 
-    Rectangle			GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const;
-    Rectangle			GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const;
+    Rectangle               GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const;
+    Rectangle               GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const;
 
-    void				SetNoSelection();
+    void                    SetNoSelection();
 
     // ACCESSIBILITY ==========================================================
 
 };
 
 #endif // _ICNVW_HXX
-

File svtools/inc/svtools/svtools.hrc

 #include <svl/solar.hrc>
 
 #define RID_SVTOOLS_BITMAP_START		(RID_SVTOOLS_START + 0)
-#define RID_SVTOOLS_IMAGELIST_START		(RID_SVTOOLS_START + 0)
+#define RID_SVTOOLS_IMAGELIST_START	(RID_SVTOOLS_START + 0)
 
 #define ABOUT_STR_COPYRIGHT             (RID_SVTOOLS_START + 1)
 #define ABOUT_STR_DEVELOPER_ARY         (RID_SVTOOLS_START + 2)
 #define STR_SVT_NOREMOVABLEDEVICE       (RID_SVTOOLS_START + 36)
 
 // doc template dialog
-#define DLG_DOCTEMPLATE					(RID_SVTOOLS_START+50)
+#define DLG_DOCTEMPLATE				(RID_SVTOOLS_START+50)
 #define CTRL_FILEVIEW					(RID_SVTOOLS_START+51)
 #define STR_SVT_NEWDOC					(RID_SVTOOLS_START+52)
 #define STR_SVT_MYDOCS					(RID_SVTOOLS_START+53)
 #define STR_SVT_TEMPLATES				(RID_SVTOOLS_START+54)
-#define STR_SVT_SAMPLES					(RID_SVTOOLS_START+55)
-#define TB_SVT_FILEVIEW					(RID_SVTOOLS_START+56)
-#define TB_SVT_FRAMEWIN					(RID_SVTOOLS_START+57)
+#define STR_SVT_SAMPLES				(RID_SVTOOLS_START+55)
+#define TB_SVT_FILEVIEW				(RID_SVTOOLS_START+56)
+#define TB_SVT_FRAMEWIN				(RID_SVTOOLS_START+57)
 #define STRARY_SVT_DOCINFO				(RID_SVTOOLS_START+58)
-#define STR_SVT_NEWDOC_HELP				(RID_SVTOOLS_START+63)
-#define STR_SVT_MYDOCS_HELP				(RID_SVTOOLS_START+64)
+#define STR_SVT_NEWDOC_HELP			(RID_SVTOOLS_START+63)
+#define STR_SVT_MYDOCS_HELP			(RID_SVTOOLS_START+64)
 #define STR_SVT_TEMPLATES_HELP			(RID_SVTOOLS_START+65)
 #define STR_SVT_SAMPLES_HELP			(RID_SVTOOLS_START+66)
 
 
 #define STR_WIZARDDIALOG_START				(STR_SVT_ERRORCONTEXT_END + 1)
 #define STR_WIZDLG_FINISH					(STR_WIZARDDIALOG_START + 0)
-#define STR_WIZDLG_NEXT						(STR_WIZARDDIALOG_START + 1)
-#define STR_WIZDLG_PREVIOUS					(STR_WIZARDDIALOG_START + 2)
+#define STR_WIZDLG_NEXT					(STR_WIZARDDIALOG_START + 1)
+#define STR_WIZDLG_PREVIOUS				(STR_WIZARDDIALOG_START + 2)
 #define STR_WIZDLG_ROADMAP_TITLE            (STR_WIZARDDIALOG_START + 3)
 #define STR_WIZARDDIALOG_END				(STR_WIZDLG_ROADMAP_TITLE)
 
 #define STR_SVT_COLLATE_DICTIONARY			(STR_SVT_COLLATE_START+1)
 #define STR_SVT_COLLATE_PINYIN				(STR_SVT_COLLATE_START+2)
 #define STR_SVT_COLLATE_STROKE				(STR_SVT_COLLATE_START+3)
-#define STR_SVT_COLLATE_RADICAL				(STR_SVT_COLLATE_START+4)
-#define STR_SVT_COLLATE_CHARSET				(STR_SVT_COLLATE_START+5)
+#define STR_SVT_COLLATE_RADICAL			(STR_SVT_COLLATE_START+4)
+#define STR_SVT_COLLATE_CHARSET			(STR_SVT_COLLATE_START+5)
 #define STR_SVT_COLLATE_ZHUYIN				(STR_SVT_COLLATE_START+6)
 #define STR_SVT_COLLATE_ALPHANUMERIC        (STR_SVT_COLLATE_START+7)
-#define STR_SVT_COLLATE_UNICODE				(STR_SVT_COLLATE_START+8)
+#define STR_SVT_COLLATE_UNICODE			(STR_SVT_COLLATE_START+8)
 #define STR_SVT_COLLATE_PHONEBOOK			(STR_SVT_COLLATE_START+9)
 #define STR_SVT_COLLATE_PHONETIC_F			(STR_SVT_COLLATE_START+10)
 #define STR_SVT_COLLATE_PHONETIC_L			(STR_SVT_COLLATE_START+11)
 #define STR_SVT_FILEPICKER_PLACES                   (STR_SVT_FILEPICKER_START+12)
 #define STR_SVT_FILEPICKER_WORKPLACE                (STR_SVT_FILEPICKER_START+13)
 #define STR_SVT_FILEPICKER_OPEN                     (STR_SVT_FILEPICKER_START+14)
-#define STR_SVT_FILEPICKER_ADDTOPLACES              (STR_SVT_FILEPICKER_START+15)
-#define STR_SVT_ERRORCREATINGPLACE                  (STR_SVT_FILEPICKER_START+16)
-#define STR_SVT_FOLDERPICKER_DEFAULT_TITLE          (STR_SVT_FILEPICKER_START+17)
-#define STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION    (STR_SVT_FILEPICKER_START+18)
+#define STR_SVT_FILEPICKER_ADD_TO_PLACES            (STR_SVT_FILEPICKER_START+15)
+#define STR_SVT_FILEPICKER_ADD_CURRENT_LOCATION     (STR_SVT_FILEPICKER_START+16)
+#define STR_SVT_FILEPICKER_RENAME_PLACE             (STR_SVT_FILEPICKER_START+17)
+#define STR_SVT_FILEPICKER_REMOVE_PLACE             (STR_SVT_FILEPICKER_START+18)
+#define STR_SVT_ERROR_CREATING_PLACE                (STR_SVT_FILEPICKER_START+19)
+#define STR_SVT_FOLDERPICKER_DEFAULT_TITLE          (STR_SVT_FILEPICKER_START+20)
+#define STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION    (STR_SVT_FILEPICKER_START+21)
 #define STR_SVT_FILEPICKER_END                      (STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION)
 
 // String-Ids for accessibility
 #define STR_SVT_ACC_BEGIN					(STR_SVT_FILEPICKER_END+1)
 #define STR_SVT_TOOL_PANEL_BUTTON_FWD       (STR_SVT_ACC_BEGIN+0)
 #define STR_SVT_TOOL_PANEL_BUTTON_BACK      (STR_SVT_ACC_BEGIN+1)
-#define STR_SVT_ACC_DESC_TABLISTBOX			(STR_SVT_ACC_BEGIN+2)
+#define STR_SVT_ACC_DESC_TABLISTBOX		(STR_SVT_ACC_BEGIN+2)
 #define STR_SVT_ACC_DESC_FILEVIEW			(STR_SVT_ACC_BEGIN+3)
-#define STR_SVT_ACC_DESC_FOLDER				(STR_SVT_ACC_BEGIN+4)
+#define STR_SVT_ACC_DESC_FOLDER			(STR_SVT_ACC_BEGIN+4)
 #define STR_SVT_ACC_DESC_FILE				(STR_SVT_ACC_BEGIN+5)
-#define STR_SVT_ACC_EMPTY_FIELD				(STR_SVT_ACC_BEGIN+6)
+#define STR_SVT_ACC_EMPTY_FIELD			(STR_SVT_ACC_BEGIN+6)
 //IAccessible2 implementation
-#define STR_SVT_ACC_LISTENTRY_SELCTED_STATE		(STR_SVT_ACC_BEGIN+7)
-#define STR_SVT_ACC_RULER_VERT_NAME	(STR_SVT_ACC_BEGIN+8)
-#define STR_SVT_ACC_RULER_HORZ_NAME	(STR_SVT_ACC_BEGIN+9)
+#define STR_SVT_ACC_LISTENTRY_SELCTED_STATE	(STR_SVT_ACC_BEGIN+7)
+#define STR_SVT_ACC_RULER_VERT_NAME             (STR_SVT_ACC_BEGIN+8)
+#define STR_SVT_ACC_RULER_HORZ_NAME             (STR_SVT_ACC_BEGIN+9)
 #define STR_SVT_ACC_END						(STR_SVT_ACC_EMPTY_FIELD)
 
 #define STR_SVT_INDEXENTRY_START			(STR_SVT_ACC_END + 1)
-#define STR_SVT_INDEXENTRY_ALPHANUMERIC		(STR_SVT_INDEXENTRY_START+0)
+#define STR_SVT_INDEXENTRY_ALPHANUMERIC	(STR_SVT_INDEXENTRY_START+0)
 #define STR_SVT_INDEXENTRY_DICTIONARY		(STR_SVT_INDEXENTRY_START+1)
 #define STR_SVT_INDEXENTRY_PINYIN			(STR_SVT_INDEXENTRY_START+2)
 #define STR_SVT_INDEXENTRY_RADICAL			(STR_SVT_INDEXENTRY_START+3)
 //remain the same.
 #define STR_SVT_JAVAERROR_START             (STR_SVT_INDEXENTRY_END + 1)
 #define STR_QUESTION_JAVADISABLED			(STR_SVT_JAVAERROR_START+0)
-#define STR_ERROR_JVMCREATIONFAILED             (STR_SVT_JAVAERROR_START+1)
+#define STR_ERROR_JVMCREATIONFAILED         (STR_SVT_JAVAERROR_START+1)
 #define STR_WARNING_JAVANOTFOUND            (STR_SVT_JAVAERROR_START+2)
 #define STR_WARNING_INVALIDJAVASETTINGS     (STR_SVT_JAVAERROR_START+3)
 #define STR_ERROR_RESTARTREQUIRED           (STR_SVT_JAVAERROR_START+4)
 //.............................................................................
 // bitmaps
 
-#define BMP_DEMO_FINGER                 (RID_SVTOOLS_BITMAP_START +   0)
 #define BMP_HELP_AGENT_IMAGE			(RID_SVTOOLS_BITMAP_START +   1)
 #define BMP_HELP_AGENT_CLOSER			(RID_SVTOOLS_BITMAP_START +   2)
 #define BMP_PLUGIN                      (RID_SVTOOLS_BITMAP_START +   3)
 #define RID_IMG_EXPANDER							(RID_SVTOOLS_IMAGELIST_START +  0)
 #define RID_SVTOOLS_IMAGELIST_BIG                   (RID_SVTOOLS_IMAGELIST_START +  1)
 #define RID_SVTOOLS_IMAGELIST_SMALL                 (RID_SVTOOLS_IMAGELIST_START +  2)
-#define RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX			(RID_SVTOOLS_IMAGELIST_START +  3)
+#define RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX		(RID_SVTOOLS_IMAGELIST_START +  3)
 #define RID_SVTOOLS_IMAGELIST_BIG_HIGHCONTRAST		(RID_SVTOOLS_IMAGELIST_START +  4)
 #define RID_SVTOOLS_IMAGELIST_SMALL_HIGHCONTRAST	(RID_SVTOOLS_IMAGELIST_START +  5)
-#define RID_SVTOOLS_IMAGELIST_EDITBWSEBOX_H			(RID_SVTOOLS_IMAGELIST_START +  6)
+#define RID_SVTOOLS_IMAGELIST_EDITBWSEBOX_H		(RID_SVTOOLS_IMAGELIST_START +  6)
 #define RID_FILEPICKER_IMAGES						(RID_SVTOOLS_IMAGELIST_START +  7)
 #define RID_FILEPICKER_IMAGES_HC					(RID_SVTOOLS_IMAGELIST_START +  8)
 
 //.............................................................................
 // error boxes
-#define ERRBOX_REG_NOSYSBROWSER				( RID_SVTOOLS_START +  0 )
+#define ERRBOX_REG_NOSYSBROWSER			( RID_SVTOOLS_START +  0 )
 #define ERRBOX_CHECK_PLZ					( RID_SVTOOLS_START + 11 )
 
 // Java message boxes
 #define RID_IMG_PRINTERFONT             (RID_SVTOOLS_START + 12)
 #define RID_IMG_BITMAPFONT				(RID_SVTOOLS_START + 13)
 #define RID_IMG_SCALABLEFONT			(RID_SVTOOLS_START + 14)
-#define RID_IMG_PRINTERFONT_HC              (RID_SVTOOLS_START + 15)
+#define RID_IMG_PRINTERFONT_HC          (RID_SVTOOLS_START + 15)
 #define RID_IMG_BITMAPFONT_HC			(RID_SVTOOLS_START + 16)
-#define RID_IMG_SCALABLEFONT_HC			(RID_SVTOOLS_START + 17)
+#define RID_IMG_SCALABLEFONT_HC		(RID_SVTOOLS_START + 17)
 
 #define IMG_TRIANGLE_RIGHT              (RID_SVTOOLS_START + 18)
 #define IMG_TRIANGLE_RIGHT_HC           (RID_SVTOOLS_START + 19)
 #define IMG_SVT_NEWDOC					(RID_SVTOOLS_START + 52)
 #define IMG_SVT_MYDOCS					(RID_SVTOOLS_START + 53)
 #define IMG_SVT_TEMPLATES				(RID_SVTOOLS_START + 54)
-#define IMG_SVT_SAMPLES					(RID_SVTOOLS_START + 55)
+#define IMG_SVT_SAMPLES				(RID_SVTOOLS_START + 55)
 
 #define IMG_SVT_NEWDOC_HC				(RID_SVTOOLS_START + 59)
 #define IMG_SVT_MYDOCS_HC				(RID_SVTOOLS_START + 60)
 #define	IMG_SVT_DOCTEMPLATE_BACK_LARGE		(RID_SVTOOLS_START + 71)
 #define	IMG_SVT_DOCTEMPLATE_PREV_SMALL		(RID_SVTOOLS_START + 72)
 #define	IMG_SVT_DOCTEMPLATE_PREV_LARGE		(RID_SVTOOLS_START + 73)
-#define	IMG_SVT_DOCTEMPLATE_PRINT_SMALL		(RID_SVTOOLS_START + 74)
-#define	IMG_SVT_DOCTEMPLATE_PRINT_LARGE		(RID_SVTOOLS_START + 75)
+#define	IMG_SVT_DOCTEMPLATE_PRINT_SMALL	(RID_SVTOOLS_START + 74)
+#define	IMG_SVT_DOCTEMPLATE_PRINT_LARGE	(RID_SVTOOLS_START + 75)
 #define	IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL	(RID_SVTOOLS_START + 76)
 #define	IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE	(RID_SVTOOLS_START + 77)
 #define	IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL	(RID_SVTOOLS_START + 78)
 #define	IMG_SVT_DOCTEMPL_HC_BACK_LARGE		(RID_SVTOOLS_START + 81)
 #define	IMG_SVT_DOCTEMPL_HC_PREV_SMALL		(RID_SVTOOLS_START + 82)
 #define	IMG_SVT_DOCTEMPL_HC_PREV_LARGE		(RID_SVTOOLS_START + 83)
-#define	IMG_SVT_DOCTEMPL_HC_PRINT_SMALL		(RID_SVTOOLS_START + 84)
-#define	IMG_SVT_DOCTEMPL_HC_PRINT_LARGE		(RID_SVTOOLS_START + 85)
+#define	IMG_SVT_DOCTEMPL_HC_PRINT_SMALL	(RID_SVTOOLS_START + 84)
+#define	IMG_SVT_DOCTEMPL_HC_PRINT_LARGE	(RID_SVTOOLS_START + 85)
 #define	IMG_SVT_DOCTEMPL_HC_DOCINFO_SMALL	(RID_SVTOOLS_START + 86)
 #define	IMG_SVT_DOCTEMPL_HC_DOCINFO_LARGE	(RID_SVTOOLS_START + 87)
 #define	IMG_SVT_DOCTEMPL_HC_PREVIEW_SMALL	(RID_SVTOOLS_START + 88)
 #define RID_IMG_PRNDLG_NOCOLLATE_HC         (STR_SVT_PRNDLG_START + 32)
 
 // IAccessible2 implementation in 2009
-#define STR_PARAGRAPH_START					(STR_SVT_PRNDLG_START + 50)
+#define STR_PARAGRAPH_START				(STR_SVT_PRNDLG_START + 50)
 #define STR_PARAGRAPH						(STR_PARAGRAPH_START + 0)
 #define STR_PARAGRAPH_END					(STR_PARAGRAPH)
 
-#endif	// #ifndef _SVTOOLS_HRC
+#endif // #ifndef _SVTOOLS_HRC
 
 // ******************************************************************* EOF

File svtools/source/contnr/imivctl.hxx

     sal_Bool                      bEntryEditingEnabled;
     sal_Bool                      bInDragDrop;
 
+    Link                          _aContextMenuCreatedHdl;
+    Link                          _aContextMenuSelectedHdl;
+
     void            ShowCursor( sal_Bool bShow );
 
     void            ImpArrange( sal_Bool bKeepPredecessors = sal_False );
     long            GetScrollBarPageSize( long nVisibleRange ) const { return ((nVisibleRange*75)/100); }
     long            GetScrollBarLineSize() const { return nMaxBoundHeight / 2; }
     sal_Bool        HandleScrollCommand( const CommandEvent& rCmd );
+    void            HandleContextMenuCommand( const CommandEvent& rCmd );
     void            ToDocPos( Point& rPosPixel ) { rPosPixel -= pView->GetMapMode().GetOrigin(); }
     void            InitScrollBarBox();
     SvxIconChoiceCtrlEntry* FindNewCursor();
                     SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle );
                     ~SvxIconChoiceCtrl_Impl();
 
+    void            SetContextMenuCreatedHdl( const Link& rHdl ) { _aContextMenuCreatedHdl = rHdl; }
+    void            SetContextMenuSelectedHdl( const Link& rHdl ) { _aContextMenuSelectedHdl = rHdl; }
+
     sal_Bool        SetChoiceWithCursor ( sal_Bool bDo = sal_True ) { sal_Bool bOld=bChooseWithCursor; bChooseWithCursor = bDo; return bOld; }
     void            Clear( sal_Bool bInCtor = sal_False );
     void            SetStyle( WinBits nWinStyle );
     void            OutputSizeChanged();
 };
 
-
-
-
-
 #endif
-
-

File svtools/source/contnr/imivctl1.cxx

         if( bDeselectAll )
             DeselectAllBut( pFilterEntry, bPaintSync, sal_True );
         ShowCursor( sal_False );
-        MakeEntryVisible( pNewCursor );
+        MakeEntryVisible( pNewCursor, sal_False );
         SetCursor( pNewCursor, sal_True, sal_False, sal_True );
         if( bMod1 && !bShift )
         {
         case KEY_PAGEUP:
             if( pCursor )
             {
-                MakeEntryVisible( pCursor );
+                MakeEntryVisible( pCursor, sal_False );
                 if( nCode == KEY_UP )
                     pNewCursor = pImpCursor->GoUpDown(pCursor,sal_False);
                 else
                         MakeVisible( aRect );
                     }
                 }
-
                 if ( bChooseWithCursor && pNewCursor != NULL )
                 {
                     pHdlEntry = pNewCursor;//GetCurEntry();
         case KEY_LEFT:
             if( pCursor )
             {
-                MakeEntryVisible( pCursor );
+                MakeEntryVisible( pCursor, sal_False );
                 pNewCursor = pImpCursor->GoLeftRight(pCursor,sal_False );
                 SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift, sal_True );
                 if( !pNewCursor )
 
 void SvxIconChoiceCtrl_Impl::Command( const CommandEvent& rCEvt )
 {
-    // Rollmaus-Event?
     if( (rCEvt.GetCommand() == COMMAND_WHEEL) ||
         (rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) ||
         (rCEvt.GetCommand() == COMMAND_AUTOSCROLL) )
     {
-#if 1
-        if( HandleScrollCommand( rCEvt ) )
-            return;
-#else
-        ScrollBar* pHor = aHorSBar.IsVisible() ? &aHorSBar : 0;
-        ScrollBar* pVer = aVerSBar.IsVisible() ? &aVerSBar : 0;
-        if( pView->HandleScrollCommand( rCEvt, pHor, pVer ) )
-            return;
-#endif
+        HandleScrollCommand( rCEvt );
     }
+    else if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+    {
+        HandleContextMenuCommand( rCEvt );
+    }
+}
+
+void SvxIconChoiceCtrl_Impl::HandleContextMenuCommand( const CommandEvent& rCEvt )
+{
+    Point aPopupPos;
+    if ( rCEvt.IsMouseEvent() )
+    {
+        aPopupPos = rCEvt.GetMousePosPixel();
+    }
+    else
+    {
+        // key event (or at least no mouse event) -> calculate popup position.
+
+        sal_uLong nPos = 0;
+        SvxIconChoiceCtrlEntry* pSelected = GetFirstSelectedEntry( nPos );
+        if ( pSelected )
+        {
+            MakeEntryVisible( pSelected, sal_False );
+            aPopupPos = GetEntryBoundRect( pSelected ).Center();
+
+            Rectangle aVisRect( GetVisibleRect() );
+            aPopupPos.Y() -= aVisRect.Top();
+        }
+    }
+
+    std::auto_ptr< PopupMenu > pPopup( new PopupMenu() );
+    std::auto_ptr< ContextMenuCreatedHdlParam > pData(
+         new ContextMenuCreatedHdlParam( pPopup.get(), aPopupPos ) );
+
+    if ( _aContextMenuCreatedHdl.IsSet() )
+        _aContextMenuCreatedHdl.Call( pData.get() );
+
+    pPopup->RemoveDisabledEntries( sal_True, sal_True );
+
+    sal_uInt16 nMenuAction = pPopup->Execute( pView, aPopupPos );
+
+    if ( nMenuAction && _aContextMenuSelectedHdl.IsSet() )
+        _aContextMenuSelectedHdl.Call( &nMenuAction );
 }
 
 void SvxIconChoiceCtrl_Impl::ToTop( SvxIconChoiceCtrlEntry* pEntry )
 {
     pView->CallImplEventListeners( nEvent, pData );
 }
-
-

File svtools/source/contnr/ivctrl.cxx

         Control::DataChanged( rDCEvt );
 }
 
+void SvtIconChoiceCtrl::SetContextMenuCreatedHdl( const Link& rHdl )
+{
+    _pImp->SetContextMenuCreatedHdl( rHdl );
+}
+
+void SvtIconChoiceCtrl::SetContextMenuSelectedHdl( const Link& rHdl )
+{
+    _pImp->SetContextMenuSelectedHdl( rHdl );
+}
+
 void SvtIconChoiceCtrl::SetBackground( const Wallpaper& rPaper )
 {
     if( rPaper != GetBackground() )
     }
     return xAccessible;
 }
-