diff options
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 2 | ||||
-rw-r--r-- | include/sfx2/templatedefaultview.hxx | 31 | ||||
-rw-r--r-- | sfx2/Library_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/source/control/templatecontaineritem.cxx | 15 | ||||
-rw-r--r-- | sfx2/source/control/templatedefaultview.cxx | 42 | ||||
-rw-r--r-- | sfx2/source/control/templateviewitem.cxx | 15 | ||||
-rw-r--r-- | sfx2/source/dialog/backingwindow.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/backingwindow.hxx | 4 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/startcenter.ui | 2 |
9 files changed, 107 insertions, 11 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 12ff8b404250..98e5e2679fb9 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -755,7 +755,7 @@ <glade-widget-class title="Recent Documents View" name="sfxlo-RecentDocsView" generic-name="Icon View" parent="GtkIconView" icon-name="widget-gtk-iconview"/> - <glade-widget-class title="Template Thumbnail View" name="sfxlo-TemplateLocalView" + <glade-widget-class title="Template Thumbnail View" name="sfxlo-TemplateDefaultView" generic-name="Template Icon View" parent="GtkIconView" icon-name="widget-gtk-iconview"/> <glade-widget-class title="Template Search View" name="sfxlo-TemplateSearchView" diff --git a/include/sfx2/templatedefaultview.hxx b/include/sfx2/templatedefaultview.hxx new file mode 100644 index 000000000000..005201b364d7 --- /dev/null +++ b/include/sfx2/templatedefaultview.hxx @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SFX2_TEMPLATEDEFAULTVIEW_HXX +#define INCLUDED_SFX2_TEMPLATEDEFAULTVIEW_HXX + +#include <sfx2/templatelocalview.hxx> +#include <sfx2/recentdocsviewitem.hxx> + +class SFX2_DLLPUBLIC TemplateDefaultView : public TemplateLocalView +{ +public: + TemplateDefaultView(Window *pParent); + virtual ~TemplateDefaultView(); + + virtual void reload() SAL_OVERRIDE; +protected: + long mnItemMaxSize; + long mnTextHeight; + long mnItemPadding; + size_t mnLastMouseDownItem; +}; + +#endif // INCLUDED_SFX2_TEMPLATEDEFAULTVIEW_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 998dc63a033e..ae85eaaf37f2 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -148,6 +148,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/control/sorgitm \ sfx2/source/control/statcach \ sfx2/source/control/templateabstractview \ + sfx2/source/control/templatedefaultview \ sfx2/source/control/templateviewitem \ sfx2/source/control/templatelocalview \ sfx2/source/control/templatecontaineritem \ diff --git a/sfx2/source/control/templatecontaineritem.cxx b/sfx2/source/control/templatecontaineritem.cxx index 2ad7b9f3e7ee..d16cb69ff683 100644 --- a/sfx2/source/control/templatecontaineritem.cxx +++ b/sfx2/source/control/templatecontaineritem.cxx @@ -22,6 +22,7 @@ #include <sfx2/templateviewitem.hxx> #include <vcl/button.hxx> #include <vcl/graph.hxx> +#include <svtools/optionsdrawinglayer.hxx> using namespace basegfx; using namespace basegfx::tools; @@ -67,14 +68,24 @@ void TemplateContainerItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p BColor aFillColor = pAttrs->aFillColor; drawinglayer::primitive2d::Primitive2DSequence aSeq(nSeqSize); + double fTransparence = 0.0; // Draw background if ( mbSelected || mbHover ) aFillColor = pAttrs->aHighlightColor; - aSeq[nCount++] = drawinglayer::primitive2d::Primitive2DReference( new PolyPolygonColorPrimitive2D( + if (mbHover) + { + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + fTransparence = aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01; + } + + aSeq[nCount++] = drawinglayer::primitive2d::Primitive2DReference( new PolyPolygonSelectionPrimitive2D( B2DPolyPolygon(Polygon(maDrawArea,5,5).getB2DPolygon()), - aFillColor)); + aFillColor, + fTransparence, + 0.0, + true)); // Create rounded rectangle border aSeq[nCount++] = drawinglayer::primitive2d::Primitive2DReference( new PolygonStrokePrimitive2D( diff --git a/sfx2/source/control/templatedefaultview.cxx b/sfx2/source/control/templatedefaultview.cxx new file mode 100644 index 000000000000..9e2f83a14378 --- /dev/null +++ b/sfx2/source/control/templatedefaultview.cxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sfx2/templatedefaultview.hxx> +#include <sfx2/thumbnailview.hxx> +#include <vcl/builder.hxx> +#include <sfx2/app.hxx> + +extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTemplateDefaultView(vcl::Window *pParent, VclBuilder::stringmap &) +{ + return new TemplateDefaultView(pParent); +} + +TemplateDefaultView::TemplateDefaultView( Window* pParent) + : TemplateLocalView(pParent) + , mnTextHeight(30) + , mnItemPadding(5) + , mnLastMouseDownItem( THUMBNAILVIEW_ITEM_NOTFOUND ) +{ + Rectangle aScreen = Application::GetScreenPosSizePixel(Application::GetDisplayBuiltInScreen()); + mnItemMaxSize = std::min(aScreen.GetWidth(),aScreen.GetHeight()) > 800 ? 256 : 192; + ThumbnailView::setItemDimensions( mnItemMaxSize, mnItemMaxSize, mnTextHeight, mnItemPadding ); +} + +TemplateDefaultView::~TemplateDefaultView() +{ +} + +void TemplateDefaultView::reload() +{ + TemplateLocalView::reload(); + // Set preferred width + set_width_request(mnTextHeight + mnItemMaxSize + 2*mnItemPadding); + +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/templateviewitem.cxx b/sfx2/source/control/templateviewitem.cxx index c8e65a54542d..c2ce8d224447 100644 --- a/sfx2/source/control/templateviewitem.cxx +++ b/sfx2/source/control/templateviewitem.cxx @@ -20,6 +20,7 @@ #include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <vcl/button.hxx> #include <vcl/graph.hxx> +#include <svtools/optionsdrawinglayer.hxx> #define SUBTITLE_SCALE_FACTOR 0.85 @@ -70,14 +71,24 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces int nCount = maSubTitle.isEmpty() ? 5 : 6; drawinglayer::primitive2d::Primitive2DSequence aSeq(nCount); + double fTransparence = 0.0; // Draw background if ( mbSelected || mbHover ) aFillColor = pAttrs->aHighlightColor; - aSeq[0] = drawinglayer::primitive2d::Primitive2DReference( new PolyPolygonColorPrimitive2D( + if(mbHover) + { + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + fTransparence = aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01; + } + + aSeq[0] = drawinglayer::primitive2d::Primitive2DReference( new PolyPolygonSelectionPrimitive2D( B2DPolyPolygon(Polygon(maDrawArea,5,5).getB2DPolygon()), - aFillColor)); + aFillColor, + fTransparence, + 0.0, + true)); // Draw thumbnail Size aImageSize = maPreview1.GetSizePixel(); diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 39061f5bc384..c31839e4c522 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -257,14 +257,12 @@ void BackingWindow::initControls() //initialize Template view mpLocalView->SetStyle( mpLocalView->GetStyle() | WB_VSCROLL); - mpLocalView->setItemDimensions(TEMPLATE_ITEM_MAX_WIDTH,TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT, - TEMPLATE_ITEM_MAX_HEIGHT-TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT, - TEMPLATE_ITEM_PADDING); mpLocalView->Populate(); mpLocalView->showRootRegion(); mpLocalView->Hide(); mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); + mpCurrentView = mpLocalView; mpTemplateButton->SetMenuMode( MENUBUTTON_MENUMODE_TIMED ); @@ -550,6 +548,7 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) mpAllRecentThumbnails->Hide(); mpCurrentView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); mpLocalView->Show(); + mpLocalView->reload(); } return 0; } @@ -589,6 +588,7 @@ IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton ) mpAllRecentThumbnails->Hide(); mpLocalView->Show(); + mpLocalView->reload(); return 0; } diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx index 15df736c9fb9..72c8a676d67f 100644 --- a/sfx2/source/dialog/backingwindow.hxx +++ b/sfx2/source/dialog/backingwindow.hxx @@ -30,7 +30,7 @@ #include <vcl/menubtn.hxx> #include <sfx2/recentdocsview.hxx> -#include <sfx2/templatelocalview.hxx> +#include <sfx2/templatedefaultview.hxx> #include <sfx2/templateabstractview.hxx> #include <sfx2/templateviewitem.hxx> @@ -85,7 +85,7 @@ class BackingWindow VclBox* mpExtensionsBox; RecentDocsView* mpAllRecentThumbnails; - TemplateLocalView* mpLocalView; + TemplateDefaultView* mpLocalView; TemplateAbstractView* mpCurrentView; std::vector<vcl::Window*> maDndWindows; diff --git a/sfx2/uiconfig/ui/startcenter.ui b/sfx2/uiconfig/ui/startcenter.ui index c6190589483a..e23d8f8231ac 100644 --- a/sfx2/uiconfig/ui/startcenter.ui +++ b/sfx2/uiconfig/ui/startcenter.ui @@ -402,7 +402,7 @@ </packing> </child> <child> - <object class="sfxlo-TemplateLocalView" id="local_view"> + <object class="sfxlo-TemplateDefaultView" id="local_view"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="margin">0</property> |