Commits

Anonymous committed 7e61b02

#i115372# - 'Add to Places', 'Open' via file/folder context menu. redisign of 'create new folder' dialog. code cleanup svtools, fpicker in areas related to beforementioned features.

  • Participants
  • Parent commits 2445940

Comments (0)

Files changed (23)

fpicker/source/office/OfficeFilePicker.src

     Text [ en-US ] = "Workplace" ;
 };
 
+String STR_SVT_FILEPICKER_OPEN
+{
+    Text [ en-US ] = "~Open" ;
+};
+
+String STR_SVT_FILEPICKER_ADDTOPLACES
+{
+    Text [ en-US ] = "~Add to Places..." ;
+};
+
+String STR_SVT_ERRORCREATINGPLACE
+{
+    Text [ en-US ] = "Creating new place failed." ;
+};
+
 String STR_SVT_FOLDERPICKER_DEFAULT_TITLE
 {
     Text [ en-US ] = "Select Path" ;

fpicker/source/office/QueryFolderName.cxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_fpicker.hxx"
+
+#include "QueryFolderName.hxx"
+#include "fporesid.hxx"
+#include "iodlg.hrc"
+
+#include "vcl/msgbox.hxx"
+
+namespace fpicker { namespace office {
+
+// QueryFolderNameDialog -------------------------------------------------------
+
+QueryFolderNameDialog::QueryFolderNameDialog( Window* _pParent,
+                                              const String& rParentFolderName,
+                                              const String& rSuggestedName ) :
+    ModalDialog( _pParent, FpoResId( DLG_SVT_QUERYFOLDERNAME ) ),
+
+    m_aNameLine     ( this, FpoResId( FL_SVT_QUERYFOLDERNAME_DLG_NAME ) ),
+    m_aNameText     ( this, FpoResId( FT_SVT_QUERYFOLDERNAME_DLG_NAME ) ),
+    m_aNameEdit     ( this, FpoResId( ED_SVT_QUERYFOLDERNAME_DLG_NAME ) ),
+    m_aSeparatorLine( this, FpoResId( FL_SVT_QUERYFOLDERNAME_DLG_SEPARATOR ) ),
+    m_aOKBtn        ( this, FpoResId( BT_SVT_QUERYFOLDERNAME_DLG_OK ) ),
+    m_aCancelBtn    ( this, FpoResId( BT_SVT_QUERYFOLDERNAME_DLG_CANCEL ) )
+{
+    FreeResource();
+
+    String aNameLine( m_aNameLine.GetText() );
+    aNameLine.SearchAndReplaceAscii( "$name$", rParentFolderName );
+    m_aNameLine.SetText( aNameLine );
+
+    m_aNameEdit.SetText( rSuggestedName );
+    m_aNameEdit.SetSelection( Selection( 0, rSuggestedName.Len() ) );
+
+    m_aOKBtn.SetClickHdl( LINK( this, QueryFolderNameDialog, OKHdl ) );
+    m_aNameEdit.SetModifyHdl( LINK( this, QueryFolderNameDialog, NameHdl ) );
+};
+
+// -----------------------------------------------------------------------
+IMPL_LINK( QueryFolderNameDialog, OKHdl, Button *, EMPTYARG )
+{
+    m_aNameEdit.SetText(
+        m_aNameEdit.GetText().EraseLeadingChars().EraseTrailingChars() );
+    EndDialog( RET_OK );
+    return 1;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( QueryFolderNameDialog, NameHdl, Edit *, EMPTYARG )
+{
+    String aName( m_aNameEdit.GetText() );
+    aName.EraseLeadingChars().EraseTrailingChars();
+    if ( aName.Len() )
+    {
+        if ( !m_aOKBtn.IsEnabled() )
+            m_aOKBtn.Enable( sal_True );
+    }
+    else
+    {
+        if ( m_aOKBtn.IsEnabled() )
+            m_aOKBtn.Enable( sal_False );
+    }
+
+    return 0;
+}
+
+} } // namespace

fpicker/source/office/QueryFolderName.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef FPO_QUERYFOLDER_HXX
+#define FPO_QUERYFOLDER_HXX
+
+#include "vcl/fixed.hxx"
+#include "vcl/button.hxx"
+#include "vcl/edit.hxx"
+#include "vcl/dialog.hxx"
+
+//-------------------------------------------------------------------------
+namespace fpicker { namespace office {
+
+class QueryFolderNameDialog : public ModalDialog
+{
+private:
+    FixedLine       m_aNameLine;
+    FixedText       m_aNameText;
+    Edit            m_aNameEdit;
+    FixedLine       m_aSeparatorLine;
+    OKButton        m_aOKBtn;
+    CancelButton    m_aCancelBtn;
+
+    DECL_LINK( OKHdl, Button * );
+    DECL_LINK( NameHdl, Edit * );
+
+public:
+                    QueryFolderNameDialog( Window* _pParent,
+                                           const String& rParentFolderName,
+                                           const String& rSuggestedName );
+    String          GetName() const { return m_aNameEdit.GetText(); }
+};
+
+} } // namespace
+
+#endif // FPO_QUERYFOLDER_HXX

fpicker/source/office/addtoplaces.cxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_fpicker.hxx"
+
+#include "addtoplaces.hxx"
+#include "fporesid.hxx"
+#include "iodlg.hrc"
+
+#include "vcl/msgbox.hxx"
+
+namespace fpicker { namespace office {
+
+// AddToPlacesDialog -------------------------------------------------------
+
+AddToPlacesDialog::AddToPlacesDialog( Window* _pParent,
+                                      const String& rSuggestedPlaceTitle ) :
+    ModalDialog( _pParent, FpoResId( DLG_SVT_ADDTOPLACES ) ),
+    m_aNameLine     ( this, FpoResId( FL_FPO_ADDTOPLACES_DLG_NAME ) ),
+    m_aNameText     ( this, FpoResId( FT_FPO_ADDTOPLACES_DLG_NAME ) ),
+    m_aNameEdit     ( this, FpoResId( ED_FPO_ADDTOPLACES_DLG_NAME ) ),
+    m_aSeparatorLine( this, FpoResId( FL_FPO_ADDTOPLACES_DLG_SEPARATOR ) ),
+    m_aOKBtn        ( this, FpoResId( BT_FPO_ADDTOPLACES_DLG_OK ) ),
+    m_aCancelBtn    ( this, FpoResId( BT_FPO_ADDTOPLACES_DLG_CANCEL ) )
+{
+    FreeResource();
+
+    String aNameLine( m_aNameLine.GetText() );
+    aNameLine.SearchAndReplaceAscii( "$name$", rSuggestedPlaceTitle );
+    m_aNameLine.SetText( aNameLine );
+
+    m_aNameEdit.SetText( rSuggestedPlaceTitle );
+    m_aNameEdit.SetSelection( Selection( 0, rSuggestedPlaceTitle.Len() ) );
+
+    m_aOKBtn.SetClickHdl( LINK( this, AddToPlacesDialog, OKHdl ) );
+    m_aNameEdit.SetModifyHdl( LINK( this, AddToPlacesDialog, NameHdl ) );
+};
+
+// -----------------------------------------------------------------------
+IMPL_LINK( AddToPlacesDialog, OKHdl, Button *, EMPTYARG )
+{
+    m_aNameEdit.SetText(
+        m_aNameEdit.GetText().EraseLeadingChars().EraseTrailingChars() );
+    EndDialog( RET_OK );
+    return 1;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( AddToPlacesDialog, NameHdl, Edit *, EMPTYARG )
+{
+    String aName( m_aNameEdit.GetText() );
+    aName.EraseLeadingChars().EraseTrailingChars();
+    if ( aName.Len() )
+    {
+        if ( !m_aOKBtn.IsEnabled() )
+            m_aOKBtn.Enable( sal_True );
+    }
+    else
+    {
+        if ( m_aOKBtn.IsEnabled() )
+            m_aOKBtn.Enable( sal_False );
+    }
+    return 0;
+}
+
+} } // namespace

fpicker/source/office/addtoplaces.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef FPO_ADDTOPLACES_HXX
+#define FPO_ADDTOPLACES_HXX
+
+#include "vcl/fixed.hxx"
+#include "vcl/button.hxx"
+#include "vcl/edit.hxx"
+#include "vcl/dialog.hxx"
+
+//-------------------------------------------------------------------------
+namespace fpicker { namespace office {
+
+class AddToPlacesDialog : public ModalDialog
+{
+private:
+    FixedLine       m_aNameLine;
+    FixedText       m_aNameText;
+    Edit            m_aNameEdit;
+    FixedLine       m_aSeparatorLine;
+    OKButton        m_aOKBtn;
+    CancelButton    m_aCancelBtn;
+
+    DECL_LINK( OKHdl, Button * );
+    DECL_LINK( NameHdl, Edit * );
+
+public:
+                    AddToPlacesDialog( Window* _pParent,
+                                       const String& rSuggestedPlaceTitle );
+    String          GetPlaceTitle() const { return m_aNameEdit.GetText(); }
+};
+
+} } // namespace
+
+#endif // FPO_FPO_ADDTOPLACES_HXX

fpicker/source/office/fporesid.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FPO_RESID_HXX
+#define _FPO_RESID_HXX
+
+#include "osl/mutex.hxx"
+#include "rtl/instance.hxx"
+#include "tools/resmgr.hxx"
+
+namespace fpicker { namespace office {
+
+    struct ResMgrHolder
+    {
+        ResMgr * operator ()()
+        {
+            return ResMgr::CreateResMgr(
+                CREATEVERSIONRESMGR_NAME( fps_office ) );
+        }
+
+        static ResMgr * getOrCreate()
+        {
+            return rtl_Instance<
+                ResMgr, ResMgrHolder,
+                osl::MutexGuard, osl::GetGlobalMutex >::create(
+                    ResMgrHolder(), osl::GetGlobalMutex() );
+        }
+    };
+
+    struct FpoResId : public ResId
+    {
+        FpoResId ( sal_uInt16 nId )
+        : ResId ( nId, *ResMgrHolder::getOrCreate() ) {}
+    };
+
+} } // namespace
+
+#endif // _FPO_RESID_HXX

fpicker/source/office/iodlg.cxx

 #ifndef _SVTOOLS_IODLGIMPL_HRC
 #include "iodlg.hrc"
 #endif
-#include "rtl/instance.hxx"
 #include "asyncfilepicker.hxx"
 #include "iodlgimp.hxx"
 #include "svtools/inettbc.hxx"
 #include "unotools/syslocale.hxx"
-#include "svtools/QueryFolderName.hxx"
 #include "rtl/ustring.hxx"
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/ucb/XContentProviderManager.hpp>
 #include <functional>
 
 #include "placeswin.hxx"
+#include "QueryFolderName.hxx"
+#include "fporesid.hxx"
+#include "addtoplaces.hxx"
 
 //#define AUTOSELECT_USERFILTER
     // define this for the experimental feature of user-filter auto selection
 using namespace ::com::sun::star::sdbc;
 using namespace ::utl;
 using namespace ::svt;
+using namespace ::fpicker::office;
 
 using namespace ExtendedFilePickerElementIds;
 using namespace CommonFilePickerElementIds;
 }
 
 //*****************************************************************************
-// ResMgrHolder
-//*****************************************************************************
-namespace
-{
-    struct ResMgrHolder
-    {
-        ResMgr * operator ()()
-        {
-            return ResMgr::CreateResMgr (CREATEVERSIONRESMGR_NAME(fps_office));
-        }
-
-        static ResMgr * getOrCreate()
-        {
-            return rtl_Instance<
-                ResMgr, ResMgrHolder,
-                osl::MutexGuard, osl::GetGlobalMutex >::create (
-                    ResMgrHolder(), osl::GetGlobalMutex());
-        }
-    };
-
-    struct SvtResId : public ResId
-    {
-        SvtResId (sal_uInt16 nId) : ResId (nId, *ResMgrHolder::getOrCreate()) {}
-    };
-}
-
-//*****************************************************************************
 // SvtFileDialog
 //*****************************************************************************
 SvtFileDialog::SvtFileDialog
     WinBits nBits,
     WinBits nExtraBits
 ) :
-    ModalDialog( _pParent, SvtResId( DLG_SVT_EXPLORERFILE ) )
+    ModalDialog( _pParent, FpoResId( DLG_SVT_EXPLORERFILE ) )
 
     ,_pUserControls( NULL )
     ,_pCbReadOnly( NULL )
 //*****************************************************************************
 
 SvtFileDialog::SvtFileDialog ( Window* _pParent, WinBits nBits )
-    :ModalDialog( _pParent, SvtResId( DLG_SVT_EXPLORERFILE ) )
+    :ModalDialog( _pParent, FpoResId( DLG_SVT_EXPLORERFILE ) )
     ,_pUserControls( NULL )
     ,_pCbReadOnly( NULL )
     ,_pCbLinkBox( NULL)
 )
 {
     sal_Bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
-    m_aImages = ImageList( SvtResId( bIsHighContrast ? RID_FILEPICKER_IMAGES_HC : RID_FILEPICKER_IMAGES ) );
+    m_aImages = ImageList( FpoResId( bIsHighContrast ? RID_FILEPICKER_IMAGES_HC : RID_FILEPICKER_IMAGES ) );
 
     _pImp->_nStyle = nStyle;
     _pImp->_a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT );
 
     // Kontrollelement erzeugen, wobei die Reihenfolge die Tab-Steuerung
     // bestimmt.
-    _pImp->_pFtFileName = new FixedText( this, SvtResId( FT_EXPLORERFILE_FILENAME ) );
+    _pImp->_pFtFileName = new FixedText( this, FpoResId( FT_EXPLORERFILE_FILENAME ) );
 
     SvtURLBox* pURLBox = new SvtURLBox( this );
     pURLBox->SetUrlFilter( &m_aURLFilter );
     _pImp->_pEdFileName = pURLBox;
 
-    Edit aDummy( this, SvtResId( ED_EXPLORERFILE_FILENAME ) );
+    Edit aDummy( this, FpoResId( ED_EXPLORERFILE_FILENAME ) );
     _pImp->_pEdFileName->SetPosSizePixel( aDummy.GetPosPixel(), aDummy.GetSizePixel() );
     _pImp->_pEdFileName->Show();
     pURLBox->SetSelectHdl( LINK( this, SvtFileDialog, EntrySelectHdl_Impl ) );
 
     _pImp->_pEdFileName->SetHelpId( HID_FILEDLG_AUTOCOMPLETEBOX );
 
-    _pImp->_pFtFileType = new FixedText( this, SvtResId( FT_EXPLORERFILE_FILETYPE ) );
-    _pImp->CreateFilterListControl( this, SvtResId( LB_EXPLORERFILE_FILETYPE ) );
+    _pImp->_pFtFileType = new FixedText( this, FpoResId( FT_EXPLORERFILE_FILETYPE ) );
+    _pImp->CreateFilterListControl( this, FpoResId( LB_EXPLORERFILE_FILETYPE ) );
 
     // move the filter listbox to the space occupied by the version listbox
     // if that box isn't needed
          !( _nExtraBits & SFX_EXTRA_IMAGE_TEMPLATE ) )
     {
         {
-            FixedText aSharedListBoxLabel( this, SvtResId( FT_EXPLORERFILE_SHARED_LISTBOX ) );
+            FixedText aSharedListBoxLabel( this, FpoResId( FT_EXPLORERFILE_SHARED_LISTBOX ) );
             _pImp->_pFtFileType->SetPosPixel( aSharedListBoxLabel.GetPosPixel() );
         }
 
         {
-            ListBox aSharedListBox( this, SvtResId( LB_EXPLORERFILE_SHARED_LISTBOX ) );
+            ListBox aSharedListBox( this, FpoResId( LB_EXPLORERFILE_SHARED_LISTBOX ) );
             _pImp->GetFilterListControl()->SetPosPixel( aSharedListBox.GetPosPixel() );
         }
     }
 
-    _pImp->_pFtCurrentPath = new FixedText( this, SvtResId( FT_EXPLORERFILE_CURRENTPATH ) );
+    _pImp->_pFtCurrentPath = new FixedText( this, FpoResId( FT_EXPLORERFILE_CURRENTPATH ) );
     WinBits nTmpStyle = _pImp->_pFtCurrentPath->GetStyle();
     nTmpStyle |= WB_PATHELLIPSIS;
     _pImp->_pFtCurrentPath->SetStyle( nTmpStyle );
 
-    _pImp->_pBtnFileOpen = new PushButton( this, SvtResId( BTN_EXPLORERFILE_OPEN ) );
-    _pImp->_pBtnCancel = new CancelButton( this, SvtResId( BTN_EXPLORERFILE_CANCEL ) );
-    _pImp->_pBtnHelp = new HelpButton( this, SvtResId( BTN_EXPLORERFILE_HELP ) );
-
-    _pImp->_pBtnUp = new SvtUpButton_Impl( this, SvtResId( BTN_EXPLORERFILE_UP ) );
-    _pImp->_pBtnNewFolder = new ImageButton( this, SvtResId( BTN_EXPLORERFILE_NEWFOLDER ) );
+    _pImp->_pBtnFileOpen = new PushButton( this, FpoResId( BTN_EXPLORERFILE_OPEN ) );
+    _pImp->_pBtnCancel = new CancelButton( this, FpoResId( BTN_EXPLORERFILE_CANCEL ) );
+    _pImp->_pBtnHelp = new HelpButton( this, FpoResId( BTN_EXPLORERFILE_HELP ) );
+
+    _pImp->_pBtnUp = new SvtUpButton_Impl( this, FpoResId( BTN_EXPLORERFILE_UP ) );
+    _pImp->_pBtnNewFolder = new ImageButton( this, FpoResId( BTN_EXPLORERFILE_NEWFOLDER ) );
     _pImp->_pBtnNewFolder->SetStyle( _pImp->_pBtnNewFolder->GetStyle() | WB_NOPOINTERFOCUS );
-    _pImp->_pBtnBack = new SvtBackButton_Impl( this, SvtResId( BTN_EXPLORERFILE_BACK ), IMG_FILEDLG_BTN_BACK );
-    _pImp->_pBtnForward = new SvtForwardButton_Impl( this, SvtResId( BTN_EXPLORERFILE_FORWARD ), IMG_FILEDLG_BTN_FORWARD );
+    _pImp->_pBtnBack = new SvtBackButton_Impl( this, FpoResId( BTN_EXPLORERFILE_BACK ), IMG_FILEDLG_BTN_BACK );
+    _pImp->_pBtnForward = new SvtForwardButton_Impl( this, FpoResId( BTN_EXPLORERFILE_FORWARD ), IMG_FILEDLG_BTN_FORWARD );
 
     _pImp->_pBtnUp->SetAccessibleName( _pImp->_pBtnUp->GetQuickHelpText() );
     _pImp->_pBtnNewFolder->SetAccessibleName( _pImp->_pBtnNewFolder->GetQuickHelpText() );
     if ( ( nStyle & SFXWB_MULTISELECTION ) == SFXWB_MULTISELECTION )
         _pImp->_bMultiSelection = sal_True;
 
-    _pFileView = new SvtFileView( this, SvtResId( CTL_EXPLORERFILE_FILELIST ),
+    _pFileView = new SvtFileView( this, FpoResId( CTL_EXPLORERFILE_FILELIST ),
                                        FILEDLG_TYPE_PATHDLG == _pImp->_eDlgType,
                                        _pImp->_bMultiSelection );
 
     Size aFileViewSize( _pFileView->GetOutputSizePixel() );
     const Point aFileViewPos( _pFileView->GetPosPixel() );
 
-    const String aTitle( SvtResId( STR_SVT_FILEPICKER_PLACES ) );
-    _pPlacesWin = new fpicker::office::PlacesWindow( this, aTitle, &m_aURLFilter );
+    const String aTitle( FpoResId( STR_SVT_FILEPICKER_PLACES ) );
+    _pPlacesWin = new PlacesWindow( this, aTitle, &m_aURLFilter );
     m_bHasPlaces = _pPlacesWin->GetEntryCount() > 0;
 
     const long PLACES_DEFAULT_WIDTH = 120;
 
     if ( nStyle & SFXWB_READONLY )
     {
-        _pCbReadOnly = new CheckBox( this, SvtResId( CB_EXPLORERFILE_READONLY ) );
+        _pCbReadOnly = new CheckBox( this, FpoResId( CB_EXPLORERFILE_READONLY ) );
         _pCbReadOnly->SetHelpId( HID_FILEOPEN_READONLY );
-        _pCbReadOnly->SetText( SvtResId( STR_SVT_FILEPICKER_READONLY ) );
+        _pCbReadOnly->SetText( FpoResId( STR_SVT_FILEPICKER_READONLY ) );
         AddControl( _pCbReadOnly );
         ReleaseOwnerShip( _pCbReadOnly );
         _pCbReadOnly->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
 
     if ( nStyle & SFXWB_PASSWORD )
     {
-        _pImp->_pCbPassword = new CheckBox( this, SvtResId( CB_EXPLORERFILE_PASSWORD ) );
-        _pImp->_pCbPassword->SetText( SvtResId( STR_SVT_FILEPICKER_PASSWORD ) );
+        _pImp->_pCbPassword = new CheckBox( this, FpoResId( CB_EXPLORERFILE_PASSWORD ) );
+        _pImp->_pCbPassword->SetText( FpoResId( STR_SVT_FILEPICKER_PASSWORD ) );
         AddControl( _pImp->_pCbPassword );
         ReleaseOwnerShip( _pImp->_pCbPassword );
         _pImp->_pCbPassword->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
 
     if ( ( nStyle & SFXWB_PATHDIALOG ) == SFXWB_PATHDIALOG )
     {
-        _pImp->_pFtFileName->SetText( SvtResId( STR_PATHNAME ) );
+        _pImp->_pFtFileName->SetText( FpoResId( STR_PATHNAME ) );
         nResId = STR_PATHSELECT;
         nButtonResId = STR_BUTTONSELECT;
     }
 
-    SetText( SvtResId( nResId ) );
+    SetText( FpoResId( nResId ) );
 
     if ( nButtonResId )
-        _pImp->_pBtnFileOpen->SetText( SvtResId( nButtonResId ) );
+        _pImp->_pBtnFileOpen->SetText( FpoResId( nButtonResId ) );
 
     if ( FILEDLG_TYPE_FILEDLG != _pImp->_eDlgType )
     {
     _pFileView->SetSelectHdl( LINK( this, SvtFileDialog, SelectHdl_Impl ) );
     _pFileView->SetDoubleClickHdl( LINK( this, SvtFileDialog, DblClickHdl_Impl ) );
     _pFileView->SetOpenDoneHdl( LINK( this, SvtFileDialog, OpenDoneHdl_Impl ) );
+    _pFileView->SetContextMenuCreatedHdl( LINK( this, SvtFileDialog, FileviewContextMenuCreatedHdl_Impl ) );
+    _pFileView->SetContextMenuSelectedHdl( LINK( this, SvtFileDialog, FileviewContextMenuSelectedHdl_Impl ) );
 
     // Resourcen freigeben.
     FreeResource();
 {
     pThis->_pFileView->EndInplaceEditing( false );
 
-    INetURLObject aObj( pThis->_pFileView->GetViewURL() );
-    String sFolderName = aObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET, RTL_TEXTENCODING_UTF8 );
-    svtools::QueryFolderNameDialog aDlg( pThis, sFolderName, String( SvtResId( STR_SVT_NEW_FOLDER ) ) );
-    sal_Bool bHandled = sal_False;
-
+    INetURLObject aParent( pThis->_pFileView->GetViewURL() );
+    String aParentFolderName(
+        aParent.getName( INetURLObject::LAST_SEGMENT,
+                         true,
+                         INetURLObject::DECODE_WITH_CHARSET,
+                         RTL_TEXTENCODING_UTF8 ) );
+
+    QueryFolderNameDialog aDlg(
+        pThis, aParentFolderName, String( FpoResId( STR_SVT_NEW_FOLDER ) ) );
+
+    bool bHandled = false;
     while ( !bHandled )
     {
         if ( aDlg.Execute() == RET_OK )
             bHandled = pThis->_pFileView->CreateNewFolder( aDlg.GetName() );
         else
-            bHandled = sal_True;
+            bHandled = true;
     }
 
     return 0;
 
 #ifdef AUTOSELECT_USERFILTER
                 // select the "all files" entry
-                String sAllFilesFilter( SvtResId( STR_FILTERNAME_ALL ) );
+                String sAllFilesFilter( FpoResId( STR_FILTERNAME_ALL ) );
                 if ( _pImp->HasFilterListEntry( sAllFilesFilter ) )
                 {
                     _pImp->SelectFilterListEntry( sAllFilesFilter );
         {
             if ( ::utl::UCBContentHelper::Exists( aFileObj.GetMainURL( INetURLObject::NO_DECODE ) ) )
             {
-                QueryBox aBox( pThis, WB_YES_NO, SvtResId( STR_SVT_ALREADYEXISTOVERWRITE ) );
+                QueryBox aBox( pThis, WB_YES_NO, FpoResId( STR_SVT_ALREADYEXISTOVERWRITE ) );
                 if ( aBox.Execute() != RET_YES )
                     return 0;
             }
 
                 if ( !bExists )
                 {
-                    String sError( SvtResId( RID_FILEOPEN_NOTEXISTENTFILE ) );
+                    String sError( FpoResId( RID_FILEOPEN_NOTEXISTENTFILE ) );
 
                     String sInvalidFile( aFileObj.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
                     if ( INET_PROT_FILE == aFileObj.GetProtocol() )
             sText = rURL;
 
         if ( sText.EqualsAscii( "\\\\.\\" ) ) // Windows file system root?
-             sText = SvtResId( STR_SVT_FILEPICKER_WORKPLACE ); // do not display technical stuff that is not understandable by normal users.
+             sText = FpoResId( STR_SVT_FILEPICKER_WORKPLACE ); // do not display technical stuff that is not understandable by normal users.
 
         _pImp->_pFtCurrentPath->SetText( sText );
     }
     if ( !m_aCurrentHistoryEntry.empty() )
     {
         m_aHistory.setCurrent( m_aCurrentHistoryEntry );
-        m_aCurrentHistoryEntry = fpicker::office::History::Entry();
+        m_aCurrentHistoryEntry = History::Entry();
     }
     else
         m_aHistory.addURL( pView->GetViewURL() );
 
 //*****************************************************************************
 
-IMPL_LINK ( SvtFileDialog , PlacesIconClickHdl_Impl, fpicker::office::PlacesWindow*, EMPTYARG )
+IMPL_LINK ( SvtFileDialog, PlacesIconClickHdl_Impl, PlacesWindow*, EMPTYARG )
 {
     String aURL( _pPlacesWin->GetSelectedIconURL() );
     if ( aURL.Len() )
 
 //*****************************************************************************
 
+IMPL_LINK( SvtFileDialog, FileviewContextMenuCreatedHdl_Impl, PopupMenu*, pMenu )
+{
+    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 ) ),
+                               0,
+                               0 );
+        }
+
+        if ( ( _pImp->_eMode != FILEDLG_MODE_SAVE ) || pUserData->mbIsFolder )
+        {
+            if ( pMenu->GetItemCount() > 0 )
+                pMenu->InsertSeparator( 0 );
+
+            pMenu->InsertItem( STR_SVT_FILEPICKER_OPEN,
+                               String( FpoResId( STR_SVT_FILEPICKER_OPEN ) ),
+                               0,
+                               0 );
+        }
+    }
+    else
+    {
+        // multi selection : "Add to Places" : never
+        //                   "Open"          : only if no folders selected
+        SvLBoxEntry* pEntry = _pFileView->FirstSelected();
+        do
+        {
+            SvtContentEntry* pUserData
+                = static_cast< SvtContentEntry * >( pEntry->GetUserData() );
+
+            if ( pUserData->mbIsFolder )
+                break;
+
+            pEntry = _pFileView->NextSelected( pEntry );
+        }
+        while ( pEntry );
+
+        if ( !pEntry )
+        {
+            if ( pMenu->GetItemCount() > 0 )
+                pMenu->InsertSeparator( 0 );
+
+            pMenu->InsertItem( STR_SVT_FILEPICKER_OPEN,
+                               String( FpoResId( STR_SVT_FILEPICKER_OPEN ) ),
+                               0,
+                               0 );
+        }
+    }
+    return 0;
+}
+
+//*****************************************************************************
+
+IMPL_LINK( SvtFileDialog, FileviewContextMenuSelectedHdl_Impl, sal_uInt16*, pItemId )
+{
+    switch ( *pItemId )
+    {
+    case STR_SVT_FILEPICKER_OPEN:
+        OpenHdl_Impl( this, NULL );
+        break;
+
+    case STR_SVT_FILEPICKER_ADDTOPLACES:
+        {
+            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();
+                }
+            }
+            break;
+        }
+    }
+    return 0;
+}
+
+//*****************************************************************************
+
 long SvtFileDialog::Notify( NotifyEvent& rNEvt )
 
 /*  [Beschreibung]
 
                 if ( bEmpty )
                 {
-                    ErrorBox aBox( this, WB_OK, SvtResId( STR_SVT_NOREMOVABLEDEVICE ) );
+                    ErrorBox aBox( this, WB_OK, FpoResId( STR_SVT_NOREMOVABLEDEVICE ) );
                     aBox.Execute();
                     return 0;
                 }
 
     // Initialen Filter einstellen.
     sal_uInt16 nFilterCount = GetFilterCount();
-    String aAll( SvtResId( STR_FILTERNAME_ALL ) );
+    String aAll( FpoResId( STR_FILTERNAME_ALL ) );
     sal_Bool bHasAll = _pImp->HasFilterListEntry( aAll );
     if ( _pImp->GetCurFilter() || nFilterCount == 1 || ( nFilterCount == 2 && bHasAll ) )
     {
 
 //*****************************************************************************
 
-void SvtFileDialog::OpenURL_Impl( const fpicker::office::History::Entry & rEntry )
+void SvtFileDialog::OpenURL_Impl( const History::Entry & rEntry )
 {
     m_aCurrentHistoryEntry = rEntry;
     OpenURL_Impl( rEntry.getURL() );
     // determine high contrast mode
     {
         sal_Bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
-        m_aImages = ImageList( SvtResId( bIsHighContrast ? RID_FILEPICKER_IMAGES_HC : RID_FILEPICKER_IMAGES ) );
+        m_aImages = ImageList( FpoResId( bIsHighContrast ? RID_FILEPICKER_IMAGES_HC : RID_FILEPICKER_IMAGES ) );
     }
 
     // set the appropriate images on the buttons
     if ( _nExtraBits & SFX_EXTRA_INSERTASLINK )
     {
         _pCbLinkBox = new CheckBox( this );
-        _pCbLinkBox ->SetText( SvtResId( STR_SVT_FILEPICKER_INSERT_AS_LINK ) );
+        _pCbLinkBox ->SetText( FpoResId( STR_SVT_FILEPICKER_INSERT_AS_LINK ) );
         _pCbLinkBox ->SetHelpId( HID_FILEDLG_LINK_CB );
         AddControl( _pCbLinkBox  );
         ReleaseOwnerShip( _pCbLinkBox );
 
         // "Vorschau"
         _pCbPreviewBox = new CheckBox( this );
-        _pCbPreviewBox->SetText( SvtResId( STR_SVT_FILEPICKER_SHOW_PREVIEW ) );
+        _pCbPreviewBox->SetText( FpoResId( STR_SVT_FILEPICKER_SHOW_PREVIEW ) );
         _pCbPreviewBox->SetHelpId( HID_FILEDLG_PREVIEW_CB );
         AddControl( _pCbPreviewBox );
         ReleaseOwnerShip( _pCbPreviewBox );
         _pPrevBmp = new FixedBitmap( this, WinBits( WB_BORDER ) );
         _pPrevBmp->SetBackground( Wallpaper( Color( COL_WHITE ) ) );
         _pPrevBmp->Show();
-        _pPrevBmp->SetAccessibleName(SvtResId(STR_PREVIEW));
+        _pPrevBmp->SetAccessibleName(FpoResId(STR_PREVIEW));
     }
 
     if ( _nExtraBits & SFX_EXTRA_AUTOEXTENSION )
     {
-        _pImp->_pCbAutoExtension = new CheckBox( this, SvtResId( CB_AUTO_EXTENSION ) );
-        _pImp->_pCbAutoExtension->SetText( SvtResId( STR_SVT_FILEPICKER_AUTO_EXTENSION ) );
+        _pImp->_pCbAutoExtension = new CheckBox( this, FpoResId( CB_AUTO_EXTENSION ) );
+        _pImp->_pCbAutoExtension->SetText( FpoResId( STR_SVT_FILEPICKER_AUTO_EXTENSION ) );
         _pImp->_pCbAutoExtension->Check( sal_True );
         AddControl( _pImp->_pCbAutoExtension );
         ReleaseOwnerShip( _pImp->_pCbAutoExtension );
 
     if ( _nExtraBits & SFX_EXTRA_FILTEROPTIONS )
     {
-        _pImp->_pCbOptions = new CheckBox( this, SvtResId( CB_OPTIONS ) );
-        _pImp->_pCbOptions->SetText( SvtResId( STR_SVT_FILEPICKER_FILTER_OPTIONS ) );
+        _pImp->_pCbOptions = new CheckBox( this, FpoResId( CB_OPTIONS ) );
+        _pImp->_pCbOptions->SetText( FpoResId( STR_SVT_FILEPICKER_FILTER_OPTIONS ) );
         AddControl( _pImp->_pCbOptions );
         ReleaseOwnerShip( _pImp->_pCbOptions );
         _pImp->_pCbOptions->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
 
     if ( _nExtraBits & SFX_EXTRA_SELECTION )
     {
-        _pCbSelection = new CheckBox( this, SvtResId( CB_OPTIONS ) );
-        _pCbSelection->SetText( SvtResId( STR_SVT_FILEPICKER_SELECTION ) );
+        _pCbSelection = new CheckBox( this, FpoResId( CB_OPTIONS ) );
+        _pCbSelection->SetText( FpoResId( STR_SVT_FILEPICKER_SELECTION ) );
         AddControl( _pCbSelection );
         ReleaseOwnerShip( _pCbSelection );
         _pCbSelection->SetClickHdl( LINK( this, SvtFileDialog, ClickHdl_Impl ) );
     if ( _nExtraBits & SFX_EXTRA_PLAYBUTTON )
     {
         _pPbPlay = new PushButton( this );
-        _pPbPlay->SetText( SvtResId( STR_SVT_FILEPICKER_PLAY ) );
+        _pPbPlay->SetText( FpoResId( STR_SVT_FILEPICKER_PLAY ) );
         _pPbPlay->SetHelpId( HID_FILESAVE_DOPLAY );
         AddControl( _pPbPlay );
         ReleaseOwnerShip( _pPbPlay );
 
     if ( _nExtraBits & SFX_EXTRA_SHOWVERSIONS )
     {
-        _pImp->_pFtFileVersion = new FixedText( this, SvtResId( FT_EXPLORERFILE_SHARED_LISTBOX ) );
-        _pImp->_pFtFileVersion->SetText( SvtResId( STR_SVT_FILEPICKER_VERSION ) );
-
-        _pImp->_pLbFileVersion = new ListBox( this, SvtResId( LB_EXPLORERFILE_SHARED_LISTBOX ) );
+        _pImp->_pFtFileVersion = new FixedText( this, FpoResId( FT_EXPLORERFILE_SHARED_LISTBOX ) );
+        _pImp->_pFtFileVersion->SetText( FpoResId( STR_SVT_FILEPICKER_VERSION ) );
+
+        _pImp->_pLbFileVersion = new ListBox( this, FpoResId( LB_EXPLORERFILE_SHARED_LISTBOX ) );
         _pImp->_pLbFileVersion->SetHelpId( HID_FILEOPEN_VERSION );
     }
     else if ( _nExtraBits & SFX_EXTRA_TEMPLATES )
     {
-        _pImp->_pFtTemplates = new FixedText( this, SvtResId( FT_EXPLORERFILE_SHARED_LISTBOX ) );
-        _pImp->_pFtTemplates->SetText( SvtResId( STR_SVT_FILEPICKER_TEMPLATES ) );
-
-        _pImp->_pLbTemplates = new ListBox( this, SvtResId( LB_EXPLORERFILE_SHARED_LISTBOX ) );
+        _pImp->_pFtTemplates = new FixedText( this, FpoResId( FT_EXPLORERFILE_SHARED_LISTBOX ) );
+        _pImp->_pFtTemplates->SetText( FpoResId( STR_SVT_FILEPICKER_TEMPLATES ) );
+
+        _pImp->_pLbTemplates = new ListBox( this, FpoResId( LB_EXPLORERFILE_SHARED_LISTBOX ) );
         _pImp->_pLbTemplates->SetHelpId( HID_FILEOPEN_VERSION );
             // This is strange. During the re-factoring during 96930, I discovered that this help id
             // is set in the "Templates mode". This was hidden in the previous implementation.
     }
     else if ( _nExtraBits & SFX_EXTRA_IMAGE_TEMPLATE )
     {
-        _pImp->_pFtImageTemplates = new FixedText( this, SvtResId( FT_EXPLORERFILE_SHARED_LISTBOX ) );
-        _pImp->_pFtImageTemplates->SetText( SvtResId( STR_SVT_FILEPICKER_IMAGE_TEMPLATE ) );
-
-        _pImp->_pLbImageTemplates = new ListBox( this, SvtResId( LB_EXPLORERFILE_SHARED_LISTBOX ) );
+        _pImp->_pFtImageTemplates = new FixedText( this, FpoResId( FT_EXPLORERFILE_SHARED_LISTBOX ) );
+        _pImp->_pFtImageTemplates->SetText( FpoResId( STR_SVT_FILEPICKER_IMAGE_TEMPLATE ) );
+
+        _pImp->_pLbImageTemplates = new ListBox( this, FpoResId( LB_EXPLORERFILE_SHARED_LISTBOX ) );
         _pImp->_pLbImageTemplates->SetHelpId( HID_FILEOPEN_IMAGE_TEMPLATE );
     }
 }
         }
     }
 }
-
-// -----------------------------------------------------------------------
-
-// QueryFolderNameDialog -------------------------------------------------------
-
-namespace svtools {
-
-QueryFolderNameDialog::QueryFolderNameDialog
-(
-    Window* _pParent,
-    const String& rTitle,
-    const String& rDefaultText,
-    String* pGroupName
-) :
-    ModalDialog( _pParent, SvtResId( DLG_SVT_QUERYFOLDERNAME ) ),
-
-    aNameText ( this, SvtResId( FT_SVT_QUERYFOLDERNAME_DLG_NAME ) ),
-    aNameEdit ( this, SvtResId( ED_SVT_QUERYFOLDERNAME_DLG_NAME ) ),
-    aNameLine ( this, SvtResId( FL_SVT_QUERYFOLDERNAME_DLG_NAME ) ),
-    aOKBtn    ( this, SvtResId( BT_SVT_QUERYFOLDERNAME_DLG_OK ) ),
-    aCancelBtn( this, SvtResId( BT_SVT_QUERYFOLDERNAME_DLG_CANCEL ) )
-{
-    FreeResource();
-    SetText( rTitle );
-    aNameEdit.SetText( rDefaultText );
-    aNameEdit.SetSelection( Selection( 0, rDefaultText.Len() ) );
-    aOKBtn.SetClickHdl( LINK( this, QueryFolderNameDialog, OKHdl ) );
-    aNameEdit.SetModifyHdl( LINK( this, QueryFolderNameDialog, NameHdl ) );
-
-    if ( pGroupName )
-        aNameLine.SetText( *pGroupName );
-};
-
-// -----------------------------------------------------------------------
-IMPL_LINK( QueryFolderNameDialog, OKHdl, Button *, EMPTYARG )
-{
-    // trim the strings
-    aNameEdit.SetText( aNameEdit.GetText().EraseLeadingChars().EraseTrailingChars() );
-    EndDialog( RET_OK );
-    return 1;
-}
-
-// -----------------------------------------------------------------------
-IMPL_LINK( QueryFolderNameDialog, NameHdl, Edit *, EMPTYARG )
-{
-    // trim the strings
-    String aName = aNameEdit.GetText();
-    aName.EraseLeadingChars().EraseTrailingChars();
-    if ( aName.Len() )
-    {
-        if ( !aOKBtn.IsEnabled() )
-            aOKBtn.Enable( sal_True );
-    }
-    else
-    {
-        if ( aOKBtn.IsEnabled() )
-            aOKBtn.Enable( sal_False );
-    }
-
-    return 0;
-}
-
-}

fpicker/source/office/iodlg.hrc

 
 // DLG_SVT_QUERYFOLDERNAME -----------------------
 
-#define FT_SVT_QUERYFOLDERNAME_DLG_NAME     10
-#define ED_SVT_QUERYFOLDERNAME_DLG_NAME     11
-#define FL_SVT_QUERYFOLDERNAME_DLG_NAME     12
-#define BT_SVT_QUERYFOLDERNAME_DLG_OK       13
-#define BT_SVT_QUERYFOLDERNAME_DLG_CANCEL   14
-#define BT_SVT_QUERYFOLDERNAME_DLG_HELP     15
+#define FT_SVT_QUERYFOLDERNAME_DLG_NAME      10
+#define ED_SVT_QUERYFOLDERNAME_DLG_NAME      11
+#define FL_SVT_QUERYFOLDERNAME_DLG_NAME      12
+#define FL_SVT_QUERYFOLDERNAME_DLG_SEPARATOR 13
+#define BT_SVT_QUERYFOLDERNAME_DLG_OK        14
+#define BT_SVT_QUERYFOLDERNAME_DLG_CANCEL    15
+
+// DLG_SVT_ADDTOPLACES ----------------------------
+
+#define FT_FPO_ADDTOPLACES_DLG_NAME         20
+#define ED_FPO_ADDTOPLACES_DLG_NAME         21
+#define FL_FPO_ADDTOPLACES_DLG_NAME         22
+#define FL_FPO_ADDTOPLACES_DLG_SEPARATOR    23
+#define BT_FPO_ADDTOPLACES_DLG_OK           24
+#define BT_FPO_ADDTOPLACES_DLG_CANCEL       25
 
 #endif
-

fpicker/source/office/iodlg.hxx

     DECL_LINK( PlayButtonHdl_Impl, PushButton* );
     DECL_LINK( PlacesIconClickHdl_Impl, fpicker::office::PlacesWindow* );
 
+    DECL_LINK( FileviewContextMenuCreatedHdl_Impl, PopupMenu* );
+    DECL_LINK( FileviewContextMenuSelectedHdl_Impl, sal_uInt16* );
+
     // entfernt einen Filter mit Wildcards aus dem Path und gibt in zurueck
     sal_Bool IsolateFilterFromPath_Impl( String& rPath, String& rFilter );
 

fpicker/source/office/iodlg.src

     Moveable = TRUE ;
     OutputSize = TRUE ;
     SVLook = TRUE ;
-    Text = "Ordner" ;
-    Size = MAP_APPFONT ( 218 , 45 ) ;
+    Text [ en-US ] = "New Folder" ;
+    Size = MAP_APPFONT ( 198 , 76 ) ;
+
+    FixedLine FL_SVT_QUERYFOLDERNAME_DLG_NAME
+    {
+        Group = TRUE ;
+        Pos = MAP_APPFONT ( 6 , 3 ) ;
+        Size = MAP_APPFONT ( 186 , 8 ) ;
+        Text [ en-US ] = "Create new folder in '$name$'" ;
+    };
     FixedText FT_SVT_QUERYFOLDERNAME_DLG_NAME
     {
-        Pos = MAP_APPFONT ( 12 , 14 ) ;
-        Size = MAP_APPFONT ( 138 , 10 ) ;
-        Text [ en-US ] = "Na~me" ;
+        Pos = MAP_APPFONT ( 9 , 14 ) ;
+        Size = MAP_APPFONT ( 114 , 10 ) ;
+        Text [ en-US ] = "Folder name" ;
     };
     Edit ED_SVT_QUERYFOLDERNAME_DLG_NAME
     {
         HelpID = "fpicker:Edit:DLG_SVT_QUERYFOLDERNAME:ED_SVT_QUERYFOLDERNAME_DLG_NAME";
-        Pos = MAP_APPFONT ( 12 , 27 ) ;
-        Size = MAP_APPFONT ( 138 , 12 ) ;
+        Pos = MAP_APPFONT ( 9 , 27 ) ;
+        Size = MAP_APPFONT ( 180 , 12 ) ;
         Border = TRUE ;
         Left = TRUE ;
     };
-    FixedLine FL_SVT_QUERYFOLDERNAME_DLG_NAME
+    FixedLine FL_SVT_QUERYFOLDERNAME_DLG_SEPARATOR
     {
-        Group = TRUE ;
-        Pos = MAP_APPFONT ( 6 , 3 ) ;
-        Size = MAP_APPFONT ( 150 , 8 ) ;
-        Text [ en-US ] = "Create new folder" ;
+        Pos = MAP_APPFONT ( 0, 49 ) ;
+        Size = MAP_APPFONT ( 198 , 8 ) ;
     };
     OKButton BT_SVT_QUERYFOLDERNAME_DLG_OK
     {
-        Pos = MAP_APPFONT ( 162 , 6 ) ;
+        Pos = MAP_APPFONT ( 84 , 57 ) ;
         Size = MAP_APPFONT ( 50 , 14 ) ;
         DefButton = TRUE ;
     };
     CancelButton BT_SVT_QUERYFOLDERNAME_DLG_CANCEL
     {
-        Pos = MAP_APPFONT ( 162 , 23 ) ;
+        Pos = MAP_APPFONT ( 139 , 57 ) ;
+        Size = MAP_APPFONT ( 50 , 14 ) ;
+    };
+};
+
+// AddToPlacesDialog ----------------------------------------------------------
+ModalDialog DLG_SVT_ADDTOPLACES
+{
+    HelpID = "fpicker:ModalDialog:DLG_FPO_ADDTOPLACES";
+    Border = TRUE ;
+    Moveable = TRUE ;
+    OutputSize = TRUE ;
+    SVLook = TRUE ;
+    Text [ en-US ] = "Add Place" ;
+    Size = MAP_APPFONT ( 198 , 76 ) ;
+
+    FixedLine FL_FPO_ADDTOPLACES_DLG_NAME
+    {
+        Group = TRUE ;
+        Pos = MAP_APPFONT ( 6 , 3 ) ;
+        Size = MAP_APPFONT ( 186 , 8 ) ;
+        Text [ en-US ] = "Add '$name$' to Places" ;
+    };
+    FixedText FT_FPO_ADDTOPLACES_DLG_NAME
+    {
+        Pos = MAP_APPFONT ( 9 , 14 ) ;
+        Size = MAP_APPFONT ( 114 , 10 ) ;
+        Text [ en-US ] = "Na~me" ;
+    };
+    Edit ED_FPO_ADDTOPLACES_DLG_NAME
+    {
+        HelpID = "fpicker:Edit:DLG_FPO_ADDTOPLACES:ED_FPO_ADDTOPLACES_DLG_NAME";
+        Pos = MAP_APPFONT ( 9 , 27 ) ;
+        Size = MAP_APPFONT ( 180 , 12 ) ;
+        Border = TRUE ;
+        Left = TRUE ;
+    };
+    FixedLine FL_FPO_ADDTOPLACES_DLG_SEPARATOR
+    {
+        Pos = MAP_APPFONT ( 0, 49 ) ;
+        Size = MAP_APPFONT ( 198 , 8 ) ;
+    };
+    OKButton BT_FPO_ADDTOPLACES_DLG_OK
+    {
+        Pos = MAP_APPFONT ( 84 , 57 ) ;
+        Size = MAP_APPFONT ( 50 , 14 ) ;
+        DefButton = TRUE ;
+    };
+    CancelButton BT_FPO_ADDTOPLACES_DLG_CANCEL
+    {
+        Pos = MAP_APPFONT ( 139 , 57 ) ;
         Size = MAP_APPFONT ( 50 , 14 ) ;
     };
 };
 };
 
 //******************************************************************** EOF
-

fpicker/source/office/iodlgimp.cxx

 #include "svtools/inettbc.hxx"
 #include "iodlg.hxx"
 #include "iodlg.hrc"
+#include "fporesid.hxx"
 #include "svtools/imagemgr.hxx"
 #include <unotools/localfilehelper.hxx>
 #include "unotools/useroptions.hxx"
-#include "rtl/instance.hxx"
 #include <svtools/svtools.hrc>
 
 #define _SVSTDARR_STRINGSSORTDTOR
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
 using namespace ::utl;
+using namespace ::fpicker::office;
 
 // some stuff for easier changes for SvtViewOptions
 static const sal_Char*      pViewOptDataName = "dialog data";
 #define BOOL_NOT_INITIALIZE ((sal_Bool)2)
 
 //*****************************************************************************
-// ResMgrHolder / SvtSimpleResId
-//*****************************************************************************
-namespace
-{
-    struct ResMgrHolder
-    {
-        ResMgr * operator ()()
-        {
-            return ResMgr::CreateResMgr (CREATEVERSIONRESMGR_NAME(fps_office));
-        }
-        static ResMgr * getOrCreate()
-        {
-            return rtl_Instance<
-                ResMgr, ResMgrHolder,
-                osl::MutexGuard, osl::GetGlobalMutex >::create (
-                    ResMgrHolder(), osl::GetGlobalMutex());
-        }
-    };
-
-    struct SvtResId : public ResId
-    {
-        SvtResId (sal_uInt16 nId) : ResId (nId, *ResMgrHolder::getOrCreate()) {}
-    };
-}
-
-//*****************************************************************************
 // SvtFileDialogFilter_Impl
 //*****************************************************************************
 
             if ( nCount == 1 )
             {
                 // adjust the title of the top level entry (the workspace)
-                _pMenu->SetItemText( --nItemId, SvtResId( STR_SVT_FILEPICKER_WORKPLACE ) );
+                _pMenu->SetItemText( --nItemId, FpoResId( STR_SVT_FILEPICKER_WORKPLACE ) );
             }
         }
 
             if ( LocalFileHelper::ConvertURLToSystemPath( rURL, sDisplayName ) )
             {
                 if ( sDisplayName.EqualsAscii( "\\\\.\\" ) ) // Windows file system root?
-                    sDisplayName = SvtResId( STR_SVT_FILEPICKER_WORKPLACE ); // do not display technical stuff that is not understandable by normal users.
+                    sDisplayName = FpoResId( STR_SVT_FILEPICKER_WORKPLACE ); // do not display technical stuff that is not understandable by normal users.
                 _pMenu->InsertItem( nItemId, sDisplayName, aImage );
             }
             else

fpicker/source/office/makefile.mk

 	$(SLO)$/iodlgimp.obj \
 	$(SLO)$/place.obj \
 	$(SLO)$/placeswin.obj \
-	$(SLO)$/history.obj
+	$(SLO)$/history.obj \
+	$(SLO)$/QueryFolderName.obj \
+	$(SLO)$/addtoplaces.obj
 
 SHL1TARGET=	$(TARGET).uno
 SHL1IMPLIB=	i$(TARGET)
 ALLTAR : $(MISC)/fps_office.component
 
 $(MISC)/fps_office.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
-        fps_office.component
-    $(XSLTPROC) --nonet --stringparam uri \
-        '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
-        $(SOLARENV)/bin/createcomponent.xslt fps_office.component
+		fps_office.component
+	$(XSLTPROC) --nonet --stringparam uri \
+		'$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+		$(SOLARENV)/bin/createcomponent.xslt fps_office.component

fpicker/source/office/place.cxx

 #include "com/sun/star/beans/PropertyValue.hpp"
 #include "com/sun/star/container/XHierarchicalNameAccess.hpp"
 #include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/container/XNameContainer.hpp"
+#include "com/sun/star/container/XNameReplace.hpp"
 #include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/util/XChangesBatch.hpp"
 
 using namespace com::sun::star;
 
 namespace fpicker { namespace office {
 
+struct PlaceData
+{
+    rtl::OUString aTitle;
+    rtl::OUString aTargetURL;
+    bool bReadOnly;
+    bool bFolder;
+    rtl::OUString aIconURL;
+    rtl::OUString aQuickHelpText;
+
+    PlaceData() : bReadOnly( false ), bFolder( false ) {}
+};
+
 Place::Place( const uno::Reference< lang::XMultiServiceFactory > & xSMgr )
-    : m_xSMgr( xSMgr )
+    : m_xSMgr( xSMgr ),
+      m_pData( 0 )
 {
 }
 
     : m_xSMgr( xSMgr ),
       m_xHierNameAccess( xHierNameAccess ),
       m_aInternalPath( rInternalPath ),
-      m_aExternalPath( rExternalPath )
+      m_aExternalPath( rExternalPath ),
+      m_pData( 0 )
 {
 }
 
+Place::Place( const uno::Reference< lang::XMultiServiceFactory > & xSMgr,
+              const rtl::OUString & rTitle,
+              const rtl::OUString & rTargetURL,
+              bool bReadOnly /*= false */,
+              bool bFolder /* = false */,
+              const rtl::OUString & rIconURL /*= rtl::OUString()*/,
+              const rtl::OUString & rQuickHelpText /*= rtl::OUString()*/ )
+    : m_xSMgr( xSMgr ),
+      m_pData( new PlaceData )
+{
+    m_pData->aTitle         = rTitle;
+    m_pData->aTargetURL     = rTargetURL;
+    m_pData->bReadOnly      = bReadOnly;
+    m_pData->bFolder        = bFolder;
+    m_pData->aIconURL       = rIconURL;
+    m_pData->aQuickHelpText = rQuickHelpText;
+}
+
 Place::Place( const Place & rOther )
     : m_xSMgr( rOther.m_xSMgr ),
       m_xHierNameAccess( rOther.m_xHierNameAccess ),
       m_aInternalPath( rOther.m_aInternalPath ),
-      m_aExternalPath( rOther.m_aExternalPath )
+      m_aExternalPath( rOther.m_aExternalPath ),
+      m_pData( 0 )
 {
+    if ( rOther.m_pData )
+    {
+        // deep copy.
+        m_pData = new PlaceData;
+        m_pData->aTitle         = rOther.m_pData->aTitle;
+        m_pData->aTargetURL     = rOther.m_pData->aTargetURL;
+        m_pData->bReadOnly      = rOther.m_pData->bReadOnly;
+        m_pData->bFolder        = rOther.m_pData->bFolder;
+        m_pData->aIconURL       = rOther.m_pData->aIconURL;
+        m_pData->aQuickHelpText = rOther.m_pData->aQuickHelpText;
+    }
 }
 
 Place::~Place()
 {
+    delete m_pData;
 }
 
 Place & Place::operator=( const Place & rOther )
     m_xHierNameAccess.set( rOther.m_xHierNameAccess );
     m_aInternalPath = rOther.m_aInternalPath;
     m_aExternalPath = rOther.m_aExternalPath;
+
+    if ( rOther.m_pData )
+    {
+        // deep copy.
+        m_pData = new PlaceData;
+        m_pData->aTitle         = rOther.m_pData->aTitle;
+        m_pData->aTargetURL     = rOther.m_pData->aTargetURL;
+        m_pData->bReadOnly      = rOther.m_pData->bReadOnly;
+        m_pData->bFolder        = rOther.m_pData->bFolder;
+        m_pData->aIconURL       = rOther.m_pData->aIconURL;
+        m_pData->aQuickHelpText = rOther.m_pData->aQuickHelpText;
+    }
+
     return *this;
 }
 
     std::vector< Place > aChildren;
     if ( m_xHierNameAccess.is() )
     {
+        osl::MutexGuard aGuard( m_aMutex );
+
         uno::Reference< container::XNameAccess > xNameAccess;
 
         rtl::OUString aInternalPath( m_aInternalPath );
 
 rtl::OUString Place::getTitle() const
 {
+    if ( m_pData )
+        return m_pData->aTitle;
+
     init();
 
     // mandatory prop.
 
 rtl::OUString Place::getTargetURL() const
 {
+    if ( m_pData )
+        return m_pData->aTargetURL;
+
     init();
 
     // mandatory prop.
 
 rtl::OUString Place::queryIconURL() const
 {
+    if ( m_pData )
+        return m_pData->aIconURL;
+
     init();
 
     rtl::OUString aValue;
 
 rtl::OUString Place::queryQuickHelpText() const
 {
+    if ( m_pData )
+        return m_pData->aQuickHelpText;
+
     init();
 
     rtl::OUString aValue;
 
 bool Place::queryReadOnly() const
 {
+    if ( m_pData )
+        return m_pData->bReadOnly;
+
     init();
 
     sal_Bool bValue;
 
 bool Place::isFolder() const
 {
+    if ( m_pData )
+        return m_pData->bFolder;
+
     init();
 
     // mandatory prop.
 
 bool Place::isLink() const
 {
+    if ( m_pData )
+        return !m_pData->bFolder;
+
     init();
 
     // mandatory prop.
     return aFolderURL;
 }
 
+bool Place::addChild( const Place & rPlace )
+{
+    init();
+
+    try
+    {
+        osl::MutexGuard aGuard( m_aMutex );
+
+        uno::Reference< lang::XMultiServiceFactory > xConfigProv
+            = uno::Reference< lang::XMultiServiceFactory >(
+                m_xSMgr->createInstance(
+                    rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+                        "com.sun.star.ucb.Places" ) ) ),
+                uno::UNO_QUERY );
+
+        if ( xConfigProv.is() )
+        {
+            uno::Sequence< uno::Any > aArguments( 1 );
+            beans::PropertyValue      aProperty;
+
+            aProperty.Name
+                = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
+            rtl::OUString aPath( RTL_CONSTASCII_USTRINGPARAM( "Places" ) );
+            if ( m_aInternalPath.getLength() > 0 )
+                aPath += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+            aPath += m_aInternalPath;
+            aProperty.Value <<= aPath;
+            aArguments[ 0 ] <<= aProperty;
+
+            uno::Reference< util::XChangesBatch > xBatch(
+                    xConfigProv->createInstanceWithArguments(
+                        rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+                            "com.sun.star.ucb.HierarchyDataReadWriteAccess" ) ),
+                        aArguments ),
+                    uno::UNO_QUERY );
+
+            OSL_ENSURE( xBatch.is(), "No changes batch!" );
+
+            uno::Reference< container::XNameAccess > xParentNameAccess(
+                xBatch, uno::UNO_QUERY );
+
+            OSL_ENSURE( xParentNameAccess.is(), "No name access!" );
+
+            // Check whether key already exists...
+
+            uno::Reference< container::XNameAccess > xNameAccess;
+
+            xParentNameAccess->getByName(
+                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Children" ) ) )
+                    >>= xNameAccess;
+
+            // create unique internal name for the new child.
+            const rtl::OUString aNamePre( RTL_CONSTASCII_USTRINGPARAM( "MyPlace_" ) );
+            sal_Int32 nTry = 0;
+            rtl::OUString aName;
+
+            do
+            {
+                nTry++;
+
+                aName = aNamePre;
+                aName += rtl::OUString::valueOf( nTry );
+            }
+            while ( ( nTry < 1000 ) && xNameAccess->hasByName( aName ) );
+
+            if ( nTry == 1000 )
+            {
+                OSL_TRACE( "Unable to create unique internal name!" );
+                return false;
+            }
+
+            // Create / fill / insert / commit new key.
+
+            uno::Reference< lang::XSingleServiceFactory > xFac(
+                xNameAccess, uno::UNO_QUERY );
+
+            OSL_ENSURE( xFac.is(), "No factory!" );
+
+            uno::Reference< container::XNameReplace > xNameReplace(
+                xFac->createInstance(), uno::UNO_QUERY );
+
+            OSL_ENSURE( xNameReplace.is(), "No name replace!" );
+
+            // Set Title value.
+            xNameReplace->replaceByName(
+                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
+                uno::makeAny( rPlace.getTitle() ) );
+
+            // Set TargetURL value.
+            xNameReplace->replaceByName(
+                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ) ),
+                uno::makeAny( rPlace.getTargetURL() ) );
+
+            // Set Type value. (link : 0, folder : 1 )
+            xNameReplace->replaceByName(
+                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Type" ) ),
+                uno::makeAny( rPlace.isLink() ? sal_Int32( 0 ) : sal_Int32( 1 ) ) );
+
+            // Set ReadOnly value.
+            xNameReplace->replaceByName(
+                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReadOnly" ) ),
+                uno::makeAny( rPlace.queryReadOnly() ) );
+
+            // Set QuickHelp value.
+            xNameReplace->replaceByName(
+                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "QuickHelp" ) ),
+                uno::makeAny( rPlace.queryQuickHelpText() ) );
+
+            // Set Icon value.
+            xNameReplace->replaceByName(
+                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Icon" ) ),
+                uno::makeAny( rPlace.queryIconURL() ) );
+
+            uno::Reference< container::XNameContainer > xContainer(
+                xFac, uno::UNO_QUERY );
+
+            OSL_ENSURE( xContainer.is(), "No container!" );
+
+            xContainer->insertByName( aName, uno::makeAny( xNameReplace ) );
+
+            // Commit changes.
+            xBatch->commitChanges();
+
+            rtl::OUString aInternalPath( m_aInternalPath );
+            aInternalPath += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Children/" ) );
+            aInternalPath += aName;
+            aInternalPath += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+
+            rtl::OUString aExternalPath( m_aExternalPath );
+            aExternalPath += /*rtl::Uri::encode( */aName/*,
+                                               rtl_UriCharClassPchar,
+                                               rtl_UriEncodeIgnoreEscapes,
+                                               RTL_TEXTENCODING_UTF8 )*/;
+            aExternalPath += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+
+            if ( rPlace.m_pData )
+            {
+                delete rPlace.m_pData;
+                rPlace.m_pData = 0;
+
+                rPlace.m_xHierNameAccess = m_xHierNameAccess;
+                rPlace.m_aInternalPath   = aInternalPath;
+                rPlace.m_aExternalPath   = aExternalPath;
+            }
+            return true;
+        }
+    }
+    catch ( lang::IllegalArgumentException const & )
+    {
+        // replaceByName, insertByName
+
+        OSL_TRACE( "Caught IllegalArgumentException!" );
+    }
+    catch ( container::NoSuchElementException const & )
+    {
+        // replaceByName, getByName
+
+        OSL_TRACE( "Caught NoSuchElementException!" );
+    }
+    catch ( container::ElementExistException const & )
+    {
+        // insertByName
+
+        OSL_TRACE( "Caught ElementExistException!" );
+    }
+    catch ( lang::WrappedTargetException const & )
+    {
+        // replaceByName, insertByName, getByName, commitChanges
+
+        OSL_TRACE( "Caught WrappedTargetException!" );
+    }
+    catch ( uno::Exception const & )
+    {
+        // createInstance, createInstanceWithArguments
+
+        OSL_TRACE( "Caught Exception!" );
+    }
+
+    return false; // error_general
+}
 
 void Place::init() const
 {
             {
                 xReadAccess->getByHierarchicalName(
                     rtl::OUString(
-                        RTL_CONSTASCII_USTRINGPARAM( ( "['Places']" ) ) ) )
+                        RTL_CONSTASCII_USTRINGPARAM( ( "Places" ) ) ) )
                 >>= m_xHierNameAccess;
             }
         }

fpicker/source/office/place.hxx

 
 namespace com { namespace sun { namespace star {
       namespace lang {
-        class XMultiServiceFactory;
+          class XMultiServiceFactory;
       }
       namespace container {
           class XHierarchicalNameAccess;
 
 namespace fpicker { namespace office {
 
+struct PlaceData;
+
 class Place
 {
 public:
-    // ctor for root place
+    // ctor for root folder place
     explicit Place( const com::sun::star::uno::Reference<
                         com::sun::star::lang::XMultiServiceFactory > & xSMgr );
+
+    // ctor for places to be added via addChild()
+    Place( const com::sun::star::uno::Reference<
+               com::sun::star::lang::XMultiServiceFactory > & xSMgr,
+           const rtl::OUString & rTitle,
+           const rtl::OUString & rTargetURL,
+           bool bReadOnly = false,
+           bool bFolder = false,
+           const rtl::OUString & rIconURL = rtl::OUString(),
+           const rtl::OUString & rQuickHelpText = rtl::OUString() );
+
     Place( const Place & rOther );
 
     ~Place();
     // mandatory (must not be empty).
     rtl::OUString getTitle() const;
 
+    // folders can have children (other folder/link places)
     bool isFolder() const;
     std::vector< Place > getChildren() const;
 
+    // links have no children, but a target url
     bool isLink() const;
     rtl::OUString getTargetURL() const;
 
     rtl::OUString queryIconURL() const;
     rtl::OUString queryQuickHelpText() const;
-
     bool queryReadOnly() const;
 
     rtl::OUString getHierarchyURL() const;
 
+    bool addChild( const Place & rPlace );
+
 private:
     mutable osl::Mutex m_aMutex;
     com::sun::star::uno::Reference<
         com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
     mutable com::sun::star::uno::Reference<
         com::sun::star::container::XHierarchicalNameAccess > m_xHierNameAccess;
-    rtl::OUString m_aInternalPath;
-    rtl::OUString m_aExternalPath;
+    mutable rtl::OUString m_aInternalPath;
+    mutable rtl::OUString m_aExternalPath;
+    mutable PlaceData * m_pData;
 
     Place( const com::sun::star::uno::Reference<
                com::sun::star::lang::XMultiServiceFactory > & xSMgr,

fpicker/source/office/placeswin.cxx

 
 #include "placeswin.hxx"
 #include "place.hxx"
+#include "fporesid.hxx"
 
 #include "osl/process.h"
-#include "rtl/instance.hxx"
 #include "comphelper/processfactory.hxx"
 #include "unotools/localfilehelper.hxx"
 #include "unotools/pathoptions.hxx"
 
 namespace
 {
-    struct ResMgrHolder
-    {
-        ResMgr * operator ()()
-        {
-            return ResMgr::CreateResMgr(
-                CREATEVERSIONRESMGR_NAME( fps_office ) );
-        }
-
-        static ResMgr * getOrCreate()
-        {
-            return rtl_Instance<
-                ResMgr, ResMgrHolder,
-                osl::MutexGuard, osl::GetGlobalMutex >::create(
-                    ResMgrHolder(), osl::GetGlobalMutex() );
-        }
-    };
-
-    struct SvtResId : public ResId
-    {
-        SvtResId ( sal_uInt16 nId )
-        : ResId ( nId, *ResMgrHolder::getOrCreate() ) {}
-    };
-
     void scaleImage( const Size aTargetSize, Image& rImage )
     {
         if ( rImage.GetSizePixel() != aTargetSize )
     m_aIconCtrl.SetSelectionMode( SINGLE_SELECTION );
     m_aIconCtrl.Show();
 
-    sal_Bool bHiContrast
+    bool bHiContrast
         = GetSettings().GetStyleSettings().GetHighContrastMode();
-    const ImageList aImages( SvtResId( bHiContrast
+    const ImageList aImages( FpoResId( bHiContrast
                                        ? RID_FILEPICKER_IMAGES_HC
                                        : RID_FILEPICKER_IMAGES ) );
     Image aFolderImage( aImages.GetImage( IMG_FILEDLG_PLACES_FOLDER ) );
     scaleImage( aIconSize, aFolderImage );
     scaleImage( aIconSize, aLinkImage );
 
-    const SvtPathOptions aPathOpts;
-
     //--------------------------------------------------------------------------
     // Process places provided via Configuration entries (the normal way).
     //--------------------------------------------------------------------------
 
-    const Place aRootPlace( ::comphelper::getProcessServiceFactory() );
+    const SvtPathOptions aPathOpts;
+
+    Place aRootPlace( ::comphelper::getProcessServiceFactory() );
     const std::vector< Place > aChilderen = aRootPlace.getChildren();
 
     std::vector< Place >::const_iterator it = aChilderen.begin();
     sal_Int32 nInsertPos = 0;
     while ( it != end )
     {
-        String aPlaceURL;
-        bool bFolder = (*it).isFolder();
-        if ( bFolder )
-        {
-            aPlaceURL = String( (*it).getHierarchyURL() );
-        }
-        else
-        {
-            // Target URL (mandatory for links.)
-            //bool bLink = (*it).isLink();
-            aPlaceURL = String( (*it).getTargetURL() );
-
-            // TargetURL may contain a reference to the Office installation
-            // directory. To ensure a relocatable office installation, the path
-            // to the office installtion directory must never be stored
-            // directly. A placeholder is used instead. Replace it by actual
-            // installation directory.
-            if ( aPlaceURL.Len() )
-                aPlaceURL = aPathOpts.SubstituteVariable( aPlaceURL );
-        }
-
-        // Ignore duplicates and forbidden URLs.
-        if ( !getEntry( aPlaceURL ) &&
-             !m_pUrlFilter || m_pUrlFilter->isUrlAllowed( aPlaceURL ) )
-        {
-            const String aTitle( (*it).getTitle() );
-
-            // QuickHelp text (optional).
-            const String aQuickHelp( (*it).queryQuickHelpText() );
-
-            // Icon (optional)
-            const String aIconURL(
-                aPathOpts.SubstituteVariable( String( (*it).queryIconURL() ) ) );
-
-            Image aImage;
-            if ( !aIconURL.Len() ||
-                 !getImageFromURL( aIconURL, aIconSize, aImage, bHiContrast ) )
-                aImage = bFolder ? aFolderImage : aLinkImage;
-
-            // ReadOnly mode (optional)
-            //bool bReadOnly = (*it).queryReadOnly();
-
-            SvxIconChoiceCtrlEntry* pEntry =
-                m_aIconCtrl.InsertEntry( aTitle, aImage, nInsertPos );
-            pEntry->SetUserData( new String ( aPlaceURL ) );
-            pEntry->SetQuickHelpText( aQuickHelp );
-            m_aIconCtrl.SetEntryTextMode( IcnShowTextFull, pEntry );
-
+        if ( addEntry( nInsertPos,
+                       *it,
+                       aPathOpts,
+                       aIconSize,
+                       bHiContrast,
+                       aFolderImage,
+                       aLinkImage ) )
             nInsertPos++;
-        }
         it++;
     }
 
     return false;
 }
 
+bool PlacesWindow::AddPlace( const String & rTitle,
+                             const String & rTargetURL,
+                             bool bReadOnly /*= false*/,
+                             bool bFolder /*= false*/,
+                             const String & rIconURL /*= rtl::OUString()*/,
+                             const String & rQuickHelpText /*= rtl::OUString()*/ )
+{
+    Place aNewPlace( ::comphelper::getProcessServiceFactory(),
+                     rTitle,
+                     rTargetURL,
+                     bReadOnly,
+                     bFolder,
+                     rIconURL,
+                     rQuickHelpText );
+    Place aRootPlace( ::comphelper::getProcessServiceFactory() );
+    if ( aRootPlace.addChild( aNewPlace ) )
+        return addEntry( MENU_APPEND, aNewPlace );
+
+    return false;
+}
+
 void PlacesWindow::initHeaderbar( const String& rTitle )
 {
     m_pHeaderBar = new HeaderBar( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
     m_pHeaderBar->Show();
 }
 
+bool PlacesWindow::addEntry( sal_Int32 nInsertPos,
+                             const Place & rPlace,
+                             const SvtPathOptions & rPathOpts,
+                             const Size & rIconSize,
+                             bool bHiContrast,
+                             const Image & rFolderImage,
+                             const Image & /*rLinkImage*/ )
+{
+    String aPlaceURL;
+    if ( rPlace.isFolder() )
+    {
+        aPlaceURL = String( rPlace.getHierarchyURL() );
+    }
+    else
+    {
+        // Target URL (mandatory for links.)
+        //bool bLink = rPlace.isLink();
+        aPlaceURL = String( rPlace.getTargetURL() );
+
+        // TargetURL may contain a reference to the Office installation
+        // directory. To ensure a relocatable office installation, the path
+        // to the office installtion directory must never be stored
+        // directly. A placeholder is used instead. Replace it by actual
+        // installation directory.
+        if ( aPlaceURL.Len() )
+            aPlaceURL = rPathOpts.SubstituteVariable( aPlaceURL );
+    }
+
+    // Ignore duplicates and forbidden URLs.
+    if ( !getEntry( aPlaceURL ) &&
+         !m_pUrlFilter || m_pUrlFilter->isUrlAllowed( aPlaceURL ) )
+    {
+        const String aTitle( rPlace.getTitle() );
+
+        // QuickHelp text (optional).
+        const String aQuickHelp( rPlace.queryQuickHelpText() );
+
+        // Icon (optional)
+        const String aIconURL(
+            rPathOpts.SubstituteVariable( String( rPlace.queryIconURL() ) ) );
+
+        Image aImage;
+        if ( !aIconURL.Len() ||
+             !getImageFromIconURL( aIconURL, rIconSize, aImage, bHiContrast ) )
+            aImage = /*rPlace.isFolder() ?*/ rFolderImage /*: rLinkImage*/;
+
+        // ReadOnly mode (optional)
+        //bool bReadOnly = rPlace.queryReadOnly();
+
+        SvxIconChoiceCtrlEntry* pEntry =
+            m_aIconCtrl.InsertEntry( aTitle, aImage, nInsertPos );
+        pEntry->SetUserData( new String ( aPlaceURL ) );
+        pEntry->SetQuickHelpText( aQuickHelp );
+        m_aIconCtrl.SetEntryTextMode( IcnShowTextFull, pEntry );
+
+        return true;
+    }
+    return false;
+}
+
+bool PlacesWindow::addEntry( sal_Int32 nInsertPos, const Place & rPlace )
+{
+    const SvtPathOptions aPathOpts;
+    const Size aIconSize( 16, 16 );
+    bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+    const ImageList aImages( FpoResId( bHiContrast
+                                       ? RID_FILEPICKER_IMAGES_HC
+                                       : RID_FILEPICKER_IMAGES ) );
+    Image aFolderImage( aImages.GetImage( IMG_FILEDLG_PLACES_FOLDER ) );
+    Image aLinkImage( aImages.GetImage( IMG_FILEDLG_PLACES_LINK ) );
+    return addEntry( nInsertPos,
+                     rPlace,