summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <s.mehrbrodt@gmail.com>2014-09-21 23:21:37 +0200
committerSamuel Mehrbrodt <s.mehrbrodt@gmail.com>2014-09-21 23:24:13 +0200
commit8b124cebb1205639aeccaf0cf44b405be8a4e59d (patch)
tree7d1f9e77882b2691545d1da4f16851903ca2f82b
parent62a6a7d7d711209caf1237b0955e24a61b7bb21d (diff)
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
-rw-r--r--svx/source/gallery2/galbrws2.cxx27
-rw-r--r--svx/source/gallery2/galctrl.cxx57
2 files changed, 18 insertions, 66 deletions
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index c70f39ed5134..bf2da8b6bb2a 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -956,33 +956,8 @@ void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId )
void GalleryBrowser2::ImplUpdateInfoBar()
{
- OUString aInfoText;
-
if( mpCurTheme )
- {
- 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 );
+ maInfoBar.SetText( mpCurTheme->GetName() );
}
sal_uIntPtr GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& rSelPos )
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
index 3543bc848b32..90be8c179ce1 100644
--- a/svx/source/gallery2/galctrl.cxx
+++ b/svx/source/gallery2/galctrl.cxx
@@ -36,7 +36,6 @@
#include <vcl/settings.hxx>
#define GALLERY_BRWBOX_TITLE 1
-#define GALLERY_BRWBOX_PATH 2
GalleryPreview::GalleryPreview(Window* pParent, WinBits nStyle, GalleryTheme* pTheme)
: Window(pParent, nStyle)
@@ -527,10 +526,9 @@ GalleryListView::GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme
InitSettings();
- SetMode( BROWSER_AUTO_VSCROLL | BROWSER_AUTOSIZE_LASTCOL );
+ SetMode( BROWSER_AUTO_VSCROLL | BROWSER_AUTOSIZE_LASTCOL | BROWSER_AUTO_HSCROLL );
SetDataRowHeight( 28 );
InsertDataColumn( GALLERY_BRWBOX_TITLE, GAL_RESSTR(RID_SVXSTR_GALLERY_TITLE), 256 );
- InsertDataColumn( GALLERY_BRWBOX_PATH, GAL_RESSTR(RID_SVXSTR_GALLERY_PATH), 256 );
}
GalleryListView::~GalleryListView()
@@ -558,7 +556,7 @@ bool GalleryListView::SeekRow( long nRow )
return true;
}
-OUString GalleryListView::GetCellText(long _nRow, sal_uInt16 nColumnId) const
+OUString GalleryListView::GetCellText(long _nRow, sal_uInt16 /*nColumnId*/) const
{
OUString sRet;
if( mpTheme && ( _nRow < static_cast< long >( mpTheme->GetObjectCount() ) ) )
@@ -567,9 +565,7 @@ OUString GalleryListView::GetCellText(long _nRow, sal_uInt16 nColumnId) const
if( pObj )
{
- sRet = GalleryBrowser2::GetItemText( *mpTheme, *pObj,
- ( GALLERY_BRWBOX_TITLE == nColumnId ) ? GALLERY_ITEM_TITLE : GALLERY_ITEM_PATH );
-
+ sRet = GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_TITLE );
mpTheme->ReleaseObject( pObj );
}
}
@@ -607,7 +603,7 @@ sal_Int32 GalleryListView::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColu
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.IntersectClipRegion( rRect );
@@ -624,20 +620,8 @@ void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sa
bool bNeedToCreate(aBitmapEx.IsEmpty());
- if(!bNeedToCreate && GALLERY_BRWBOX_TITLE == nColumnId && aItemTextTitle.isEmpty())
- {
- bNeedToCreate = true;
- }
-
- if(!bNeedToCreate && GALLERY_BRWBOX_PATH == nColumnId && aItemTextPath.isEmpty())
- {
- bNeedToCreate = true;
- }
-
- if(!bNeedToCreate && aPreparedSize != aSize)
- {
+ if(!bNeedToCreate && (aItemTextTitle.isEmpty() || aPreparedSize != aSize))
bNeedToCreate = true;
- }
if(bNeedToCreate)
{
@@ -656,31 +640,24 @@ void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sa
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());
- const Point aPos(
- ((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);
+ // draw checkered background
+ drawTransparenceBackground(rDev, aPos, aBitmapExSizePixel);
}
- rDev.DrawText(Point(rRect.Left() + rRect.GetHeight() + 6, nTextPosY), aItemTextTitle);
- }
- else if(GALLERY_BRWBOX_PATH == nColumnId)
- {
- rDev.DrawText(Point(rRect.Left(), nTextPosY), aItemTextPath);
+ rDev.DrawBitmapEx(aPos, aBitmapEx);
}
+ rDev.DrawText(Point(rRect.Left() + rRect.GetHeight() + 6, nTextPosY), aItemTextTitle);
+
//SgaObject* pObj = mpTheme->AcquireObject( mnCurRow );