New Template Manager

1. Save Mode removed from Template Manager
2. Context Menu for TemplateViewItems (Handled from LocalView for Local Repos)
3. 'showAllTemplates()' replacing 'showRootRegion()'
4. Filter Combobox for templates (Remembers filters also)
5. Search Filter (Synchronized with Filter ComboBoxes)
6. Removed Tabs from Template Manager
7. Removed Buttons from TemplateAbstractView
8. Unused GtkToolButtons removed
9. PushButtons in UI
10. Modal dialog for Import and Move (Works from "All Categories" now too)
11. ContextMenu for TemplateSearchView
12. Delete Categories(Folder) in Settings Menu
13. Save As Template Dialog

Change-Id: I88f6568c35271c17dbd7e6877d50119a8cfe4d60
Reviewed-on: https://gerrit.libreoffice.org/24545
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
Akshay Deep
2016-05-01 13:05:00 +05:30
committed by Samuel Mehrbrodt
parent 365c4d8c60
commit ca040d16d0
22 changed files with 1784 additions and 1387 deletions

View File

@@ -0,0 +1,68 @@
/* -*- 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_INC_SAVEASTEMPLATEDLG_HXX
#define INCLUDED_SFX2_INC_SAVEASTEMPLATEDLG_HXX
#include <sal/config.h>
#include <sfx2/dllapi.h>
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
class Edit;
class ListBox;
class SfxDocumentTemplates;
// class SfxSaveAsTemplateDialog -------------------------------------------------------------------
class SFX2_DLLPUBLIC SfxSaveAsTemplateDialog : public ModalDialog
{
private:
VclPtr<ListBox> mpLBCategory;
VclPtr<Edit> mpTemplateNameEdit;
VclPtr<PushButton> mpOKButton;
OUString msSelectedCategory;
OUString msTemplateName;
sal_uInt16 mnRegionPos;
std::vector<OUString> msCategories;
SfxDocumentTemplates *mpDocTemplates;
css::uno::Reference< css::frame::XModel > m_xModel;
public:
DECL_LINK_TYPED(OkClickHdl, Button*, void);
DECL_LINK_TYPED(TemplateNameEditHdl, Edit&, void);
DECL_LINK_TYPED(SelectCategoryHdl, ListBox&, void);
void setDocumentModel (const css::uno::Reference<css::frame::XModel> &rModel);
void initialize();
void SetCategoryLBEntries(std::vector<OUString> names);
/*Check whether template name is unique or not in a region*/
bool IsTemplateNameUnique();
bool SaveTemplate();
public:
explicit SfxSaveAsTemplateDialog(vcl::Window *parent = nullptr);
virtual ~SfxSaveAsTemplateDialog();
virtual void dispose() override;
};
#endif // INCLUDED_SFX2_INC_SAVEASTEMPLATEDLG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -30,6 +30,7 @@
#define TEMPLATE_THUMBNAIL_MAX_WIDTH TEMPLATE_ITEM_MAX_WIDTH - 2*TEMPLATE_ITEM_PADDING
class SfxDocumentTemplates;
class TemplateViewItem;
enum class FILTER_APPLICATION
{
@@ -81,18 +82,14 @@ public:
virtual void reload () { }
virtual void showRootRegion () = 0;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual void showAllTemplates () = 0;
virtual void showRegion (ThumbnailViewItem *pItem) = 0;
virtual sal_uInt16 createRegion (const OUString &rName) = 0;
// Return if we can have regions inside the current region
virtual bool isNestedRegionAllowed () const = 0;
// Return if we can import templates to the current region
virtual bool isImportAllowed () const = 0;
sal_uInt16 getCurRegionId () const { return mnCurRegionId;}
const OUString& getCurRegionName () const { return maCurRegionName;}
@@ -102,8 +99,16 @@ public:
void setOpenRegionHdl(const Link<void*,void> &rLink);
void setRightClickHdl(const Link<ThumbnailViewItem*,void> &rLink);
void setOpenTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
void setEditTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
void setDeleteTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
void setDefaultTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
void updateThumbnailDimensions(long itemMaxSize);
long getThumbnailWidth() const { return mnThumbnailWidth;}
@@ -117,25 +122,26 @@ public:
protected:
DECL_LINK_TYPED(ShowRootRegionHdl, Button*, void);
virtual void OnItemDblClicked(ThumbnailViewItem *pItem) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override;
protected:
sal_uInt16 mnCurRegionId;
OUString maCurRegionName;
TemplateViewItem *maSelectedItem;
long mnThumbnailWidth;
long mnThumbnailHeight;
VclPtr<PushButton> maAllButton;
VclPtr<FixedText> maFTName;
Point maPosition;
Link<void*,void> maOpenRegionHdl;
Link<ThumbnailViewItem*,void> maRightClickHdl;
Link<ThumbnailViewItem*,void> maOpenTemplateHdl;
Link<ThumbnailViewItem*,void> maEditTemplateHdl;
Link<ThumbnailViewItem*,void> maDeleteTemplateHdl;
Link<ThumbnailViewItem*,void> maDefaultTemplateHdl;
};
#endif // INCLUDED_SFX2_TEMPLATEABSTRACTVIEW_HXX

View File

@@ -17,8 +17,6 @@
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
#include <com/sun/star/frame/XDesktop2.hpp>
#include <sfx2/templateabstractview.hxx>
@@ -52,55 +50,55 @@ public:
virtual ~SfxTemplateManagerDlg();
virtual void dispose() override;
void setSaveMode();
void setDocumentModel (const css::uno::Reference<css::frame::XModel> &rModel);
DECL_LINK_TYPED(ActivatePageHdl, TabControl*, void);
private:
void readSettings ();
void writeSettings ();
DECL_LINK_TYPED(TBXViewHdl, ToolBox*, void);
DECL_LINK_TYPED(TBXActionHdl, ToolBox*, void);
DECL_LINK_TYPED(TBXTemplateHdl, ToolBox*, void);
void fillFolderComboBox();
DECL_LINK_TYPED(TBXDropdownHdl, ToolBox*, void);
DECL_LINK_TYPED(SelectApplicationHdl, ListBox&, void);
DECL_LINK_TYPED(SelectRegionHdl, ListBox&, void);
DECL_LINK_TYPED(OkClickHdl, Button*, void);
DECL_LINK_TYPED(MoveClickHdl, Button*, void);
DECL_LINK_TYPED(ExportClickHdl, Button*, void);
DECL_LINK_TYPED(ImportClickHdl, Button*, void);
DECL_LINK_TYPED(LinkClickHdl, Button*, void);
DECL_LINK_TYPED(TVItemStateHdl, const ThumbnailViewItem*, void);
DECL_LINK_TYPED(MenuSelectHdl, Menu*, bool);
DECL_LINK_TYPED(MoveMenuSelectHdl, Menu*, bool);
DECL_LINK_TYPED(RepositoryMenuSelectHdl, Menu*, bool);
DECL_LINK_TYPED(DefaultTemplateMenuSelectHdl, Menu*, bool);
DECL_LINK_TYPED(OpenRegionHdl, void*, void);
DECL_LINK_TYPED(RightClickHdl, ThumbnailViewItem*, void);
DECL_LINK_TYPED(OpenTemplateHdl, ThumbnailViewItem*, void);
DECL_LINK_TYPED(EditTemplateHdl, ThumbnailViewItem*, void);
DECL_LINK_TYPED(DeleteTemplateHdl, ThumbnailViewItem*, void);
DECL_LINK_TYPED(DefaultTemplateHdl, ThumbnailViewItem*, void);
DECL_LINK_TYPED(SearchUpdateHdl, Edit&, void);
void OnTemplateImport ();
void OnTemplateSearch ();
void OnTemplateImportCategory(OUString sCategory);
static void OnTemplateLink ();
void OnTemplateOpen ();
void OnTemplateEdit ();
void OnTemplateDelete ();
void OnTemplateAsDefault ();
void OnTemplateExport ();
void OnTemplateState (const ThumbnailViewItem *pItem);
void OnFolderNew ();
void OnFolderDelete ();
void OnCategoryNew ();
void OnCategoryDelete();
void OnRegionState (const ThumbnailViewItem *pItem);
void OnRepositoryDelete ();
void OnTemplateSaveAs ();
void createRepositoryMenu ();
@@ -138,18 +136,22 @@ private:
void syncRepositories () const;
/// Return filter according to the currently selected tab page.
FILTER_APPLICATION getCurrentFilter();
/// Return filter according to the currently selected application filter.
FILTER_APPLICATION getCurrentApplicationFilter();
private:
VclPtr<TabControl> mpTabControl;
VclPtr<Edit> mpSearchFilter;
VclPtr<ListBox> mpCBApp;
VclPtr<ListBox> mpCBFolder;
VclPtr<Edit> mpSearchEdit;
VclPtr<PushButton> mpOKButton;
VclPtr<PushButton> mpMoveButton;
VclPtr<PushButton> mpExportButton;
VclPtr<PushButton> mpImportButton;
VclPtr<PushButton> mpLinkButton;
VclPtr<ToolBox> mpViewBar;
VclPtr<ToolBox> mpActionBar;
VclPtr<ToolBox> mpTemplateBar;
VclPtr<TemplateSearchView> mpSearchView;
VclPtr<TemplateAbstractView> mpCurView;
VclPtr<TemplateLocalView> mpLocalView;
@@ -159,9 +161,7 @@ private:
PopupMenu *mpTemplateDefaultMenu;
std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelTemplates;
std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelFolders;
bool mbIsSaveMode; ///< Flag that indicates if we are in save mode or not.
css::uno::Reference< css::frame::XModel > m_xModel;
css::uno::Reference< css::frame::XDesktop2 > mxDesktop;
@@ -169,6 +169,48 @@ private:
std::vector<TemplateRepository*> maRepositories; ///< Stores the remote repositories for templates
};
// class SfxTemplateCategoryDialog -------------------------------------------------------------------
class SFX2_DLLPUBLIC SfxTemplateCategoryDialog : public ModalDialog
{
private:
VclPtr<ListBox> mpLBCategory;
VclPtr<FixedText> mpSelectLabel;
VclPtr<Edit> mpNewCategoryEdit;
VclPtr<FixedText> mpCreateLabel;
VclPtr<PushButton> mpOKButton;
OUString msSelectedCategory;
bool mbIsNewCategory;
public:
DECL_LINK_TYPED(NewCategoryEditHdl, Edit&, void);
DECL_LINK_TYPED(SelectCategoryHdl, ListBox&, void);
void SetCategoryLBEntries(std::vector<OUString> names);
void HideNewCategoryOption();
inline OUString GetSelectedCategory() const {
return msSelectedCategory;
};
inline void SetSelectLabelText(OUString sText) const {
mpSelectLabel->SetText(sText);
};
inline bool IsNewCategoryCreated() const {
return mbIsNewCategory;
}
public:
explicit SfxTemplateCategoryDialog(vcl::Window *parent = nullptr);
virtual ~SfxTemplateCategoryDialog();
virtual void dispose() override;
};
#endif // INCLUDED_SFX2_INC_TEMPLATEDLG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -17,6 +17,7 @@
class SfxDocumentTemplates;
class TemplateContainerItem;
class PopupMenu;
namespace com {
namespace sun { namespace star { namespace frame {
@@ -40,16 +41,24 @@ public:
virtual void reload () override;
virtual void showRootRegion () override;
virtual void showAllTemplates () override;
virtual void showRegion (ThumbnailViewItem *pItem) override;
void showRegion (const OUString &rName);
void createContextMenu();
DECL_LINK_TYPED(ContextMenuSelectHdl, Menu*, bool);
sal_uInt16 getCurRegionItemId () const;
ThumbnailViewItem* getRegion(OUString sStr);
sal_uInt16 getRegionId (size_t pos) const;
sal_uInt16 getRegionId (OUString sRegionName) const;
OUString getRegionName(const sal_uInt16 nRegionId) const;
OUString getRegionItemName(const sal_uInt16 nItemId) const;
@@ -61,10 +70,6 @@ public:
virtual sal_uInt16 createRegion (const OUString &rName) override;
virtual bool isNestedRegionAllowed () const override;
virtual bool isImportAllowed () const override;
bool removeRegion (const sal_uInt16 nItemId);
bool removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId);
@@ -83,22 +88,13 @@ public:
bool exportTo (const sal_uInt16 nItemId, const sal_uInt16 nRegionItemId, const OUString &rName);
bool saveTemplateAs (sal_uInt16 nItemId,
css::uno::Reference<css::frame::XModel> &rModel,
const OUString &rName);
bool saveTemplateAs (TemplateContainerItem *pDstItem,
css::uno::Reference<css::frame::XModel> &rModel,
const OUString &rName);
bool isTemplateNameUnique (const sal_uInt16 nRegionItemId, const OUString &rName) const;
virtual bool renameItem(ThumbnailViewItem* pItem, const OUString& sNewTitle) override;
private:
SfxDocumentTemplates *mpDocTemplates;
std::vector<TemplateContainerItem* > maRegions;
std::vector<TemplateItemProperties > maAllTemplates;
};
#endif // INCLUDED_SFX2_TEMPLATELOCALVIEW_HXX

View File

@@ -23,7 +23,7 @@ public:
TemplateRemoteView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
virtual void showRootRegion () override;
virtual void showAllTemplates () override;
virtual void showRegion (ThumbnailViewItem *pItem) override;
@@ -31,10 +31,6 @@ public:
virtual sal_uInt16 createRegion (const OUString &rName) override;
virtual bool isNestedRegionAllowed () const override;
virtual bool isImportAllowed () const override;
private:
css::uno::Reference< css::ucb::XCommandEnvironment > m_xCmdEnv;

View File

@@ -233,6 +233,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/doc/syspath \
sfx2/source/doc/zoomitem \
sfx2/source/doc/templatedlg \
sfx2/source/doc/saveastemplatedlg \
sfx2/source/explorer/nochaos \
sfx2/source/inet/inettbc \
sfx2/source/notebookbar/SfxNotebookBar \

View File

@@ -44,6 +44,8 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
sfx2/uiconfig/ui/singletabdialog \
sfx2/uiconfig/ui/startcenter \
sfx2/uiconfig/ui/templatedlg \
sfx2/uiconfig/ui/saveastemplatedlg \
sfx2/uiconfig/ui/templatecategorydlg \
sfx2/uiconfig/ui/versionsofdialog \
sfx2/uiconfig/ui/versioncommentdialog \
sfx2/uiconfig/ui/versionscmis \

View File

@@ -10,9 +10,9 @@
#include <sfx2/templateabstractview.hxx>
#include <comphelper/processfactory.hxx>
#include <sfx2/sfxresid.hxx>
#include <sfx2/templatecontaineritem.hxx>
#include <sfx2/templateviewitem.hxx>
#include <sfx2/sfxresid.hxx>
#include <tools/urlobj.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <vcl/pngread.hxx>
@@ -71,80 +71,27 @@ bool ViewFilter_Application::operator () (const ThumbnailViewItem *pItem)
if (pTempItem)
return isValid(pTempItem->getPath());
TemplateContainerItem *pContainerItem = const_cast<TemplateContainerItem*>(dynamic_cast<const TemplateContainerItem*>(pItem));
if (pContainerItem)
{
std::vector<TemplateItemProperties> &rTemplates = pContainerItem->maTemplates;
size_t nVisCount = 0;
// Clear thumbnails
pContainerItem->maPreview1.Clear();
pContainerItem->maPreview2.Clear();
pContainerItem->maPreview3.Clear();
pContainerItem->maPreview4.Clear();
for (size_t i = 0, n = rTemplates.size(); i < n && pContainerItem->HasMissingPreview(); ++i)
{
if (isValid(rTemplates[i].aPath))
{
++nVisCount;
if ( pContainerItem->maPreview1.IsEmpty( ) )
{
pContainerItem->maPreview1 = TemplateAbstractView::scaleImg(rTemplates[i].aThumbnail,
TEMPLATE_THUMBNAIL_MAX_WIDTH*0.75,
TEMPLATE_THUMBNAIL_MAX_HEIGHT*0.75);
}
else if ( pContainerItem->maPreview2.IsEmpty() )
{
pContainerItem->maPreview2 = TemplateAbstractView::scaleImg(rTemplates[i].aThumbnail,
TEMPLATE_THUMBNAIL_MAX_WIDTH*0.75,
TEMPLATE_THUMBNAIL_MAX_HEIGHT*0.75);
}
else if ( pContainerItem->maPreview3.IsEmpty() )
{
pContainerItem->maPreview3 = TemplateAbstractView::scaleImg(rTemplates[i].aThumbnail,
TEMPLATE_THUMBNAIL_MAX_WIDTH*0.75,
TEMPLATE_THUMBNAIL_MAX_HEIGHT*0.75);
}
else if ( pContainerItem->maPreview4.IsEmpty() )
{
pContainerItem->maPreview4 = TemplateAbstractView::scaleImg(rTemplates[i].aThumbnail,
TEMPLATE_THUMBNAIL_MAX_WIDTH*0.75,
TEMPLATE_THUMBNAIL_MAX_HEIGHT*0.75);
}
}
}
}
return true;
}
TemplateAbstractView::TemplateAbstractView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren)
: ThumbnailView(pParent,nWinStyle,bDisableTransientChildren),
mnCurRegionId(0),
maSelectedItem(nullptr),
mnThumbnailWidth(TEMPLATE_THUMBNAIL_MAX_WIDTH),
mnThumbnailHeight(TEMPLATE_THUMBNAIL_MAX_HEIGHT),
maAllButton(VclPtr<PushButton>::Create(this, SfxResId(BTN_ALL_TEMPLATES))),
maFTName(VclPtr<FixedText>::Create(this, SfxResId(FT_NAME)))
maPosition(0,0)
{
maAllButton->Hide();
maAllButton->SetStyle(maAllButton->GetStyle() | WB_FLATBUTTON);
maAllButton->SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
maFTName->Hide();
}
TemplateAbstractView::TemplateAbstractView(vcl::Window *pParent)
: ThumbnailView(pParent),
mnCurRegionId(0),
maSelectedItem(nullptr),
mnThumbnailWidth(TEMPLATE_THUMBNAIL_MAX_WIDTH),
mnThumbnailHeight(TEMPLATE_THUMBNAIL_MAX_HEIGHT),
maAllButton(VclPtr<PushButton>::Create(this, SfxResId(BTN_ALL_TEMPLATES))),
maFTName(VclPtr<FixedText>::Create(this, SfxResId(FT_NAME)))
maPosition(0,0)
{
maAllButton->Hide();
maAllButton->SetStyle(maAllButton->GetStyle() | WB_FLATBUTTON);
maAllButton->SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
maFTName->Hide();
}
TemplateAbstractView::~TemplateAbstractView()
@@ -154,8 +101,6 @@ TemplateAbstractView::~TemplateAbstractView()
void TemplateAbstractView::dispose()
{
maAllButton.disposeAndClear();
maFTName.disposeAndClear();
ThumbnailView::dispose();
}
@@ -187,7 +132,6 @@ void TemplateAbstractView::insertItems(const std::vector<TemplateItemProperties>
std::vector<ThumbnailViewItem*> aItems(rTemplates.size());
for (size_t i = 0, n = rTemplates.size(); i < n; ++i )
{
//TODO: CHECK IF THE ITEM IS A FOLDER OR NOT
const TemplateItemProperties *pCur = &rTemplates[i];
TemplateViewItem *pChild = new TemplateViewItem(*this, pCur->nId);
@@ -215,16 +159,58 @@ void TemplateAbstractView::updateThumbnailDimensions(long itemMaxSize)
mnThumbnailHeight = itemMaxSize;
}
void TemplateAbstractView::MouseButtonDown( const MouseEvent& rMEvt )
{
if (rMEvt.IsRight())
{
size_t nPos = ImplGetItem(rMEvt.GetPosPixel());
Point aPosition (rMEvt.GetPosPixel());
maPosition = aPosition;
ThumbnailViewItem* pItem = ImplGetItem(nPos);
const TemplateViewItem *pViewItem = dynamic_cast<const TemplateViewItem*>(pItem);
if(pViewItem)
{
maSelectedItem = dynamic_cast<TemplateViewItem*>(pItem);
maRightClickHdl.Call(pItem);
}
}
ThumbnailView::MouseButtonDown(rMEvt);
}
void TemplateAbstractView::setOpenRegionHdl(const Link<void*,void> &rLink)
{
maOpenRegionHdl = rLink;
}
void TemplateAbstractView::setRightClickHdl(const Link<ThumbnailViewItem*,void> &rLink)
{
maRightClickHdl = rLink;
}
void TemplateAbstractView::setOpenTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink)
{
maOpenTemplateHdl = rLink;
}
void TemplateAbstractView::setEditTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink)
{
maEditTemplateHdl = rLink;
}
void TemplateAbstractView::setDeleteTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink)
{
maDeleteTemplateHdl = rLink;
}
void TemplateAbstractView::setDefaultTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink)
{
maDefaultTemplateHdl = rLink;
}
BitmapEx TemplateAbstractView::scaleImg (const BitmapEx &rImg, long width, long height)
{
BitmapEx aImg = rImg;
@@ -271,11 +257,6 @@ BitmapEx TemplateAbstractView::fetchThumbnail (const OUString &msURL, long width
return TemplateAbstractView::scaleImg(ThumbnailView::readThumbnail(msURL), width, height);
}
IMPL_LINK_NOARG_TYPED(TemplateAbstractView, ShowRootRegionHdl, Button*, void)
{
showRootRegion();
}
void TemplateAbstractView::OnItemDblClicked (ThumbnailViewItem *pItem)
{
//Check if the item is a TemplateContainerItem (Folder) or a TemplateViewItem (File)
@@ -284,10 +265,8 @@ void TemplateAbstractView::OnItemDblClicked (ThumbnailViewItem *pItem)
if ( pContainerItem )
{
// Fill templates
mnCurRegionId = pContainerItem->mnRegionId+1;
maCurRegionName = pContainerItem->maTitle;
maFTName->SetText(maCurRegionName);
showRegion(pItem);
}
else
@@ -296,24 +275,4 @@ void TemplateAbstractView::OnItemDblClicked (ThumbnailViewItem *pItem)
}
}
void TemplateAbstractView::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
{
ThumbnailView::Paint(rRenderContext, rRect);
Rectangle aRect(rRect.TopLeft(),
Point(rRect.BottomRight().X(),
mnHeaderHeight));
drawinglayer::primitive2d::Primitive2DContainer aSeq(1);
aSeq[0] = drawinglayer::primitive2d::Primitive2DReference(
new PolyPolygonColorPrimitive2D(B2DPolyPolygon(::tools::Polygon(aRect).getB2DPolygon()),
maFillColor.getBColor()));
const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(rRenderContext, aNewViewInfos));
pProcessor->process(aSeq);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -19,7 +19,7 @@ VCL_BUILDER_FACTORY(TemplateDefaultView)
TemplateDefaultView::TemplateDefaultView( Window* pParent)
: TemplateLocalView(pParent)
, mnTextHeight(30)
, mnItemPadding(5)
, mnItemPadding(5)//TODO:: Change padding to 10. It looks really crowded and occupied.
{
Rectangle aScreen = Application::GetScreenPosSizePixel(Application::GetDisplayBuiltInScreen());
mnItemMaxSize = std::min(aScreen.GetWidth(),aScreen.GetHeight()) > 800 ? 256 : 192;
@@ -32,18 +32,6 @@ TemplateDefaultView::TemplateDefaultView( Window* pParent)
maHighlightColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightColor::get());
maHighlightTextColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightTextColor::get());
mfHighlightTransparence = 0.25;
maAllButton->SetControlForeground(maTextColor);
maFTName->SetControlForeground(maTextColor);
// TODO - convert the TemplateAbstractView to .ui (instead of fixed layout
// of the button and the fixed text), and do the following:
// const float fMultiplier = 1.4;
// vcl::Font aFont(maAllButton->GetSettings().GetStyleSettings().GetPushButtonFont());
// aFont.SetSize(Size(0, aFont.GetSize().Height() * fMultiplier));
// maAllButton->SetControlFont(aFont);
// maFTName->SetControlFont(aFont);
}
void TemplateDefaultView::reload()

View File

@@ -10,7 +10,10 @@
#include <sfx2/templatelocalview.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <sfx2/doctempl.hxx>
#include <sfx2/inputdlg.hxx>
#include <sfx2/sfxresid.hxx>
#include <sfx2/templatecontaineritem.hxx>
#include <sfx2/templateviewitem.hxx>
#include <svl/inettype.hxx>
@@ -27,11 +30,17 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include "../doc/doc.hrc"
#define MNI_OPEN 1
#define MNI_EDIT 2
#define MNI_DEFAULT_TEMPLATE 3
#define MNI_DELETE 4
#define MNI_RENAME 5
using namespace ::com::sun::star;
using namespace ::com::sun::star::frame;
static void lcl_updateThumbnails (TemplateContainerItem *pItem);
TemplateLocalView::TemplateLocalView ( vcl::Window* pParent)
: TemplateAbstractView(pParent),
mpDocTemplates(new SfxDocumentTemplates)
@@ -52,6 +61,8 @@ void TemplateLocalView::dispose()
maRegions.clear();
maAllTemplates.clear();
delete mpDocTemplates;
TemplateAbstractView::dispose();
}
@@ -63,6 +74,8 @@ void TemplateLocalView::Populate ()
maRegions.clear();
maAllTemplates.clear();
sal_uInt16 nCount = mpDocTemplates->GetRegionCount();
for (sal_uInt16 i = 0; i < nCount; ++i)
{
@@ -91,10 +104,9 @@ void TemplateLocalView::Populate ()
getThumbnailHeight());
pItem->maTemplates.push_back(aProperties);
maAllTemplates.push_back(aProperties);
}
lcl_updateThumbnails(pItem);
maRegions.push_back(pItem);
}
}
@@ -120,44 +132,25 @@ void TemplateLocalView::reload ()
}
}
else
showRootRegion();
showAllTemplates();
//No items should be selected by default
deselectItems();
}
void TemplateLocalView::showRootRegion()
void TemplateLocalView::showAllTemplates()
{
mnHeaderHeight = 0;
mnCurRegionId = 0;
maCurRegionName.clear();
// Clone root region items so they don't get invalidated when we open another region
std::vector<ThumbnailViewItem*> items(maRegions.size());
for (int i = 0, n = maRegions.size(); i < n; ++i)
{
TemplateContainerItem *pCur = maRegions[i];
TemplateContainerItem *pItem = new TemplateContainerItem(*this, pCur->mnId);
pItem->mnRegionId = pCur->mnRegionId;
pItem->maTitle = pCur->maTitle;
pItem->maTemplates = pCur->maTemplates;
items[i] = pItem;
}
maAllButton->Show(false);
maFTName->Show(false);
updateItems(items);
insertItems(maAllTemplates);
maOpenRegionHdl.Call(nullptr);
}
void TemplateLocalView::showRegion(ThumbnailViewItem *pItem)
{
mnHeaderHeight = maAllButton->GetSizePixel().getHeight() + maAllButton->GetPosPixel().Y() * 2;
mnCurRegionId = static_cast<TemplateContainerItem*>(pItem)->mnRegionId+1;
maCurRegionName = pItem->maTitle;
maAllButton->Show();
maFTName->Show();
insertItems(reinterpret_cast<TemplateContainerItem*>(pItem)->maTemplates);
@@ -170,13 +163,81 @@ void TemplateLocalView::showRegion(const OUString &rName)
{
if (pRegion->maTitle == rName)
{
maFTName->SetText(rName);
showRegion(pRegion);
break;
}
}
}
ThumbnailViewItem* TemplateLocalView::getRegion(OUString rName)
{
for (TemplateContainerItem* pRegion : maRegions)
if (pRegion->maTitle == rName)
return pRegion;
return nullptr;
}
void TemplateLocalView::createContextMenu()
{
std::unique_ptr<PopupMenu> pItemMenu(new PopupMenu);
pItemMenu->InsertItem(MNI_OPEN,SfxResId(STR_OPEN).toString());
pItemMenu->InsertItem(MNI_EDIT,SfxResId(STR_EDIT_TEMPLATE).toString());
pItemMenu->InsertItem(MNI_DEFAULT_TEMPLATE,SfxResId(STR_DEFAULT_TEMPLATE).toString());
pItemMenu->InsertSeparator();
pItemMenu->InsertItem(MNI_DELETE,SfxResId(STR_DELETE).toString());
pItemMenu->InsertItem(MNI_RENAME,SfxResId(STR_RENAME).toString());
pItemMenu->InsertSeparator();
deselectItems();
maSelectedItem->setSelection(true);
pItemMenu->SetSelectHdl(LINK(this, TemplateLocalView, ContextMenuSelectHdl));
pItemMenu->Execute(this, Rectangle(maPosition,Size(1,1)), PopupMenuFlags::ExecuteDown);
Invalidate();
}
IMPL_LINK_TYPED(TemplateLocalView, ContextMenuSelectHdl, Menu*, pMenu, bool)
{
sal_uInt16 nMenuId = pMenu->GetCurItemId();
switch(nMenuId)
{
case MNI_OPEN:
maOpenTemplateHdl.Call(maSelectedItem);
break;
case MNI_EDIT:
maEditTemplateHdl.Call(maSelectedItem);
break;
case MNI_DELETE:
maDeleteTemplateHdl.Call(maSelectedItem);
break;
case MNI_RENAME:
{
ScopedVclPtrInstance< InputDialog > m_pTitleEditDlg( SfxResId(STR_RENAME_TEMPLATE).toString(), this);
OUString sOldTitle = maSelectedItem->getHelpText();
m_pTitleEditDlg->SetEntryText( sOldTitle );
m_pTitleEditDlg->HideHelpBtn();
if(!m_pTitleEditDlg->Execute())
break;
OUString sNewTitle = comphelper::string::strip( m_pTitleEditDlg->GetEntryText(), ' ');
if ( !sNewTitle.isEmpty() && sNewTitle != sOldTitle )
{
maSelectedItem->setTitle(sNewTitle);
maSelectedItem->setEditTitle(true);
}
}
break;
case MNI_DEFAULT_TEMPLATE:
maDefaultTemplateHdl.Call(maSelectedItem);
break;
default:
break;
}
return false;
}
sal_uInt16 TemplateLocalView::getCurRegionItemId() const
{
for (TemplateContainerItem* pRegion : maRegions)
@@ -195,6 +256,17 @@ sal_uInt16 TemplateLocalView::getRegionId(size_t pos) const
return maRegions[pos]->mnId;
}
sal_uInt16 TemplateLocalView::getRegionId(OUString sRegion) const
{
for (TemplateContainerItem* pRegion : maRegions)
{
if (pRegion->maTitle == sRegion)
return pRegion->mnId;
}
return 0;
}
OUString TemplateLocalView::getRegionName(const sal_uInt16 nRegionId) const
{
return mpDocTemplates->GetRegionName(nRegionId);
@@ -279,16 +351,6 @@ sal_uInt16 TemplateLocalView::createRegion(const OUString &rName)
return pItem->mnId;
}
bool TemplateLocalView::isNestedRegionAllowed() const
{
return !mnCurRegionId;
}
bool TemplateLocalView::isImportAllowed() const
{
return mnCurRegionId;
}
bool TemplateLocalView::removeRegion(const sal_uInt16 nItemId)
{
sal_uInt16 nRegionId = USHRT_MAX;
@@ -364,10 +426,7 @@ bool TemplateLocalView::removeTemplate (const sal_uInt16 nItemId, const sal_uInt
}
}
lcl_updateThumbnails(pItem);
CalculateItemPositions();
break;
}
}
@@ -446,9 +505,6 @@ bool TemplateLocalView::moveTemplate (const ThumbnailViewItem *pItem, const sal_
}
}
lcl_updateThumbnails(pSrc);
lcl_updateThumbnails(pTarget);
CalculateItemPositions();
Invalidate();
@@ -461,12 +517,8 @@ bool TemplateLocalView::moveTemplate (const ThumbnailViewItem *pItem, const sal_
bool TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, selection_cmp_fn> &rItems,
const sal_uInt16 nTargetItem)
{
assert(mnCurRegionId); // Only allowed in non root regions
bool ret = true;
sal_uInt16 nSrcRegionId = mnCurRegionId-1;
TemplateContainerItem *pTarget = nullptr;
TemplateContainerItem *pSrc = nullptr;
@@ -474,11 +526,9 @@ bool TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
{
if (pRegion->mnId == nTargetItem)
pTarget = static_cast<TemplateContainerItem*>(pRegion);
else if (pRegion->mnRegionId == nSrcRegionId)
pSrc = static_cast<TemplateContainerItem*>(pRegion);
}
if (pTarget && pSrc)
if (pTarget)
{
bool refresh = false;
@@ -490,58 +540,68 @@ bool TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
for ( aSelIter = rItems.begin(); aSelIter != rItems.end(); ++aSelIter, ++nTargetIdx )
{
const TemplateViewItem *pViewItem = static_cast<const TemplateViewItem*>(*aSelIter);
sal_uInt16 nSrcRegionId = pViewItem->mnRegionId;
bool bCopy = !mpDocTemplates->Move(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnDocId);
if (bCopy)
for (TemplateContainerItem* pRegion : maRegions)
{
if (!mpDocTemplates->Copy(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnDocId))
{
ret = false;
continue;
}
if (pRegion->mnRegionId == nSrcRegionId)
pSrc = static_cast<TemplateContainerItem*>(pRegion);
}
// move template to destination
TemplateItemProperties aTemplateItem;
aTemplateItem.nId = nTargetIdx + 1;
aTemplateItem.nDocId = nTargetIdx;
aTemplateItem.nRegionId = nTargetRegion;
aTemplateItem.aName = pViewItem->maTitle;
aTemplateItem.aPath = mpDocTemplates->GetPath(nTargetRegion,nTargetIdx);
aTemplateItem.aThumbnail = pViewItem->maPreview1;
pTarget->maTemplates.push_back(aTemplateItem);
if (!bCopy)
if(pSrc)
{
// remove template from region cached data
bool bCopy = !mpDocTemplates->Move(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnDocId);
std::vector<TemplateItemProperties>::iterator pPropIter;
for (pPropIter = pSrc->maTemplates.begin(); pPropIter != pSrc->maTemplates.end();)
if (bCopy)
{
if (pPropIter->nDocId == pViewItem->mnDocId)
if (!mpDocTemplates->Copy(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnDocId))
{
pPropIter = pSrc->maTemplates.erase(pPropIter);
aItemIds.push_back(pViewItem->mnId);
}
else
{
// Keep region document id synchronized with SfxDocumentTemplates
if (pPropIter->nDocId > pViewItem->mnDocId)
--pPropIter->nDocId;
++pPropIter;
ret = false;
continue;
}
}
// Keep view document id synchronized with SfxDocumentTemplates
std::vector<ThumbnailViewItem*>::iterator pItemIter = mItemList.begin();
for (; pItemIter != mItemList.end(); ++pItemIter)
// move template to destination
TemplateItemProperties aTemplateItem;
aTemplateItem.nId = nTargetIdx + 1;
aTemplateItem.nDocId = nTargetIdx;
aTemplateItem.nRegionId = nTargetRegion;
aTemplateItem.aName = pViewItem->maTitle;
aTemplateItem.aPath = mpDocTemplates->GetPath(nTargetRegion,nTargetIdx);
aTemplateItem.aThumbnail = pViewItem->maPreview1;
pTarget->maTemplates.push_back(aTemplateItem);
if (!bCopy)
{
if (static_cast<TemplateViewItem*>(*pItemIter)->mnDocId > pViewItem->mnDocId)
--static_cast<TemplateViewItem*>(*pItemIter)->mnDocId;
// remove template from region cached data
std::vector<TemplateItemProperties>::iterator pPropIter;
for (pPropIter = pSrc->maTemplates.begin(); pPropIter != pSrc->maTemplates.end();)
{
if (pPropIter->nDocId == pViewItem->mnDocId)
{
pPropIter = pSrc->maTemplates.erase(pPropIter);
aItemIds.push_back(pViewItem->mnId);
}
else
{
// Keep region document id synchronized with SfxDocumentTemplates
if (pPropIter->nDocId > pViewItem->mnDocId)
--pPropIter->nDocId;
++pPropIter;
}
}
// Keep view document id synchronized with SfxDocumentTemplates
std::vector<ThumbnailViewItem*>::iterator pItemIter = mItemList.begin();
for (; pItemIter != mItemList.end(); ++pItemIter)
{
if (static_cast<TemplateViewItem*>(*pItemIter)->mnDocId > pViewItem->mnDocId)
--static_cast<TemplateViewItem*>(*pItemIter)->mnDocId;
}
}
}
@@ -554,9 +614,6 @@ bool TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
if (refresh)
{
lcl_updateThumbnails(pSrc);
lcl_updateThumbnails(pTarget);
CalculateItemPositions();
Invalidate();
}
@@ -604,8 +661,6 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx
pItem->maTemplates.push_back(aTemplate);
lcl_updateThumbnails(pItem);
return true;
}
@@ -680,8 +735,6 @@ bool TemplateLocalView::copyFrom (TemplateContainerItem *pItem, const OUString &
pItem->maTemplates.push_back(aTemplate);
lcl_updateThumbnails(pItem);
CalculateItemPositions();
return true;
@@ -715,107 +768,6 @@ bool TemplateLocalView::exportTo(const sal_uInt16 nItemId, const sal_uInt16 nReg
return false;
}
bool TemplateLocalView::saveTemplateAs (sal_uInt16 nItemId,
css::uno::Reference<css::frame::XModel> &rModel,
const OUString &rName)
{
for (TemplateContainerItem* pRegion : maRegions)
{
if (pRegion->mnId == nItemId)
{
uno::Reference< frame::XStorable > xStorable(rModel, uno::UNO_QUERY_THROW );
uno::Reference< frame::XDocumentTemplates > xTemplates(
frame::DocumentTemplates::create(comphelper::getProcessComponentContext()) );
if (!xTemplates->storeTemplate(mpDocTemplates->GetRegionName(pRegion->mnRegionId),rName, xStorable ))
return false;
sal_uInt16 nDocId = pRegion->maTemplates.size();
OUString aURL = mpDocTemplates->GetTemplateTargetURLFromComponent(mpDocTemplates->GetRegionName(pRegion->mnRegionId),rName);
if(!mpDocTemplates->InsertTemplate(pRegion->mnRegionId,nDocId,rName,aURL))
return false;
TemplateItemProperties aTemplate;
aTemplate.aIsFolder = false;
aTemplate.nId = getNextItemId();
aTemplate.nDocId = nDocId;
aTemplate.nRegionId = pRegion->mnRegionId;
aTemplate.aName = rName;
aTemplate.aThumbnail = TemplateAbstractView::fetchThumbnail(aURL,
TEMPLATE_THUMBNAIL_MAX_WIDTH,
TEMPLATE_THUMBNAIL_MAX_HEIGHT);
aTemplate.aPath = aURL;
pRegion->maTemplates.push_back(aTemplate);
insertItem(aTemplate);
return true;
}
}
return false;
}
bool TemplateLocalView::saveTemplateAs(TemplateContainerItem *pDstItem,
css::uno::Reference<css::frame::XModel> &rModel,
const OUString &rName)
{
uno::Reference< frame::XStorable > xStorable(rModel, uno::UNO_QUERY_THROW );
uno::Reference< frame::XDocumentTemplates > xTemplates(
frame::DocumentTemplates::create(comphelper::getProcessComponentContext()) );
if (!xTemplates->storeTemplate(mpDocTemplates->GetRegionName(pDstItem->mnRegionId),rName, xStorable ))
return false;
sal_uInt16 nDocId = pDstItem->maTemplates.size();
OUString aURL = mpDocTemplates->GetTemplateTargetURLFromComponent(mpDocTemplates->GetRegionName(pDstItem->mnRegionId),rName);
if(!mpDocTemplates->InsertTemplate(pDstItem->mnRegionId,nDocId,rName,aURL))
return false;
TemplateItemProperties aTemplate;
aTemplate.aIsFolder = false;
aTemplate.nId = pDstItem->maTemplates.empty() ? 1 : pDstItem->maTemplates.back().nId+1;
aTemplate.nDocId = nDocId;
aTemplate.nRegionId = pDstItem->mnRegionId;
aTemplate.aName = rName;
aTemplate.aThumbnail = TemplateAbstractView::fetchThumbnail(aURL,
TEMPLATE_THUMBNAIL_MAX_WIDTH,
TEMPLATE_THUMBNAIL_MAX_HEIGHT);
aTemplate.aPath = aURL;
pDstItem->maTemplates.push_back(aTemplate);
return true;
}
bool TemplateLocalView::isTemplateNameUnique(const sal_uInt16 nRegionItemId, const OUString &rName) const
{
for (const TemplateContainerItem* pRegItem : maRegions)
{
if (pRegItem->mnId == nRegionItemId)
{
std::vector<TemplateItemProperties>::const_iterator aIter;
for (aIter = pRegItem->maTemplates.begin(); aIter != pRegItem->maTemplates.end(); ++aIter)
{
if (aIter->aName == rName)
return false;
}
break;
}
}
return true;
}
bool TemplateLocalView::renameItem(ThumbnailViewItem* pItem, const OUString& sNewTitle)
{
sal_uInt16 nRegionId = 0;
@@ -834,41 +786,4 @@ bool TemplateLocalView::renameItem(ThumbnailViewItem* pItem, const OUString& sNe
return mpDocTemplates->SetName( sNewTitle, nRegionId, nDocId );
}
static void lcl_updateThumbnails (TemplateContainerItem *pItem)
{
pItem->maPreview1.Clear();
pItem->maPreview2.Clear();
pItem->maPreview3.Clear();
pItem->maPreview4.Clear();
// Update folder thumbnails
for (size_t i = 0, n = pItem->maTemplates.size(); i < n && pItem->HasMissingPreview(); ++i)
{
if ( pItem->maPreview1.IsEmpty( ) )
{
pItem->maPreview1 = TemplateAbstractView::scaleImg(pItem->maTemplates[i].aThumbnail,
TEMPLATE_THUMBNAIL_MAX_WIDTH*0.75,
TEMPLATE_THUMBNAIL_MAX_HEIGHT*0.75);
}
else if ( pItem->maPreview2.IsEmpty() )
{
pItem->maPreview2 = TemplateAbstractView::scaleImg(pItem->maTemplates[i].aThumbnail,
TEMPLATE_THUMBNAIL_MAX_WIDTH*0.75,
TEMPLATE_THUMBNAIL_MAX_HEIGHT*0.75);
}
else if ( pItem->maPreview3.IsEmpty() )
{
pItem->maPreview3 = TemplateAbstractView::scaleImg(pItem->maTemplates[i].aThumbnail,
TEMPLATE_THUMBNAIL_MAX_WIDTH*0.75,
TEMPLATE_THUMBNAIL_MAX_HEIGHT*0.75);
}
else if ( pItem->maPreview4.IsEmpty() )
{
pItem->maPreview4 = TemplateAbstractView::scaleImg(pItem->maTemplates[i].aThumbnail,
TEMPLATE_THUMBNAIL_MAX_WIDTH*0.75,
TEMPLATE_THUMBNAIL_MAX_HEIGHT*0.75);
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -60,12 +60,12 @@ VCL_BUILDER_DECL_FACTORY(TemplateRemoteView)
rRet = VclPtr<TemplateRemoteView>::Create(pParent, WB_VSCROLL, false);
}
void TemplateRemoteView::showRootRegion()
void TemplateRemoteView::showRegion(ThumbnailViewItem * /*pItem*/)
{
//TODO:
}
void TemplateRemoteView::showRegion(ThumbnailViewItem * /*pItem*/)
void TemplateRemoteView::showAllTemplates()
{
//TODO:
}
@@ -83,7 +83,6 @@ bool TemplateRemoteView::loadRepository (TemplateRepository* pItem)
mnCurRegionId = pItem->mnId;
maCurRegionName = pItem->maTitle;
maFTName->SetText(maCurRegionName);
OUString aURL = pItem->getURL();
@@ -172,14 +171,4 @@ sal_uInt16 TemplateRemoteView::createRegion(const OUString &/*rName*/)
return 0;
}
bool TemplateRemoteView::isNestedRegionAllowed() const
{
return true;
}
bool TemplateRemoteView::isImportAllowed() const
{
return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -9,21 +9,110 @@
#include "templatesearchview.hxx"
#include "templatesearchviewitem.hxx"
#include <sfx2/sfxresid.hxx>
#include "../doc/doc.hrc"
#include <vcl/builderfactory.hxx>
#define MNI_OPEN 1
#define MNI_EDIT 2
#define MNI_DEFAULT_TEMPLATE 3
#define MNI_DELETE 4
TemplateSearchView::TemplateSearchView (vcl::Window *pParent, WinBits nWinStyle)
: ThumbnailView(pParent,nWinStyle)
: ThumbnailView(pParent,nWinStyle),
maSelectedItem(nullptr),
maPosition(0,0)
{
}
VCL_BUILDER_FACTORY(TemplateSearchView)
void TemplateSearchView::MouseButtonDown( const MouseEvent& rMEvt )
{
if (rMEvt.IsRight())
{
size_t nPos = ImplGetItem(rMEvt.GetPosPixel());
Point aPosition (rMEvt.GetPosPixel());
maPosition = aPosition;
ThumbnailViewItem* pItem = ImplGetItem(nPos);
const TemplateViewItem *pViewItem = dynamic_cast<const TemplateViewItem*>(pItem);
if(pViewItem)
{
maSelectedItem = dynamic_cast<TemplateViewItem*>(pItem);
maRightClickHdl.Call(pItem);
}
}
ThumbnailView::MouseButtonDown(rMEvt);
}
void TemplateSearchView::createContextMenu()
{
std::unique_ptr<PopupMenu> pItemMenu(new PopupMenu);
pItemMenu->InsertItem(MNI_OPEN,SfxResId(STR_OPEN).toString());
pItemMenu->InsertItem(MNI_EDIT,SfxResId(STR_EDIT_TEMPLATE).toString());
pItemMenu->InsertItem(MNI_DEFAULT_TEMPLATE,SfxResId(STR_DEFAULT_TEMPLATE).toString());
pItemMenu->InsertSeparator();
pItemMenu->InsertItem(MNI_DELETE,SfxResId(STR_DELETE).toString());
maSelectedItem->setSelection(true);
pItemMenu->SetSelectHdl(LINK(this, TemplateSearchView, ContextMenuSelectHdl));
pItemMenu->Execute(this, Rectangle(maPosition,Size(1,1)), PopupMenuFlags::ExecuteDown);
Invalidate();
}
IMPL_LINK_TYPED(TemplateSearchView, ContextMenuSelectHdl, Menu*, pMenu, bool)
{
sal_uInt16 nMenuId = pMenu->GetCurItemId();
switch(nMenuId)
{
case MNI_OPEN:
maOpenTemplateHdl.Call(maSelectedItem);
break;
case MNI_EDIT:
maEditTemplateHdl.Call(maSelectedItem);
break;
case MNI_DELETE:
maDeleteTemplateHdl.Call(maSelectedItem);
break;
case MNI_DEFAULT_TEMPLATE:
maDefaultTemplateHdl.Call(maSelectedItem);
break;
default:
break;
}
return false;
}
void TemplateSearchView::setRightClickHdl(const Link<ThumbnailViewItem*,void> &rLink)
{
maRightClickHdl = rLink;
}
void TemplateSearchView::setOpenTemplateHdl(const Link<ThumbnailViewItem*, void> &rLink)
{
maOpenTemplateHdl = rLink;
}
void TemplateSearchView::setEditTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink)
{
maEditTemplateHdl = rLink;
}
void TemplateSearchView::setDeleteTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink)
{
maDeleteTemplateHdl = rLink;
}
void TemplateSearchView::setDefaultTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink)
{
maDefaultTemplateHdl = rLink;
}
void TemplateSearchView::OnItemDblClicked (ThumbnailViewItem *pItem)
{
maOpenTemplateHdl.Call(pItem);

View File

@@ -338,8 +338,8 @@ void BackingWindow::initializeLocalView()
{
mbLocalViewInitialized = true;
mpLocalView->Populate();
mpLocalView->showRootRegion();
mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::NONE));
mpLocalView->showAllTemplates();
}
}

View File

@@ -111,6 +111,20 @@
#define IMG_ACTION_SORT (RID_SFX_DOC_START+149)
#define IMG_ACTION_REFRESH (RID_SFX_DOC_START+150)
#define STR_OPEN (RID_SFX_DOC_START+151)
#define STR_EDIT_TEMPLATE (RID_SFX_DOC_START+152)
#define STR_DEFAULT_TEMPLATE (RID_SFX_DOC_START+153)
#define STR_RENAME (RID_SFX_DOC_START+154)
#define STR_DELETE (RID_SFX_DOC_START+155)
#define STR_PROPERTIES (RID_SFX_DOC_START+156)
#define STR_RENAME_TEMPLATE (RID_SFX_DOC_START+157)
#define STR_CATEGORY_NEW (RID_SFX_DOC_START+158)
#define STR_CATEGORY_SELECT (RID_SFX_DOC_START+100)
#define STR_CATEGORY_DELETE (RID_SFX_DOC_START+101)
#define STR_CREATE_ERROR (RID_SFX_DOC_START+103)
#define STR_ERROR_SAVEAS (RID_SFX_DOC_START+105)
// please update to the last id
#define ACT_SFX_DOC_END IMG_ACTION_REFRESH
#if ACT_SFX_DOC_END > RID_SFX_DOC_END

View File

@@ -48,10 +48,34 @@ String STR_CLOSEDOC_ANDRETURN
{
Text [ en-US ] = "~Close & Return to " ;
};
String STR_EDIT
String STR_OPEN
{
Text [ en-US ] = "Open" ;
};
String STR_EDIT_TEMPLATE
{
Text [ en-US ] = "Edit" ;
};
String STR_DEFAULT_TEMPLATE
{
Text [ en-US ] = "Set As Default" ;
};
String STR_DELETE
{
Text [ en-US ] = "Delete" ;
};
String STR_RENAME
{
Text [ en-US ] = "Rename" ;
};
String STR_PROPERTIES
{
Text [ en-US ] = "Properties" ;
};
String STR_RENAME_TEMPLATE
{
Text [ en-US ] = "Enter New Name: " ;
};
String STR_AUTOMATICVERSION
{
Text [ en-US ] = "Automatically saved version" ;
@@ -211,9 +235,34 @@ String STR_MOVE_NEW
Text [ en-US ] = "New folder";
};
String STR_CATEGORY_NEW
{
Text [ en-US ] = "New Category";
};
String STR_CATEGORY_DELETE
{
Text [ en-US ] = "Delete Category";
};
String STR_CATEGORY_SELECT
{
Text [ en-US ] = "Select Category";
};
String STR_CREATE_ERROR
{
Text [ en-US ] = "Cannot create category: $1";
};
String STR_ERROR_SAVEAS
{
Text [ en-US ] = "Cannot save template: $1";
};
String STR_INPUT_NEW
{
Text [ en-US ] = "Enter folder name:";
Text [ en-US ] = "Enter category name:";
};
String STR_REPOSITORY_LOCAL

View File

@@ -99,7 +99,7 @@
#include "helpid.hrc"
#include "guisaveas.hxx"
#include <sfx2/templatedlg.hxx>
#include <sfx2/saveastemplatedlg.hxx>
#include <memory>
#include <cppuhelper/implbase.hxx>
@@ -848,11 +848,9 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
case SID_DOCTEMPLATE:
{
// save as document templates
ScopedVclPtrInstance< SfxTemplateManagerDlg > aDlg;
ScopedVclPtrInstance<SfxSaveAsTemplateDialog> aDlg;
aDlg->setDocumentModel(GetModel());
aDlg->setSaveMode();
aDlg->Execute();
break;
}

View File

@@ -0,0 +1,169 @@
/* -*- 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/saveastemplatedlg.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <sfx2/sfxresid.hxx>
#include <sfx2/doctempl.hxx>
#include <vcl/edit.hxx>
#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx>
#include <com/sun/star/frame/DocumentTemplates.hpp>
#include "doc.hrc"
using namespace ::com::sun::star;
using namespace ::com::sun::star::frame;
// Class SfxSaveAsTemplateDialog --------------------------------------------------
SfxSaveAsTemplateDialog::SfxSaveAsTemplateDialog( vcl::Window* pParent):
ModalDialog(pParent, "SaveAsTemplateDialog", "sfx/ui/saveastemplatedlg.ui"),
msSelectedCategory(OUString()),
msTemplateName(OUString()),
mnRegionPos(0),
mpDocTemplates(new SfxDocumentTemplates)
{
get(mpLBCategory, "categorylb");
get(mpTemplateNameEdit, "name_entry");
get(mpOKButton, "ok");
initialize();
SetCategoryLBEntries(msCategories);
mpTemplateNameEdit->SetModifyHdl(LINK(this, SfxSaveAsTemplateDialog, TemplateNameEditHdl));
mpLBCategory->SetSelectHdl(LINK(this, SfxSaveAsTemplateDialog, SelectCategoryHdl));
mpOKButton->SetClickHdl(LINK(this, SfxSaveAsTemplateDialog, OkClickHdl));
mpOKButton->Disable();
mpOKButton->SetText(SfxResId(STR_SAVEDOC).toString());
}
SfxSaveAsTemplateDialog::~SfxSaveAsTemplateDialog()
{
disposeOnce();
}
void SfxSaveAsTemplateDialog::dispose()
{
mpLBCategory.clear();
mpTemplateNameEdit.clear();
mpOKButton.clear();
ModalDialog::dispose();
}
void SfxSaveAsTemplateDialog::setDocumentModel(const uno::Reference<frame::XModel> &rModel)
{
m_xModel = rModel;
}
IMPL_LINK_NOARG_TYPED(SfxSaveAsTemplateDialog, OkClickHdl, Button*, void)
{
ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, OUString(), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
if(!IsTemplateNameUnique())
{
OUString sQueryMsg(SfxResId(STR_QMSG_TEMPLATE_OVERWRITE).toString());
sQueryMsg = sQueryMsg.replaceFirst("$1",msTemplateName);
aQueryDlg->set_primary_text(sQueryMsg.replaceFirst("$2", msSelectedCategory));
if( aQueryDlg->Execute() == RET_NO )
return;
}
if(SaveTemplate())
Close();
else
{
OUString sText( SfxResId(STR_ERROR_SAVEAS).toString() );
ScopedVclPtrInstance<MessageDialog>::Create(this, sText.replaceFirst("$1", msTemplateName))->Execute();
}
}
IMPL_LINK_NOARG_TYPED(SfxSaveAsTemplateDialog, TemplateNameEditHdl, Edit&, void)
{
msTemplateName = comphelper::string::strip(mpTemplateNameEdit->GetText(), ' ');
SelectCategoryHdl(*mpLBCategory);
}
IMPL_LINK_NOARG_TYPED(SfxSaveAsTemplateDialog, SelectCategoryHdl, ListBox&, void)
{
if(mpLBCategory->GetSelectEntryPos() == 0)
{
msSelectedCategory = OUString();
mpOKButton->Disable();
}
else
{
msSelectedCategory = mpLBCategory->GetSelectEntry();
mpOKButton->Enable(!msTemplateName.isEmpty());
}
}
void SfxSaveAsTemplateDialog::initialize()
{
sal_uInt16 nCount = mpDocTemplates->GetRegionCount();
for (sal_uInt16 i = 0; i < nCount; ++i)
{
OUString sCategoryName(mpDocTemplates->GetFullRegionName(i));
msCategories.push_back(sCategoryName);
}
}
void SfxSaveAsTemplateDialog::SetCategoryLBEntries(std::vector<OUString> aFolderNames)
{
mpLBCategory->InsertEntry(OUString("None"), 0);
if (!aFolderNames.empty())
{
for (size_t i = 0, n = aFolderNames.size(); i < n; ++i)
mpLBCategory->InsertEntry(aFolderNames[i], i+1);
}
mpLBCategory->SelectEntryPos(0);
}
bool SfxSaveAsTemplateDialog::IsTemplateNameUnique()
{
std::vector<OUString>::iterator it;
it=find(msCategories.begin(), msCategories.end(), msSelectedCategory);
mnRegionPos = std::distance(msCategories.begin(), it);
sal_uInt16 nEntries = mpDocTemplates->GetCount(mnRegionPos);
for(sal_uInt16 i = 0; i < nEntries; i++)
{
OUString aName = mpDocTemplates->GetName(mnRegionPos, i);
if(aName == msTemplateName)
return false;
}
return true;
}
bool SfxSaveAsTemplateDialog::SaveTemplate()
{
uno::Reference< frame::XStorable > xStorable(m_xModel, uno::UNO_QUERY_THROW );
uno::Reference< frame::XDocumentTemplates > xTemplates(frame::DocumentTemplates::create(comphelper::getProcessComponentContext()) );
if (!xTemplates->storeTemplate( msSelectedCategory, msTemplateName, xStorable ))
return false;
sal_uInt16 nDocId = mpDocTemplates->GetCount(mnRegionPos);
OUString sURL = mpDocTemplates->GetTemplateTargetURLFromComponent(msSelectedCategory, msTemplateName);
if(!mpDocTemplates->InsertTemplate( mnRegionPos, nDocId, msTemplateName, sURL))
return false;
return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,9 @@
#include <sfx2/thumbnailview.hxx>
class TemplateViewItem;
class PopupMenu;
class TemplateSearchView : public ThumbnailView
{
public:
@@ -20,6 +23,18 @@ public:
void setOpenTemplateHdl (const Link<ThumbnailViewItem*, void> &rLink);
DECL_LINK_TYPED(ContextMenuSelectHdl, Menu*, bool);
void setRightClickHdl(const Link<ThumbnailViewItem*,void> &rLink);
void setEditTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
void setDeleteTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
void setDefaultTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
void createContextMenu();
void AppendItem(sal_uInt16 nAssocItemId, sal_uInt16 nRegionId, sal_uInt16 nIdx,
const OUString &rTitle, const OUString &rSubtitle,
const OUString &rPath, const BitmapEx &rImage );
@@ -27,8 +42,18 @@ public:
protected:
virtual void OnItemDblClicked(ThumbnailViewItem *pItem) override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
protected:
TemplateViewItem *maSelectedItem;
Point maPosition;
Link<ThumbnailViewItem*, void> maOpenTemplateHdl;
Link<ThumbnailViewItem*, void> maRightClickHdl;
Link<ThumbnailViewItem*,void> maEditTemplateHdl;
Link<ThumbnailViewItem*,void> maDeleteTemplateHdl;
Link<ThumbnailViewItem*,void> maDefaultTemplateHdl;
};
#endif // INCLUDED_SFX2_SOURCE_INC_TEMPLATESEARCHVIEW_HXX

View File

@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.6"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="SaveAsTemplateDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Save As Template</property>
<property name="modal">True</property>
<property name="type_hint">normal</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="secondary">True</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">6</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="create_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Enter Template Name</property>
<attributes>
<attribute name="weight" value="normal"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="name_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="select_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Select Template Category</property>
<attributes>
<attribute name="weight" value="normal"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="categorylb">
<property name="width_request">250</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">help</action-widget>
<action-widget response="0">ok</action-widget>
<action-widget response="0">cancel</action-widget>
</action-widgets>
</object>
</interface>

View File

@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.6"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="TemplatesCategoryDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Select Category</property>
<property name="modal">True</property>
<property name="type_hint">normal</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="secondary">True</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">6</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="select_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Select from Existing Category</property>
<attributes>
<attribute name="weight" value="normal"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="categorylb">
<property name="width_request">250</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="create_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">or Create a New Category</property>
<attributes>
<attribute name="weight" value="normal"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="category_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">help</action-widget>
<action-widget response="0">ok</action-widget>
<action-widget response="0">cancel</action-widget>
</action-widgets>
</object>
</interface>

View File

@@ -1,8 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.6"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">sfx2/imglst/actiontemplates020.png</property>
</object>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">sfx2/imglst/actiontemplates017.png</property>
</object>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">sfx2/imglst/actionview010.png</property>
</object>
<object class="GtkListStore" id="applist">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">All Applications</col>
</row>
<row>
<col id="0" translatable="yes">Documents</col>
</row>
<row>
<col id="0" translatable="yes">Spreadsheets</col>
</row>
<row>
<col id="0" translatable="yes">Presentations</col>
</row>
<row>
<col id="0" translatable="yes">Drawings</col>
</row>
</data>
</object>
<object class="GtkListStore" id="folderlist">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">All Categories</col>
</row>
</data>
</object>
<object class="GtkDialog" id="TemplateDialog">
<property name="width_request">800</property>
<property name="height_request">600</property>
@@ -79,205 +129,53 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkNotebook" id="tab_control">
<object class="GtkBox" id="filter_box">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="spacing">36</property>
<child>
<object class="GtkBox" id="box2">
<object class="GtkEntry" id="search_filter">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="placeholder_text" translatable="yes">Search...</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="box3">
<object class="GtkBox" id="box6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="spacing">6</property>
<property name="spacing">12</property>
<child>
<object class="GtkToolbar" id="action_view">
<object class="GtkComboBox" id="filter_application">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<child>
<object class="GtkToolButton" id="repository">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">repository</property>
<property name="label" translatable="yes">Repository</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionview026.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="import">
<property name="can_focus">False</property>
<property name="action_name">import</property>
<property name="label" translatable="yes">Import</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionview010.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="delete">
<property name="can_focus">False</property>
<property name="action_name">delete</property>
<property name="label" translatable="yes">Delete</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionview025.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="save">
<property name="can_focus">False</property>
<property name="action_name">save</property>
<property name="label" translatable="yes">Save</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionview028.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="new_folder">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">new_folder</property>
<property name="label" translatable="yes">New Folder</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionview029.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<property name="resize_mode">queue</property>
<property name="model">applist</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToolbar" id="action_templates">
<object class="GtkComboBox" id="filter_folder">
<property name="width_request">250</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<child>
<object class="GtkToolButton" id="template_save">
<property name="can_focus">False</property>
<property name="action_name">template_save</property>
<property name="label" translatable="yes">Save</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionview028.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="open">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">open</property>
<property name="label" translatable="yes">Open</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionview030.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="edit">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">edit</property>
<property name="label" translatable="yes">Edit</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actiontemplates019.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="default">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">default</property>
<property name="label" translatable="yes">Set as Default</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actiontemplates015.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="move">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">move</property>
<property name="label" translatable="yes">Move to Folder</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actiontemplates017.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="export">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">export</property>
<property name="label" translatable="yes">Export</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actiontemplates020.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="template_delete">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">template_delete</property>
<property name="label" translatable="yes">Delete</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actiontemplates018.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<property name="model">folderlist</property>
</object>
<packing>
<property name="expand">False</property>
@@ -285,59 +183,129 @@
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Filter</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="thumbnailview_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="sfxlo-TemplateLocalView" id="template_view">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="sfxlo-TemplateSearchView" id="search_view">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="margin">0</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="sfxlo-TemplateRemoteView" id="remote_view">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="margin">0</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkToolbar" id="action_view">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkToolbar" id="action_action">
<object class="GtkToolButton" id="repository">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="hexpand">True</property>
<child>
<object class="GtkToolButton" id="search">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">search</property>
<property name="label" translatable="yes">Search</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionaction012.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="action_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">action_menu</property>
<property name="label" translatable="yes">Action Menu</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionaction013.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="template_link">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">template_link</property>
<property name="label" translatable="yes">Get more templates for %PRODUCTNAME</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionview010.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<property name="action_name">repository</property>
<property name="label" translatable="yes">Repository</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionview026.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
@@ -348,10 +316,25 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="search_edit">
<property name="can_focus">True</property>
<object class="GtkToolbar" id="action_action">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="hexpand">True</property>
<property name="invisible_char">●</property>
<child>
<object class="GtkToolButton" id="action_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">action_menu</property>
<property name="label" translatable="yes">Action Menu</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionaction013.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
@@ -360,11 +343,62 @@
</packing>
</child>
<child>
<object class="sfxlo-TemplateLocalView" id="template_view">
<object class="GtkButton" id="online_link">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Browse Templates Online</property>
<property name="image">image5</property>
<property name="relief">none</property>
<property name="yalign">0.49000000953674316</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="bottom_action_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<child>
<object class="GtkButton" id="move_btn">
<property name="label" translatable="yes">Move</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Move Templates</property>
<property name="image">image3</property>
<property name="relief">none</property>
<property name="yalign">0.50999999046325684</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="export_btn">
<property name="label" translatable="yes">Export</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Export Templates</property>
<property name="image">image1</property>
<property name="relief">none</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -373,12 +407,15 @@
</packing>
</child>
<child>
<object class="sfxlo-TemplateSearchView" id="search_view">
<object class="GtkButton" id="import_btn">
<property name="label" translatable="yes">Import</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="margin">0</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Import Templates</property>
<property name="image">image4</property>
<property name="relief">none</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -386,79 +423,19 @@
<property name="position">3</property>
</packing>
</child>
<child>
<object class="sfxlo-TemplateRemoteView" id="remote_view">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="margin">0</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="filter_docs">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Documents</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<object class="GtkLabel" id="filter_sheets">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Spreadsheets</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<object class="GtkLabel" id="filter_presentations">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Presentations</property>
</object>
<packing>
<property name="position">2</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<object class="GtkLabel" id="filter_draws">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Drawings</property>
</object>
<packing>
<property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
</object>
@@ -476,4 +453,9 @@
<action-widget response="0">cancel</action-widget>
</action-widgets>
</object>
<object class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">cmd/lc_webhtml.png</property>
</object>
</interface>