Kaydet (Commit) 8b124ceb authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

Improve gallery look for small width (Sidebar)

* Remove the path column in details view
* Only show the theme name next to the view switch buttons
* Only show the horizontal scrollbar when necessary

Change-Id: Ia3f5d854217e883275b1a7056489dba9fac6aabb
üst 62a6a7d7
...@@ -956,33 +956,8 @@ void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId ) ...@@ -956,33 +956,8 @@ void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId )
void GalleryBrowser2::ImplUpdateInfoBar() void GalleryBrowser2::ImplUpdateInfoBar()
{ {
OUString aInfoText;
if( mpCurTheme ) if( mpCurTheme )
{ maInfoBar.SetText( mpCurTheme->GetName() );
Point aSelPos;
const sal_uIntPtr nItemId = ImplGetSelectedItemId( NULL, aSelPos );
if( nItemId )
{
const sal_uIntPtr nPos = nItemId - 1;
aInfoText = mpCurTheme->GetName();
if( nPos < mpCurTheme->GetObjectCount() )
{
SgaObject* pObj = mpCurTheme->AcquireObject( nPos );
if( pObj )
{
aInfoText = GetItemText( *mpCurTheme, *pObj, GALLERY_ITEM_THEMENAME | GALLERY_ITEM_TITLE | GALLERY_ITEM_PATH );
mpCurTheme->ReleaseObject( pObj );
}
}
}
}
maInfoBar.SetText( aInfoText );
} }
sal_uIntPtr GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& rSelPos ) sal_uIntPtr GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& rSelPos )
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#define GALLERY_BRWBOX_TITLE 1 #define GALLERY_BRWBOX_TITLE 1
#define GALLERY_BRWBOX_PATH 2
GalleryPreview::GalleryPreview(Window* pParent, WinBits nStyle, GalleryTheme* pTheme) GalleryPreview::GalleryPreview(Window* pParent, WinBits nStyle, GalleryTheme* pTheme)
: Window(pParent, nStyle) : Window(pParent, nStyle)
...@@ -527,10 +526,9 @@ GalleryListView::GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme ...@@ -527,10 +526,9 @@ GalleryListView::GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme
InitSettings(); InitSettings();
SetMode( BROWSER_AUTO_VSCROLL | BROWSER_AUTOSIZE_LASTCOL ); SetMode( BROWSER_AUTO_VSCROLL | BROWSER_AUTOSIZE_LASTCOL | BROWSER_AUTO_HSCROLL );
SetDataRowHeight( 28 ); SetDataRowHeight( 28 );
InsertDataColumn( GALLERY_BRWBOX_TITLE, GAL_RESSTR(RID_SVXSTR_GALLERY_TITLE), 256 ); InsertDataColumn( GALLERY_BRWBOX_TITLE, GAL_RESSTR(RID_SVXSTR_GALLERY_TITLE), 256 );
InsertDataColumn( GALLERY_BRWBOX_PATH, GAL_RESSTR(RID_SVXSTR_GALLERY_PATH), 256 );
} }
GalleryListView::~GalleryListView() GalleryListView::~GalleryListView()
...@@ -558,7 +556,7 @@ bool GalleryListView::SeekRow( long nRow ) ...@@ -558,7 +556,7 @@ bool GalleryListView::SeekRow( long nRow )
return true; return true;
} }
OUString GalleryListView::GetCellText(long _nRow, sal_uInt16 nColumnId) const OUString GalleryListView::GetCellText(long _nRow, sal_uInt16 /*nColumnId*/) const
{ {
OUString sRet; OUString sRet;
if( mpTheme && ( _nRow < static_cast< long >( mpTheme->GetObjectCount() ) ) ) if( mpTheme && ( _nRow < static_cast< long >( mpTheme->GetObjectCount() ) ) )
...@@ -567,9 +565,7 @@ OUString GalleryListView::GetCellText(long _nRow, sal_uInt16 nColumnId) const ...@@ -567,9 +565,7 @@ OUString GalleryListView::GetCellText(long _nRow, sal_uInt16 nColumnId) const
if( pObj ) if( pObj )
{ {
sRet = GalleryBrowser2::GetItemText( *mpTheme, *pObj, sRet = GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_TITLE );
( GALLERY_BRWBOX_TITLE == nColumnId ) ? GALLERY_ITEM_TITLE : GALLERY_ITEM_PATH );
mpTheme->ReleaseObject( pObj ); mpTheme->ReleaseObject( pObj );
} }
} }
...@@ -607,7 +603,7 @@ sal_Int32 GalleryListView::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColu ...@@ -607,7 +603,7 @@ sal_Int32 GalleryListView::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColu
return nRet; return nRet;
} }
void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 /*nColumnId*/ ) const
{ {
rDev.Push( PUSH_CLIPREGION ); rDev.Push( PUSH_CLIPREGION );
rDev.IntersectClipRegion( rRect ); rDev.IntersectClipRegion( rRect );
...@@ -624,20 +620,8 @@ void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sa ...@@ -624,20 +620,8 @@ void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sa
bool bNeedToCreate(aBitmapEx.IsEmpty()); bool bNeedToCreate(aBitmapEx.IsEmpty());
if(!bNeedToCreate && GALLERY_BRWBOX_TITLE == nColumnId && aItemTextTitle.isEmpty()) if(!bNeedToCreate && (aItemTextTitle.isEmpty() || aPreparedSize != aSize))
{
bNeedToCreate = true;
}
if(!bNeedToCreate && GALLERY_BRWBOX_PATH == nColumnId && aItemTextPath.isEmpty())
{
bNeedToCreate = true;
}
if(!bNeedToCreate && aPreparedSize != aSize)
{
bNeedToCreate = true; bNeedToCreate = true;
}
if(bNeedToCreate) if(bNeedToCreate)
{ {
...@@ -656,31 +640,24 @@ void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sa ...@@ -656,31 +640,24 @@ void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sa
const long nTextPosY(rRect.Top() + ((rRect.GetHeight() - rDev.GetTextHeight()) >> 1)); const long nTextPosY(rRect.Top() + ((rRect.GetHeight() - rDev.GetTextHeight()) >> 1));
if(GALLERY_BRWBOX_TITLE == nColumnId) if(!aBitmapEx.IsEmpty())
{ {
if(!aBitmapEx.IsEmpty()) const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel());
const Point aPos(
((aSize.Width() - aBitmapExSizePixel.Width()) >> 1) + rRect.Left(),
((aSize.Height() - aBitmapExSizePixel.Height()) >> 1) + rRect.Top());
if(aBitmapEx.IsTransparent())
{ {
const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel()); // draw checkered background
const Point aPos( drawTransparenceBackground(rDev, aPos, aBitmapExSizePixel);
((aSize.Width() - aBitmapExSizePixel.Width()) >> 1) + rRect.Left(),
((aSize.Height() - aBitmapExSizePixel.Height()) >> 1) + rRect.Top());
if(aBitmapEx.IsTransparent())
{
// draw checkered background
drawTransparenceBackground(rDev, aPos, aBitmapExSizePixel);
}
rDev.DrawBitmapEx(aPos, aBitmapEx);
} }
rDev.DrawText(Point(rRect.Left() + rRect.GetHeight() + 6, nTextPosY), aItemTextTitle); rDev.DrawBitmapEx(aPos, aBitmapEx);
}
else if(GALLERY_BRWBOX_PATH == nColumnId)
{
rDev.DrawText(Point(rRect.Left(), nTextPosY), aItemTextPath);
} }
rDev.DrawText(Point(rRect.Left() + rRect.GetHeight() + 6, nTextPosY), aItemTextTitle);
//SgaObject* pObj = mpTheme->AcquireObject( mnCurRow ); //SgaObject* pObj = mpTheme->AcquireObject( mnCurRow );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment