[Libreoffice-commits] .: Branch 'libreoffice-3-4' - svtools/inc svtools/source

Petr Mladek pmladek at kemper.freedesktop.org
Wed Apr 27 06:11:36 PDT 2011


 svtools/inc/svtools/fileview.hxx   |    4 ++++
 svtools/source/contnr/fileview.cxx |   24 ++++++++++++++++++------
 svtools/source/contnr/templwin.cxx |   12 +++++++++---
 3 files changed, 31 insertions(+), 9 deletions(-)

New commits:
commit bfc7756f1024ad1c0cc010c6b8486b8d457f45c8
Author: Radek Doulik <rodo at novell.com>
Date:   Wed Apr 27 15:09:42 2011 +0200

    svtools-unsort-template-dialogentries.diff: grouping items in templates dialog
    
    group entries in the "Documents and Templates dialog" (bnc#106603)

diff --git a/svtools/inc/svtools/fileview.hxx b/svtools/inc/svtools/fileview.hxx
index e248de4..b3678d7 100644
--- a/svtools/inc/svtools/fileview.hxx
+++ b/svtools/inc/svtools/fileview.hxx
@@ -47,6 +47,7 @@
 #define FILEVIEW_SHOW_SIZE			0x0020
 #define FILEVIEW_SHOW_DATE			0x0040
 #define FILEVIEW_SHOW_ALL			0x0070
+#define FILEVIEW_SHOW_NONE			0x00A0
 
 class ViewTabListBox_Impl;
 class SvtFileView_Impl;
@@ -80,6 +81,7 @@ class SVT_DLLPUBLIC SvtFileView : public Control
 {
 private:
     SvtFileView_Impl*       mpImp;
+    sal_Bool 				bSortColumn;
     
     ::com::sun::star::uno::Sequence< ::rtl::OUString > mpBlackList;
 
@@ -108,6 +110,8 @@ public:
     void					SetSizePixel( const Size& rNewSize );
     using Window::SetPosSizePixel;
     virtual void			SetPosSizePixel( const Point& rNewPos, const Size& rNewSize );
+    void					SetSortColumn( sal_Bool bValue ) { bSortColumn = bValue; }
+    sal_Bool				GetSortColumn() { return bSortColumn; }
 
     /** initialize the view with the content of a folder given by URL, and aply an immediate filter
 
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index b0d92e3..1cdf90c 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -98,6 +98,8 @@ using ::rtl::OUString;
 #define COLUMN_SIZE         3
 #define COLUMN_DATE         4
 
+#define aSeparatorStr  "----------------------------------"
+
 #define ROW_HEIGHT                17    // the height of a row has to be a little higher than the bitmap
 #define QUICK_SEARCH_TIMEOUT    1500    // time in mSec before the quicksearch string will be reseted
 
@@ -724,6 +726,7 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParentWin,
     mbEnableRename      ( sal_True )
 
 {
+    sal_Bool bViewHeader = true;
     Size aBoxSize = pParentWin->GetSizePixel();
     mpHeaderBar = new HeaderBar( pParentWin, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
     mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), mpHeaderBar->CalcWindowSizePixel() );
@@ -736,6 +739,8 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParentWin,
         mpHeaderBar->InsertItem( COLUMN_SIZE, String( SvtResId( STR_SVT_FILEVIEW_COLUMN_SIZE ) ), 80, nBits );
         mpHeaderBar->InsertItem( COLUMN_DATE, String( SvtResId( STR_SVT_FILEVIEW_COLUMN_DATE ) ), 500, nBits );
     }
+    if( ( nFlags & FILEVIEW_SHOW_NONE ) == FILEVIEW_SHOW_NONE )
+        bViewHeader = false;
     else
         mpHeaderBar->InsertItem( COLUMN_TITLE, String( SvtResId( STR_SVT_FILEVIEW_COLUMN_TITLE ) ), 600, nBits );
 
@@ -747,7 +752,8 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParentWin,
     SetEntryHeight( ROW_HEIGHT );
 
     Show();
-    mpHeaderBar->Show();
+    if( bViewHeader )
+        mpHeaderBar->Show();
 
     maResetQuickSearch.SetTimeout( QUICK_SEARCH_TIMEOUT );
     maResetQuickSearch.SetTimeoutHdl( LINK( this, ViewTabListBox_Impl, ResetQuickSearch_Impl ) );
@@ -1219,6 +1225,7 @@ SvtFileView::SvtFileView( Window* pParent, const ResId& rResId,
 
     mpImp = new SvtFileView_Impl( this, xCmdEnv, nFlags, bOnlyFolder );
     mpImp->mpView->ForbidEmptyText();
+    SetSortColumn( true );
 
     long pTabs[] = { 5, 20, 180, 320, 400, 600 };
     mpImp->mpView->SetTabs( &pTabs[0], MAP_PIXEL );
@@ -1241,6 +1248,7 @@ SvtFileView::SvtFileView( Window* pParent, const ResId& rResId, sal_Int8 nFlags
     Reference < XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
     mpImp = new SvtFileView_Impl( this, xCmdEnv, nFlags,
                                   ( nFlags & FILEVIEW_ONLYFOLDER ) == FILEVIEW_ONLYFOLDER );
+    SetSortColumn( true );
 
     if ( ( nFlags & FILEVIEW_SHOW_ALL ) == FILEVIEW_SHOW_ALL )
     {
@@ -1254,7 +1262,8 @@ SvtFileView::SvtFileView( Window* pParent, const ResId& rResId, sal_Int8 nFlags
         long pTabs[] = { 2, 20, 600 };
         mpImp->mpView->SetTabs( &pTabs[0], MAP_PIXEL );
     }
-
+    if ( ( nFlags & FILEVIEW_SHOW_NONE ) == FILEVIEW_SHOW_NONE )
+        SetSortColumn( false );
     if ( ( nFlags & FILEVIEW_MULTISELECTION ) == FILEVIEW_MULTISELECTION )
         mpImp->mpView->SetSelectionMode( MULTIPLE_SELECTION );
 
@@ -1512,7 +1521,8 @@ sal_Bool SvtFileView::Initialize( const Sequence< OUString >& aContents )
 
     mpImp->Clear();
     mpImp->CreateVector_Impl( aContents );
-    mpImp->SortFolderContent_Impl();
+    if( GetSortColumn() )
+        mpImp->SortFolderContent_Impl();
 
     mpImp->OpenFolder_Impl();
 
@@ -2416,9 +2426,11 @@ void SvtFileView_Impl::CreateVector_Impl( const Sequence < OUString > &rList )
         pEntry->maDisplayText = aDisplayText;
 
         // detect the image
-        INetURLObject aObj( pEntry->maImageURL.getLength() ? pEntry->maImageURL : pEntry->maTargetURL );
-        pEntry->maImage = SvFileInformationManager::GetImage( aObj, sal_False );
-
+        if( aValue != rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(aSeparatorStr) ) )
+        {
+            INetURLObject aObj( pEntry->maImageURL.getLength() ? pEntry->maImageURL : pEntry->maTargetURL );
+            pEntry->maImage = SvFileInformationManager::GetImage( aObj, sal_False );
+        }
         maContent.push_back( pEntry );
     }
 }
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index 0c7948c..9691a4f 100644
--- a/svtools/source/contnr/templwin.cxx
+++ b/svtools/source/contnr/templwin.cxx
@@ -100,6 +100,7 @@ using namespace ::com::sun::star::view;
 using namespace svtools;
 
 extern ::rtl::OUString CreateExactSizeText_Impl( sal_Int64 nSize ); // fileview.cxx
+#define aSeparatorStr   "----------------------------------"
 
 #define SPLITSET_ID			0
 #define COLSET_ID			1
@@ -594,7 +595,7 @@ SvtFileViewWindow_Impl::SvtFileViewWindow_Impl( SvtTemplateWindow* pParent ) :
     Window( pParent, WB_DIALOGCONTROL | WB_TABSTOP | WB_BORDER | WB_3DLOOK ),
 
     rParent				( *pParent ),
-    aFileView			( this, SvtResId( CTRL_FILEVIEW ), FILEVIEW_SHOW_TITLE ),
+    aFileView			( this, SvtResId( CTRL_FILEVIEW ), FILEVIEW_SHOW_NONE ),
     bIsTemplateFolder	( sal_False )
 
 {
@@ -651,9 +652,14 @@ Sequence< ::rtl::OUString > SvtFileViewWindow_Impl::GetNewDocContents() const
     for ( i = 0; i < nCount; ++i )
     {
         GetMenuEntry_Impl( aDynamicMenuEntries[i], aTitle, aURL, aTargetFrame, aImageURL );
-
-        if ( aURL == sSeparator || aURL == sSlotURL )
+        if( aURL == sSlotURL )
             continue;
+        if( aURL == sSeparator )
+        {
+            String aSeparator( ASCII_STR( aSeparatorStr ) );
+            ::rtl::OUString* pSeparator = new ::rtl::OUString( aSeparator );
+            aNewDocs.push_back( pSeparator );
+        }
         else
         {
             // title


More information about the Libreoffice-commits mailing list