weld backing window

Change-Id: I250e46d3f1d558567bddbd4f0330470222e8fd4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104442
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2020-10-15 15:24:26 +01:00
parent f4a5893ece
commit 5a342bde16
18 changed files with 414 additions and 430 deletions

View File

@@ -25,13 +25,6 @@
</properties>
</glade-widget-class>
<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-TemplateDefaultView"
generic-name="Template Icon View" parent="GtkIconView"
icon-name="widget-gtk-iconview"/>
<glade-widget-class title="Notebook switching tabs depending on context" name="sfxlo-NotebookbarTabControl"
generic-name="NotebookbarTabControl" parent="GtkNotebook"
icon-name="widget-gtk-notebook"/>

View File

@@ -105,8 +105,6 @@ public:
void setEditTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
void updateThumbnailDimensions(tools::Long itemMaxSize);
static BitmapEx scaleImg (const BitmapEx &rImg, tools::Long width, tools::Long height);
static BitmapEx getDefaultThumbnail( const OUString& rPath );
@@ -137,7 +135,7 @@ protected:
std::vector<TemplateItemProperties > maAllTemplates;
};
class SfxTemplateLocalView final : public SfxThumbnailView
class SfxTemplateLocalView : public SfxThumbnailView
{
typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*);
@@ -154,9 +152,9 @@ public:
// Fill view with template folders thumbnails
void Populate ();
void reload ();
virtual void reload ();
void showAllTemplates ();
virtual void showAllTemplates ();
void showRegion (TemplateContainerItem const *pItem);
@@ -220,6 +218,8 @@ public:
void setDefaultTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
void updateThumbnailDimensions(tools::Long itemMaxSize);
void RemoveDefaultTemplateIcon( const OUString& rPath);
static BitmapEx scaleImg (const BitmapEx &rImg, tools::Long width, tools::Long height);
@@ -230,13 +230,16 @@ public:
static bool IsDefaultTemplate(const OUString& rPath);
private:
protected:
virtual void OnItemDblClicked(ThumbnailViewItem *pItem) override;
sal_uInt16 mnCurRegionId;
TemplateViewItem *maSelectedItem;
long mnThumbnailWidth;
long mnThumbnailHeight;
Point maPosition; //store the point of click event
Link<void*,void> maOpenRegionHdl;

View File

@@ -329,7 +329,7 @@ public:
void RemoveItem(sal_uInt16 nItemId);
void Clear();
virtual void Clear();
// Change current thumbnail item list with new one (invalidates all pointers to a thumbnail item)
void updateItems(std::vector<std::unique_ptr<ThumbnailViewItem>> items);
@@ -413,6 +413,9 @@ protected:
virtual void OnItemDblClicked (ThumbnailViewItem *pItem);
// Set Item colors from the SfxThumbnailView colors
void UpdateColors();
protected:
friend class SfxThumbnailViewAcc;

View File

@@ -386,7 +386,7 @@ IMPL_LINK_NOARG(AnimationWindow, ClickRbtHdl, weld::Button&, void)
IMPL_LINK(AnimationWindow, ClickHelpHdl, weld::Button&, rButton, void)
{
if (Help* pHelp = Application::GetHelp())
pHelp->Start(OStringToOUString(m_xContainer->get_help_id(), RTL_TEXTENCODING_UTF8), &rButton);
pHelp->Start(OUString::fromUtf8(m_xContainer->get_help_id()), &rButton);
}
IMPL_LINK( AnimationWindow, ClickGetObjectHdl, weld::Button&, rBtn, void )

View File

@@ -22,12 +22,14 @@ namespace com::sun::star::frame { class XDispatch; }
namespace sfx2
{
class RecentDocsView;
struct LoadRecentFile
{
css::util::URL aTargetURL;
css::uno::Sequence< css::beans::PropertyValue > aArgSeq;
css::uno::Reference< css::frame::XDispatch > xDispatch;
VclPtr< ThumbnailView > pView;
RecentDocsView* pView;
};
enum class ApplicationType
@@ -53,10 +55,11 @@ template<> struct typed_flags<sfx2::ApplicationType> : is_typed_flags<sfx2::Appl
namespace sfx2
{
class RecentDocsView final : public ThumbnailView
class RecentDocsView final : public SfxThumbnailView
{
public:
RecentDocsView( vcl::Window* pParent );
RecentDocsView(std::unique_ptr<weld::ScrolledWindow> xWindow, std::unique_ptr<weld::Menu> xMenu);
virtual ~RecentDocsView() override;
void insertItem(const OUString &rURL, const OUString &rTitle, const BitmapEx &rThumbnail, sal_uInt16 nId);
@@ -70,12 +73,16 @@ public:
/// Update the information in the view.
virtual void Reload() override;
DECL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, void*, void );
// launch load of recently used file
void PostLoadRecentUsedFile(LoadRecentFile* pLoadRecentFile);
// received on load of recently used file
void DispatchedLoadRecentUsedFile();
private:
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override;
virtual void OnItemDblClicked(ThumbnailViewItem *pItem) override;
@@ -85,6 +92,8 @@ private:
bool isAcceptedFile(const OUString &rURL) const;
DECL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, void*, void );
tools::Long mnItemMaxSize;
size_t mnLastMouseDownItem;
@@ -92,6 +101,8 @@ private:
BitmapEx maWelcomeImage;
OUString maWelcomeLine1;
OUString maWelcomeLine2;
sfx2::LoadRecentFile* mpLoadRecentFile;
};
} // namespace sfx2

View File

@@ -11,18 +11,17 @@
#include <sfx2/templatelocalview.hxx>
class TemplateDefaultView final : public TemplateLocalView
class TemplateDefaultView : public SfxTemplateLocalView
{
public:
TemplateDefaultView(Window *pParent);
virtual void reload() override;
TemplateDefaultView(std::unique_ptr<weld::ScrolledWindow> xWindow,
std::unique_ptr<weld::Menu> xMenu);
virtual void showAllTemplates () override;
virtual void KeyInput( const KeyEvent& rKEvt ) override;
virtual bool KeyInput( const KeyEvent& rKEvt ) override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
void createContextMenu();

View File

@@ -23,7 +23,6 @@
#include <sfx2/sfxresid.hxx>
#include <tools/diagnose_ex.h>
#include <unotools/historyoptions.hxx>
#include <vcl/builderfactory.hxx>
#include <vcl/event.hxx>
#include <vcl/pngread.hxx>
#include <vcl/ptrstyle.hxx>
@@ -43,6 +42,8 @@
#include <officecfg/Office/Common.hxx>
#include <map>
using namespace ::com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -121,18 +122,18 @@ static std::map<ApplicationType,OUString> EncryptedBitmapForExtension =
constexpr tools::Long gnTextHeight = 30;
constexpr tools::Long gnItemPadding = 5;
RecentDocsView::RecentDocsView( vcl::Window* pParent )
: ThumbnailView(pParent)
RecentDocsView::RecentDocsView(std::unique_ptr<weld::ScrolledWindow> xWindow, std::unique_ptr<weld::Menu> xMenu)
: SfxThumbnailView(std::move(xWindow), std::move(xMenu))
, mnFileTypes(ApplicationType::TYPE_NONE)
, mnLastMouseDownItem(THUMBNAILVIEW_ITEM_NOTFOUND)
, maWelcomeImage()
, maWelcomeLine1(SfxResId(STR_WELCOME_LINE1))
, maWelcomeLine2(SfxResId(STR_WELCOME_LINE2))
, mpLoadRecentFile(nullptr)
{
tools::Rectangle aScreen = Application::GetScreenPosSizePixel(Application::GetDisplayBuiltInScreen());
mnItemMaxSize = std::min(aScreen.GetWidth(),aScreen.GetHeight()) > 800 ? 256 : 192;
SetStyle(GetStyle() | WB_VSCROLL);
setItemMaxTextLength( 30 );
setItemDimensions( mnItemMaxSize, mnItemMaxSize, gnTextHeight, gnItemPadding );
@@ -141,9 +142,18 @@ RecentDocsView::RecentDocsView( vcl::Window* pParent )
maHighlightColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightColor::get());
maHighlightTextColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsHighlightTextColor::get());
mfHighlightTransparence = 0.25;
UpdateColors();
}
VCL_BUILDER_FACTORY(RecentDocsView)
RecentDocsView::~RecentDocsView()
{
if (mpLoadRecentFile)
{
mpLoadRecentFile->pView = nullptr;
mpLoadRecentFile = nullptr;
}
}
bool RecentDocsView::typeMatchesExtension(ApplicationType type, const OUString &rExt)
{
@@ -288,25 +298,25 @@ void RecentDocsView::Reload()
Invalidate();
}
void RecentDocsView::MouseButtonDown( const MouseEvent& rMEvt )
bool RecentDocsView::MouseButtonDown( const MouseEvent& rMEvt )
{
if (rMEvt.IsLeft())
{
mnLastMouseDownItem = ImplGetItem(rMEvt.GetPosPixel());
// ignore to avoid stuff done in ThumbnailView; we don't do selections etc.
return;
// ignore to avoid stuff done in SfxThumbnailView; we don't do selections etc.
return true;
}
ThumbnailView::MouseButtonDown(rMEvt);
return SfxThumbnailView::MouseButtonDown(rMEvt);
}
void RecentDocsView::MouseButtonUp(const MouseEvent& rMEvt)
bool RecentDocsView::MouseButtonUp(const MouseEvent& rMEvt)
{
if (rMEvt.IsLeft())
{
if( rMEvt.GetClicks() > 1 )
return;
return true;
size_t nPos = ImplGetItem(rMEvt.GetPosPixel());
ThumbnailViewItem* pItem = ImplGetItem(nPos);
@@ -323,9 +333,9 @@ void RecentDocsView::MouseButtonUp(const MouseEvent& rMEvt)
mnLastMouseDownItem = THUMBNAILVIEW_ITEM_NOTFOUND;
if (pItem)
return;
return true;
}
ThumbnailView::MouseButtonUp(rMEvt);
return SfxThumbnailView::MouseButtonUp(rMEvt);
}
void RecentDocsView::OnItemDblClicked(ThumbnailViewItem *pItem)
@@ -337,19 +347,7 @@ void RecentDocsView::OnItemDblClicked(ThumbnailViewItem *pItem)
void RecentDocsView::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle &aRect)
{
// Set preferred width
if (mFilteredItemList.empty())
{
rRenderContext.Push(PushFlags::FONT);
SetMessageFont(rRenderContext);
set_width_request(std::max(rRenderContext.GetTextWidth(maWelcomeLine1),
rRenderContext.GetTextWidth(maWelcomeLine2)));
rRenderContext.Pop();
}
else
{
set_width_request(gnTextHeight + mnItemMaxSize + 2 * gnItemPadding);
}
SfxThumbnailView::Paint(rRenderContext, aRect);
if (mItemList.empty())
{
@@ -362,12 +360,12 @@ void RecentDocsView::Paint(vcl::RenderContext& rRenderContext, const tools::Rect
// No recent files to be shown yet. Show a welcome screen.
rRenderContext.Push(PushFlags::FONT | PushFlags::TEXTCOLOR);
SetMessageFont(rRenderContext);
SetTextColor(maTextColor);
rRenderContext.SetTextColor(maTextColor);
tools::Long nTextHeight = rRenderContext.GetTextHeight();
const Size& rImgSize = maWelcomeImage.GetSizePixel();
const Size& rSize = GetSizePixel();
const Size& rSize = GetOutputSizePixel();
const int nX = (rSize.Width() - rImgSize.Width())/2;
int nY = (rSize.Height() - 3 * nTextHeight - rImgSize.Height())/2;
@@ -384,28 +382,36 @@ void RecentDocsView::Paint(vcl::RenderContext& rRenderContext, const tools::Rect
rRenderContext.Pop();
}
else
{
ThumbnailView::Paint(rRenderContext, aRect);
}
}
void RecentDocsView::LoseFocus()
{
deselectItems();
ThumbnailView::LoseFocus();
SfxThumbnailView::LoseFocus();
}
void RecentDocsView::Clear()
{
Invalidate();
ThumbnailView::Clear();
SfxThumbnailView::Clear();
}
void RecentDocsView::PostLoadRecentUsedFile(LoadRecentFile* pLoadRecentFile)
{
assert(!mpLoadRecentFile);
mpLoadRecentFile = pLoadRecentFile;
Application::PostUserEvent(LINK(nullptr, RecentDocsView, ExecuteHdl_Impl), pLoadRecentFile);
}
void RecentDocsView::DispatchedLoadRecentUsedFile()
{
mpLoadRecentFile = nullptr;
}
IMPL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, void*, p, void )
{
LoadRecentFile* pLoadRecentFile = static_cast< LoadRecentFile*>(p);
LoadRecentFile* pLoadRecentFile = static_cast<LoadRecentFile*>(p);
try
{
// Asynchronous execution as this can lead to our own destruction!
@@ -417,8 +423,11 @@ IMPL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, void*, p, void )
{
}
if ( !pLoadRecentFile->pView->IsDisposed() )
pLoadRecentFile->pView->SetPointer( PointerStyle::Arrow );
if (pLoadRecentFile->pView)
{
pLoadRecentFile->pView->DispatchedLoadRecentUsedFile();
pLoadRecentFile->pView->SetPointer(PointerStyle::Arrow);
}
delete pLoadRecentFile;
}

View File

@@ -211,7 +211,7 @@ void RecentDocsViewItem::OpenDocument()
pLoadRecentFile->aArgSeq = aArgsList;
pLoadRecentFile->pView = &mrParentView;
Application::PostUserEvent(LINK(nullptr, sfx2::RecentDocsView, ExecuteHdl_Impl), pLoadRecentFile, true);
mrParentView.PostLoadRecentUsedFile(pLoadRecentFile);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -11,28 +11,23 @@
#include <sfx2/thumbnailview.hxx>
#include <templateviewitem.hxx>
#include <sfx2/sfxresid.hxx>
#include <vcl/builderfactory.hxx>
#include <vcl/event.hxx>
#include <vcl/svapp.hxx>
#include <sfx2/strings.hrc>
#define MNI_OPEN 1
#define MNI_EDIT 2
#include <officecfg/Office/Common.hxx>
VCL_BUILDER_FACTORY(TemplateDefaultView)
constexpr int gnItemPadding(5); //TODO:: Change padding to 10. It looks really crowded and occupied.
constexpr tools::Long gnTextHeight = 30;
TemplateDefaultView::TemplateDefaultView( Window* pParent)
: TemplateLocalView(pParent)
TemplateDefaultView::TemplateDefaultView(std::unique_ptr<weld::ScrolledWindow> xWindow,
std::unique_ptr<weld::Menu> xMenu)
: SfxTemplateLocalView(std::move(xWindow), std::move(xMenu))
{
tools::Rectangle aScreen = Application::GetScreenPosSizePixel(Application::GetDisplayBuiltInScreen());
mnItemMaxSize = std::min(aScreen.GetWidth(),aScreen.GetHeight()) > 800 ? 256 : 192;
ThumbnailView::setItemDimensions( mnItemMaxSize, mnItemMaxSize, gnTextHeight, gnItemPadding );
SfxThumbnailView::setItemDimensions( mnItemMaxSize, mnItemMaxSize, gnTextHeight, gnItemPadding );
updateThumbnailDimensions(mnItemMaxSize);
// startcenter specific settings
@@ -41,13 +36,8 @@ 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;
}
void TemplateDefaultView::reload()
{
TemplateLocalView::reload();
// Set preferred width
set_width_request(gnTextHeight + mnItemMaxSize + 2*gnItemPadding);
UpdateColors();
}
void TemplateDefaultView::showAllTemplates()
@@ -57,12 +47,12 @@ void TemplateDefaultView::showAllTemplates()
insertItems(maAllTemplates, false);
}
void TemplateDefaultView::KeyInput( const KeyEvent& rKEvt )
bool TemplateDefaultView::KeyInput( const KeyEvent& rKEvt )
{
ThumbnailView::KeyInput(rKEvt);
return SfxThumbnailView::KeyInput(rKEvt);
}
void TemplateDefaultView::MouseButtonDown( const MouseEvent& rMEvt )
bool TemplateDefaultView::MouseButtonDown( const MouseEvent& rMEvt )
{
if( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
{
@@ -71,21 +61,21 @@ void TemplateDefaultView::MouseButtonDown( const MouseEvent& rMEvt )
TemplateViewItem* pViewItem = dynamic_cast<TemplateViewItem*>(pItem);
if(pViewItem)
maOpenTemplateHdl.Call(pViewItem);
return;
return true;
}
TemplateLocalView::MouseButtonDown(rMEvt);
return SfxTemplateLocalView::MouseButtonDown(rMEvt);
}
void TemplateDefaultView::createContextMenu()
{
ScopedVclPtrInstance<PopupMenu> pItemMenu;
pItemMenu->InsertItem(MNI_OPEN,SfxResId(STR_OPEN));
pItemMenu->InsertItem(MNI_EDIT,SfxResId(STR_EDIT_TEMPLATE));
mxContextMenu->clear();
mxContextMenu->append("open",SfxResId(STR_OPEN));
mxContextMenu->append("edit",SfxResId(STR_EDIT_TEMPLATE));
deselectItems();
maSelectedItem->setSelection(true);
pItemMenu->SetSelectHdl(LINK(this, TemplateLocalView, ContextMenuSelectHdl));
pItemMenu->Execute(this, tools::Rectangle(maPosition,Size(1,1)), PopupMenuFlags::ExecuteDown);
maItemStateHdl.Call(maSelectedItem);
ContextMenuSelectHdl(mxContextMenu->popup_at_rect(GetDrawingArea(), tools::Rectangle(maPosition, Size(1,1))));
Invalidate();
}

View File

@@ -289,7 +289,7 @@ void TemplateLocalView::insertItems(const std::vector<TemplateItemProperties> &r
updateItems(std::move(aItems));
}
void TemplateLocalView::updateThumbnailDimensions(tools::Long itemMaxSize)
void SfxTemplateLocalView::updateThumbnailDimensions(tools::Long itemMaxSize)
{
mnThumbnailWidth = itemMaxSize;
mnThumbnailHeight = itemMaxSize;
@@ -471,6 +471,8 @@ SfxTemplateLocalView::SfxTemplateLocalView(std::unique_ptr<weld::ScrolledWindow>
: SfxThumbnailView(std::move(xWindow), std::move(xMenu))
, mnCurRegionId(0)
, maSelectedItem(nullptr)
, mnThumbnailWidth(TEMPLATE_THUMBNAIL_MAX_WIDTH)
, mnThumbnailHeight(TEMPLATE_THUMBNAIL_MAX_HEIGHT)
, maPosition(0,0)
, mpDocTemplates(new SfxDocumentTemplates)
{
@@ -509,8 +511,8 @@ void SfxTemplateLocalView::Populate()
aProperties.aPath = aURL;
aProperties.aRegionName = aRegionName;
aProperties.aThumbnail = TemplateLocalView::fetchThumbnail(aURL,
TEMPLATE_THUMBNAIL_MAX_WIDTH,
TEMPLATE_THUMBNAIL_MAX_HEIGHT);
mnThumbnailWidth,
mnThumbnailHeight);
pItem->maTemplates.push_back(aProperties);
maAllTemplates.push_back(aProperties);

View File

@@ -1327,6 +1327,13 @@ void SfxThumbnailView::ImplInit()
mpStartSelRange = mFilteredItemList.end();
UpdateColors();
mpItemAttrs->nMaxTextLength = 0;
}
void SfxThumbnailView::UpdateColors()
{
mpItemAttrs->aFillColor = maFillColor.getBColor();
mpItemAttrs->aTextColor = maTextColor.getBColor();
mpItemAttrs->aHighlightColor = maHighlightColor.getBColor();
@@ -1334,8 +1341,6 @@ void SfxThumbnailView::ImplInit()
mpItemAttrs->aSelectHighlightColor = maSelectHighlightColor.getBColor();
mpItemAttrs->aSelectHighlightTextColor = maSelectHighlightTextColor.getBColor();
mpItemAttrs->fHighlightTransparence = mfHighlightTransparence;
mpItemAttrs->nMaxTextLength = 0;
}
void SfxThumbnailView::ImplDeleteItems()

View File

@@ -20,11 +20,12 @@
#include "backingwindow.hxx"
#include <vcl/accel.hxx>
#include <vcl/event.hxx>
#include <vcl/help.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>
#include <vcl/virdev.hxx>
#include <vcl/fixed.hxx>
#include <unotools/historyoptions.hxx>
#include <unotools/moduleoptions.hxx>
@@ -33,8 +34,6 @@
#include <svtools/langhelp.hxx>
#include <templateviewitem.hxx>
#include <vcl/menubtn.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/propertysequence.hxx>
@@ -65,60 +64,43 @@ const char SERVICENAME_CFGREADACCESS[] = "com.sun.star.configuration.Configurati
// increase size of the text in the buttons on the left fMultiplier-times
float const fMultiplier = 1.4f;
BackingWindow::BackingWindow( vcl::Window* i_pParent ) :
Window( i_pParent ),
mbLocalViewInitialized(false),
mbInitControls( false )
BackingWindow::BackingWindow(vcl::Window* i_pParent)
: InterimItemWindow(i_pParent, "sfx/ui/startcenter.ui", "StartCenter", false)
, mxOpenButton(m_xBuilder->weld_button("open_all"))
, mxRecentButton(m_xBuilder->weld_menu_toggle_button("open_recent"))
, mxRemoteButton(m_xBuilder->weld_button("open_remote"))
, mxTemplateButton(m_xBuilder->weld_menu_toggle_button("templates_all"))
, mxCreateLabel(m_xBuilder->weld_label("create_label"))
, mxAltHelpLabel(m_xBuilder->weld_label("althelplabel"))
, mxWriterAllButton(m_xBuilder->weld_button("writer_all"))
, mxCalcAllButton(m_xBuilder->weld_button("calc_all"))
, mxImpressAllButton(m_xBuilder->weld_button("impress_all"))
, mxDrawAllButton(m_xBuilder->weld_button("draw_all"))
, mxDBAllButton(m_xBuilder->weld_button("database_all"))
, mxMathAllButton(m_xBuilder->weld_button("math_all"))
, mxHelpButton(m_xBuilder->weld_button("help"))
, mxExtensionsButton(m_xBuilder->weld_button("extensions"))
, mxAllButtonsBox(m_xBuilder->weld_container("all_buttons_box"))
, mxButtonsBox(m_xBuilder->weld_container("buttons_box"))
, mxSmallButtonsBox(m_xBuilder->weld_container("small_buttons_box"))
, mxAllRecentThumbnails(new sfx2::RecentDocsView(m_xBuilder->weld_scrolled_window("scrollrecent", true),
m_xBuilder->weld_menu("recentmenu")))
, mxAllRecentThumbnailsWin(new weld::CustomWeld(*m_xBuilder, "all_recent", *mxAllRecentThumbnails))
, mxLocalView(new TemplateDefaultView(m_xBuilder->weld_scrolled_window("scrolllocal", true),
m_xBuilder->weld_menu("localmenu")))
, mxLocalViewWin(new weld::CustomWeld(*m_xBuilder, "local_view", *mxLocalView))
, mbLocalViewInitialized(false)
, mbInitControls(false)
{
m_pUIBuilder.reset(new VclBuilder(this, AllSettings::GetUIRootDir(), "sfx/ui/startcenter.ui", "StartCenter" ));
// init background
SetPaintTransparent(false);
SetBackground(svtools::ColorConfig().GetColorValue(::svtools::APPBACKGROUND).nColor);
get(mpOpenButton, "open_all");
get(mpRemoteButton, "open_remote");
get(mpRecentButton, "open_recent");
get(mpTemplateButton, "templates_all");
get(mpCreateLabel, "create_label");
get(mpWriterAllButton, "writer_all");
get(mpCalcAllButton, "calc_all");
get(mpImpressAllButton, "impress_all");
get(mpDrawAllButton, "draw_all");
get(mpDBAllButton, "database_all");
get(mpMathAllButton, "math_all");
get(mpHelpButton, "help");
//set an alternative help label that doesn't hotkey the H of the Help menu
mpHelpButton->SetText(get<Window>("althelplabel")->GetText());
get(mpExtensionsButton, "extensions");
mxHelpButton->set_label(mxAltHelpLabel->get_label());
mxHelpButton->connect_clicked(LINK(this, BackingWindow, ClickHelpHdl));
//Containers are invisible to cursor traversal
//So on pressing "right" when in Help the
//extension button is considered as a candidate
//But the containers are not invisible to the PushButton ctor which checks
//if the preceding window of its parent is a button and if it then
//defaults to grouping with it and if it is not a button defaults to
//setting itself as the start of a new group.
//So here take the second button and set it as explicitly not the start
//of a group, i.e. allow it to be grouped with the preceding
//PushButton so when seen as a candidate by cursor travelling
//it will be accepted as a continuation of the group.
WinBits nBits = mpExtensionsButton->GetStyle();
nBits &= ~WB_GROUP;
nBits |= WB_NOGROUP;
mpExtensionsButton->SetStyle(nBits);
assert(mpHelpButton->GetStyle() & WB_GROUP);
assert(!(mpExtensionsButton->GetStyle() & WB_GROUP));
get(mpAllButtonsBox, "all_buttons_box");
get(mpButtonsBox, "buttons_box");
get(mpSmallButtonsBox, "small_buttons_box");
get(mpAllRecentThumbnails, "all_recent");
get(mpLocalView, "local_view");
maDndWindows.emplace_back(mpAllRecentThumbnails);
mxDropTarget = mxAllRecentThumbnails->GetDropTarget();
try
{
@@ -129,20 +111,19 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) :
TOOLS_WARN_EXCEPTION( "fwk", "BackingWindow" );
}
// fdo#34392: we do the layout dynamically, the layout depends on the font,
// so we should handle data changed events (font changing) of the last child
// control, at this point all the controls have updated settings (i.e. font).
EnableChildTransparentMode();
SetStyle( GetStyle() | WB_DIALOGCONTROL );
// get dispatch provider
Reference<XDesktop2> xDesktop = Desktop::create( comphelper::getProcessComponentContext() );
mxDesktopDispatchProvider = xDesktop;
// init background
SetBackground();
mxOpenButton->grab_focus();
}
IMPL_LINK(BackingWindow, ClickHelpHdl, weld::Button&, rButton, void)
{
if (Help* pHelp = Application::GetHelp())
pHelp->Start(OUString::fromUtf8(m_xContainer->get_help_id()), &rButton);
}
BackingWindow::~BackingWindow()
@@ -155,39 +136,36 @@ void BackingWindow::dispose()
// deregister drag&drop helper
if (mxDropTargetListener.is())
{
for (auto const & pDndWin : maDndWindows)
if (mxDropTarget.is())
{
css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
pDndWin->GetDropTarget();
if (xDropTarget.is())
{
xDropTarget->removeDropTargetListener(mxDropTargetListener);
xDropTarget->setActive(false);
}
mxDropTarget->removeDropTargetListener(mxDropTargetListener);
mxDropTarget->setActive(false);
}
mxDropTargetListener.clear();
}
disposeBuilder();
maDndWindows.clear();
mpOpenButton.clear();
mpRemoteButton.clear();
mpRecentButton.clear();
mpTemplateButton.clear();
mpCreateLabel.clear();
mpWriterAllButton.clear();
mpCalcAllButton.clear();
mpImpressAllButton.clear();
mpDrawAllButton.clear();
mpDBAllButton.clear();
mpMathAllButton.clear();
mpHelpButton.clear();
mpExtensionsButton.clear();
mpAllButtonsBox.clear();
mpButtonsBox.clear();
mpSmallButtonsBox.clear();
mpAllRecentThumbnails.clear();
mpLocalView.clear();
vcl::Window::dispose();
mxDropTarget.clear();
mxOpenButton.reset();
mxRemoteButton.reset();
mxRecentButton.reset();
mxTemplateButton.reset();
mxCreateLabel.reset();
mxAltHelpLabel.reset();
mxWriterAllButton.reset();
mxCalcAllButton.reset();
mxImpressAllButton.reset();
mxDrawAllButton.reset();
mxDBAllButton.reset();
mxMathAllButton.reset();
mxHelpButton.reset();
mxExtensionsButton.reset();
mxAllButtonsBox.reset();
mxButtonsBox.reset();
mxSmallButtonsBox.reset();
mxAllRecentThumbnailsWin.reset();
mxAllRecentThumbnails.reset();
mxLocalViewWin.reset();
mxLocalView.reset();
InterimItemWindow::dispose();
}
void BackingWindow::initControls()
@@ -201,77 +179,73 @@ void BackingWindow::initControls()
SvtModuleOptions aModuleOptions;
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::WRITER))
mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_WRITER;
mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_WRITER;
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::CALC))
mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_CALC;
mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_CALC;
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::IMPRESS))
mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_IMPRESS;
mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_IMPRESS;
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::DRAW))
mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_DRAW;
mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_DRAW;
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::DATABASE))
mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_DATABASE;
mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_DATABASE;
if (aModuleOptions.IsModuleInstalled(SvtModuleOptions::EModule::MATH))
mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_MATH;
mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_MATH;
mpAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_OTHER;
mpAllRecentThumbnails->Reload();
mpAllRecentThumbnails->ShowTooltips( true );
mpRecentButton->SetActive(true);
mxAllRecentThumbnails->mnFileTypes |= sfx2::ApplicationType::TYPE_OTHER;
mxAllRecentThumbnails->Reload();
mxAllRecentThumbnails->ShowTooltips( true );
mxRecentButton->set_active(true);
//initialize Template view
mpLocalView->SetStyle( mpLocalView->GetStyle() | WB_VSCROLL);
mpLocalView->Hide();
mxLocalView->Hide();
mpTemplateButton->SetDelayMenu(true);
mpTemplateButton->SetDropDown(PushButtonDropdownStyle::SplitMenuButton);
mpRecentButton->SetDelayMenu(true);
mpRecentButton->SetDropDown(PushButtonDropdownStyle::SplitMenuButton);
//set handlers
mpLocalView->setCreateContextMenuHdl(LINK(this, BackingWindow, CreateContextMenuHdl));
mpLocalView->setOpenTemplateHdl(LINK(this, BackingWindow, OpenTemplateHdl));
mpLocalView->setEditTemplateHdl(LINK(this, BackingWindow, EditTemplateHdl));
mpLocalView->ShowTooltips( true );
mxLocalView->setCreateContextMenuHdl(LINK(this, BackingWindow, CreateContextMenuHdl));
mxLocalView->setOpenTemplateHdl(LINK(this, BackingWindow, OpenTemplateHdl));
mxLocalView->setEditTemplateHdl(LINK(this, BackingWindow, EditTemplateHdl));
mxLocalView->ShowTooltips( true );
setupButton( mpOpenButton );
setupButton( mpRemoteButton );
setupButton( mpRecentButton );
setupButton( mpTemplateButton );
setupButton( mpWriterAllButton );
setupButton( mpDrawAllButton );
setupButton( mpCalcAllButton );
setupButton( mpDBAllButton );
setupButton( mpImpressAllButton );
setupButton( mpMathAllButton );
setupButton(*mxOpenButton);
setupButton(*mxRemoteButton);
setupButton(*mxRecentButton);
setupButton(*mxTemplateButton);
setupButton(*mxWriterAllButton);
setupButton(*mxDrawAllButton);
setupButton(*mxCalcAllButton);
setupButton(*mxDBAllButton);
setupButton(*mxImpressAllButton);
setupButton(*mxMathAllButton);
checkInstalledModules();
mpExtensionsButton->SetClickHdl(LINK(this, BackingWindow, ExtLinkClickHdl));
mxExtensionsButton->connect_clicked(LINK(this, BackingWindow, ExtLinkClickHdl));
// setup nice colors
vcl::Font aFont(mpCreateLabel->GetSettings().GetStyleSettings().GetLabelFont());
// setup larger font
vcl::Font aFont(mxCreateLabel->get_font());
aFont.SetFontSize(Size(0, aFont.GetFontSize().Height() * fMultiplier));
mpCreateLabel->SetControlFont(aFont);
Resize();
mxCreateLabel->set_font(aFont);
// compute the menubar height
sal_Int32 nMenuHeight = 0;
SystemWindow* pSystemWindow = GetSystemWindow();
if (pSystemWindow)
if (SystemWindow* pSystemWindow = GetSystemWindow())
{
MenuBar* pMenuBar = pSystemWindow->GetMenuBar();
if (pMenuBar)
nMenuHeight = pMenuBar->ImplGetWindow()->GetOutputSizePixel().Height();
}
set_width_request(mpAllRecentThumbnails->get_width_request() + mpAllButtonsBox->GetOptimalSize().Width());
set_height_request(nMenuHeight + mpAllButtonsBox->GetOptimalSize().Height());
// fdo#34392: we do the layout dynamically, the layout depends on the font,
// so we should handle data changed events (font changing) of the last child
// control, at this point all the controls have updated settings (i.e. font).
Size aPrefSize(mxAllButtonsBox->get_preferred_size());
set_width_request(aPrefSize.Width());
set_height_request(nMenuHeight + aPrefSize.Height());
}
void BackingWindow::initializeLocalView()
@@ -279,74 +253,41 @@ void BackingWindow::initializeLocalView()
if (!mbLocalViewInitialized)
{
mbLocalViewInitialized = true;
mpLocalView->Populate();
mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::NONE));
mpLocalView->showAllTemplates();
mxLocalView->Populate();
mxLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::NONE));
mxLocalView->showAllTemplates();
}
}
void BackingWindow::setupButton( PushButton* pButton )
void BackingWindow::setupButton(weld::Button& rButton)
{
// the buttons should have a bit bigger font
vcl::Font aFont(pButton->GetSettings().GetStyleSettings().GetPushButtonFont());
vcl::Font aFont(rButton.get_font());
aFont.SetFontSize(Size(0, aFont.GetFontSize().Height() * fMultiplier));
pButton->SetControlFont(aFont);
pButton->SetClickHdl( LINK( this, BackingWindow, ClickHdl ) );
rButton.set_font(aFont);
rButton.connect_clicked( LINK( this, BackingWindow, ClickHdl ) );
}
void BackingWindow::setupButton( MenuToggleButton* pButton )
void BackingWindow::setupButton(weld::MenuButton& rButton)
{
vcl::Font aFont(pButton->GetSettings().GetStyleSettings().GetPushButtonFont());
vcl::Font aFont(rButton.get_font());
aFont.SetFontSize(Size(0, aFont.GetFontSize().Height() * fMultiplier));
pButton->SetControlFont(aFont);
rButton.set_font(aFont);
PopupMenu* pMenu = pButton->GetPopupMenu();
pMenu->SetMenuFlags(pMenu->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries);
pButton->SetClickHdl(LINK(this, BackingWindow, ClickHdl));
pButton->SetSelectHdl(LINK(this, BackingWindow, MenuSelectHdl));
rButton.connect_clicked(LINK(this, BackingWindow, ClickHdl));
rButton.connect_selected(LINK(this, BackingWindow, MenuSelectHdl));
}
void BackingWindow::checkInstalledModules()
{
SvtModuleOptions aModuleOpt;
mpWriterAllButton->Enable( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ));
mpCalcAllButton->Enable( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) );
mpImpressAllButton->Enable( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) );
mpDrawAllButton->Enable( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) );
mpMathAllButton->Enable(aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ));
mpDBAllButton->Enable(aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ));
}
void BackingWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
{
Resize();
Wallpaper aBack(svtools::ColorConfig().GetColorValue(::svtools::APPBACKGROUND).nColor);
vcl::Region aClip(tools::Rectangle(Point(0, 0), GetOutputSizePixel()));
aClip.Exclude(maStartCentButtons);
rRenderContext.Push(PushFlags::CLIPREGION);
rRenderContext.IntersectClipRegion(aClip);
rRenderContext.DrawWallpaper(tools::Rectangle(Point(0, 0), GetOutputSizePixel()), aBack);
rRenderContext.Pop();
ScopedVclPtrInstance<VirtualDevice> pVDev(rRenderContext);
pVDev->EnableRTL(rRenderContext.IsRTLEnabled());
pVDev->SetOutputSizePixel(maStartCentButtons.GetSize());
Point aOffset(Point(0, 0) - maStartCentButtons.TopLeft());
pVDev->DrawWallpaper(tools::Rectangle(aOffset, GetOutputSizePixel()), aBack);
rRenderContext.DrawOutDev(maStartCentButtons.TopLeft(), maStartCentButtons.GetSize(),
Point(0, 0), maStartCentButtons.GetSize(),
*pVDev);
mxWriterAllButton->set_sensitive( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::WRITER ));
mxCalcAllButton->set_sensitive( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::CALC ) );
mxImpressAllButton->set_sensitive( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) );
mxDrawAllButton->set_sensitive( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DRAW ) );
mxMathAllButton->set_sensitive(aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::MATH ));
mxDBAllButton->set_sensitive(aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ));
}
bool BackingWindow::PreNotify(NotifyEvent& rNEvt)
@@ -356,42 +297,44 @@ bool BackingWindow::PreNotify(NotifyEvent& rNEvt)
const KeyEvent* pEvt = rNEvt.GetKeyEvent();
const vcl::KeyCode& rKeyCode(pEvt->GetKeyCode());
bool bThumbnailHasFocus = mxAllRecentThumbnails->HasFocus() || mxLocalView->HasFocus();
// Subwindows of BackingWindow: Sidebar and Thumbnail view
if( rKeyCode.GetCode() == KEY_F6 )
{
if( rKeyCode.IsShift() ) // Shift + F6
{
if( mpAllRecentThumbnails->HasFocus() || mpLocalView->HasFocus())
if (bThumbnailHasFocus)
{
mpOpenButton->GrabFocus();
mxOpenButton->grab_focus();
return true;
}
}
else if ( rKeyCode.IsMod1() ) // Ctrl + F6
{
if(mpAllRecentThumbnails->IsVisible())
if(mxAllRecentThumbnails->IsVisible())
{
mpAllRecentThumbnails->GrabFocus();
mxAllRecentThumbnails->GrabFocus();
return true;
}
else if(mpLocalView->IsVisible())
else if(mxLocalView->IsVisible())
{
mpLocalView->GrabFocus();
mxLocalView->GrabFocus();
return true;
}
}
else // F6
{
if( mpAllButtonsBox->HasChildPathFocus() )
if (!bThumbnailHasFocus)
{
if(mpAllRecentThumbnails->IsVisible())
if(mxAllRecentThumbnails->IsVisible())
{
mpAllRecentThumbnails->GrabFocus();
mxAllRecentThumbnails->GrabFocus();
return true;
}
else if(mpLocalView->IsVisible())
else if(mxLocalView->IsVisible())
{
mpLocalView->GrabFocus();
mxLocalView->GrabFocus();
return true;
}
}
@@ -413,8 +356,7 @@ bool BackingWindow::PreNotify(NotifyEvent& rNEvt)
{
Accelerator::ToggleMnemonicsOnHierarchy(*rNEvt.GetCommandEvent(), this);
}
return Window::PreNotify( rNEvt );
return InterimItemWindow::PreNotify( rNEvt );
}
void BackingWindow::GetFocus()
@@ -424,16 +366,19 @@ void BackingWindow::GetFocus()
{
if( nFlags & GetFocusFlags::Forward ) // F6
{
mpOpenButton->GrabFocus();
mxOpenButton->grab_focus();
return;
}
else // Shift + F6 or Ctrl + F6
{
mpAllRecentThumbnails->GrabFocus();
if(mxAllRecentThumbnails->IsVisible())
mxAllRecentThumbnails->GrabFocus();
else if(mxLocalView->IsVisible())
mxLocalView->GrabFocus();
return;
}
}
Window::GetFocus();
InterimItemWindow::GetFocus();
}
void BackingWindow::setOwningFrame( const css::uno::Reference< css::frame::XFrame >& xFrame )
@@ -445,35 +390,18 @@ void BackingWindow::setOwningFrame( const css::uno::Reference< css::frame::XFram
// establish drag&drop mode
mxDropTargetListener.set(new OpenFileDropTargetListener(mxContext, mxFrame));
for (auto const & pDndWin : maDndWindows)
if (mxDropTarget.is())
{
css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
pDndWin->GetDropTarget();
if (xDropTarget.is())
{
xDropTarget->addDropTargetListener(mxDropTargetListener);
xDropTarget->setActive(true);
}
mxDropTarget->addDropTargetListener(mxDropTargetListener);
mxDropTarget->setActive(true);
}
}
void BackingWindow::Resize()
{
maStartCentButtons = tools::Rectangle( Point(0, 0), GetOutputSizePixel() );
if (isLayoutEnabled(this))
VclContainer::setLayoutAllocation(*GetWindow(GetWindowType::FirstChild),
maStartCentButtons.TopLeft(), maStartCentButtons.GetSize());
if (!IsInPaint())
Invalidate();
}
IMPL_LINK(BackingWindow, ExtLinkClickHdl, Button*, pButton, void)
IMPL_LINK(BackingWindow, ExtLinkClickHdl, weld::Button&, rButton, void)
{
OUString aNode;
if (pButton == mpExtensionsButton)
if (&rButton == mxExtensionsButton.get())
aNode = "AddFeatureURL";
if (aNode.isEmpty())
@@ -509,22 +437,22 @@ IMPL_LINK(BackingWindow, ExtLinkClickHdl, Button*, pButton, void)
}
}
IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton, void )
IMPL_LINK( BackingWindow, ClickHdl, weld::Button&, rButton, void )
{
// dispatch the appropriate URL and end the dialog
if( pButton == mpWriterAllButton )
if( &rButton == mxWriterAllButton.get() )
dispatchURL( "private:factory/swriter" );
else if( pButton == mpCalcAllButton )
else if( &rButton == mxCalcAllButton.get() )
dispatchURL( "private:factory/scalc" );
else if( pButton == mpImpressAllButton )
else if( &rButton == mxImpressAllButton.get() )
dispatchURL( "private:factory/simpress?slot=6686" );
else if( pButton == mpDrawAllButton )
else if( &rButton == mxDrawAllButton.get() )
dispatchURL( "private:factory/sdraw" );
else if( pButton == mpDBAllButton )
else if( &rButton == mxDBAllButton.get() )
dispatchURL( "private:factory/sdatabase?Interactive" );
else if( pButton == mpMathAllButton )
else if( &rButton == mxMathAllButton.get() )
dispatchURL( "private:factory/smath" );
else if( pButton == mpOpenButton )
else if( &rButton == mxOpenButton.get() )
{
Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY );
@@ -535,7 +463,7 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton, void )
dispatchURL( ".uno:Open", OUString(), xFrame, aArgs );
}
else if( pButton == mpRemoteButton )
else if( &rButton == mxRemoteButton.get() )
{
Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY );
@@ -543,60 +471,56 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton, void )
dispatchURL( ".uno:OpenRemote", OUString(), xFrame, aArgs );
}
else if( pButton == mpRecentButton )
else if( &rButton == mxRecentButton.get() )
{
mpLocalView->Hide();
mpAllRecentThumbnails->Show();
mpAllRecentThumbnails->GrabFocus();
mpRecentButton->SetActive(true);
mpTemplateButton->SetActive(false);
mpTemplateButton->Invalidate();
mxLocalView->Hide();
mxAllRecentThumbnails->Show();
mxAllRecentThumbnails->GrabFocus();
mxRecentButton->set_active(true);
mxTemplateButton->set_active(false);
}
else if( pButton == mpTemplateButton )
else if( &rButton == mxTemplateButton.get() )
{
mpAllRecentThumbnails->Hide();
mxAllRecentThumbnails->Hide();
initializeLocalView();
mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::NONE));
mpLocalView->Show();
mpLocalView->reload();
mpLocalView->GrabFocus();
mpRecentButton->SetActive(false);
mpRecentButton->Invalidate();
mpTemplateButton->SetActive(true);
mxLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::NONE));
mxLocalView->Show();
mxLocalView->reload();
mxLocalView->GrabFocus();
mxRecentButton->set_active(false);
mxTemplateButton->set_active(true);
}
}
IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton, void )
IMPL_LINK (BackingWindow, MenuSelectHdl, const OString&, rId, void)
{
if(pButton == mpRecentButton)
if (rId == "clear_all")
{
SvtHistoryOptions().Clear(ePICKLIST);
mpAllRecentThumbnails->Reload();
mxAllRecentThumbnails->Reload();
return;
}
else if(pButton == mpTemplateButton)
else if (!rId.isEmpty())
{
initializeLocalView();
OString sId = pButton->GetCurItemIdent();
if( sId == "filter_writer" )
if( rId == "filter_writer" )
{
mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::WRITER));
mxLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::WRITER));
}
else if( sId == "filter_calc" )
else if( rId == "filter_calc" )
{
mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::CALC));
mxLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::CALC));
}
else if( sId == "filter_impress" )
else if( rId == "filter_impress" )
{
mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::IMPRESS));
mxLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::IMPRESS));
}
else if( sId == "filter_draw" )
else if( rId == "filter_draw" )
{
mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::DRAW));
mxLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::DRAW));
}
else if( sId == "manage" )
else if( rId == "manage" )
{
Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY );
@@ -609,13 +533,12 @@ IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton, void )
return;
}
mpAllRecentThumbnails->Hide();
mpLocalView->Show();
mpLocalView->reload();
mpLocalView->GrabFocus();
mpRecentButton->SetActive(false);
mpTemplateButton->SetActive(true);
mpRecentButton->Invalidate();
mxAllRecentThumbnails->Hide();
mxLocalView->Show();
mxLocalView->reload();
mxLocalView->GrabFocus();
mxRecentButton->set_active(false);
mxTemplateButton->set_active(true);
}
}
@@ -624,7 +547,7 @@ IMPL_LINK(BackingWindow, CreateContextMenuHdl, ThumbnailViewItem*, pItem, void)
const TemplateViewItem *pViewItem = dynamic_cast<TemplateViewItem*>(pItem);
if (pViewItem)
mpLocalView->createContextMenu();
mxLocalView->createContextMenu();
}
IMPL_LINK(BackingWindow, OpenTemplateHdl, ThumbnailViewItem*, pItem, void)
@@ -753,17 +676,8 @@ void BackingWindow::dispatchURL( const OUString& i_rURL,
}
}
Size BackingWindow::GetOptimalSize() const
{
if (isLayoutEnabled(this))
return VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
return Window::GetOptimalSize();
}
void BackingWindow::clearRecentFileList()
{
mpAllRecentThumbnails->Clear();
set_width_request(mpAllRecentThumbnails->get_width_request() + mpAllButtonsBox->GetOptimalSize().Width());
mxAllRecentThumbnails->Clear();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab:*/

View File

@@ -22,11 +22,7 @@
#include <rtl/ustring.hxx>
#include <vcl/builder.hxx>
#include <vcl/button.hxx>
#include <vcl/layout.hxx>
#include <vcl/menubtn.hxx>
#include <vcl/InterimItemWindow.hxx>
#include <recentdocsview.hxx>
#include <templatedefaultview.hxx>
@@ -40,7 +36,7 @@
#include <memory>
class BackingWindow : public vcl::Window, public VclBuilderContainer
class BackingWindow : public InterimItemWindow
{
css::uno::Reference<css::uno::XComponentContext> mxContext;
css::uno::Reference<css::frame::XDispatchProvider> mxDesktopDispatchProvider;
@@ -49,49 +45,53 @@ class BackingWindow : public vcl::Window, public VclBuilderContainer
/** helper for drag&drop. */
css::uno::Reference<css::datatransfer::dnd::XDropTargetListener> mxDropTargetListener;
VclPtr<PushButton> mpOpenButton;
VclPtr<MenuToggleButton> mpRecentButton;
VclPtr<PushButton> mpRemoteButton;
VclPtr<MenuToggleButton> mpTemplateButton;
std::unique_ptr<weld::Button> mxOpenButton;
std::unique_ptr<weld::MenuToggleButton> mxRecentButton;
std::unique_ptr<weld::Button> mxRemoteButton;
std::unique_ptr<weld::MenuToggleButton> mxTemplateButton;
VclPtr<FixedText> mpCreateLabel;
std::unique_ptr<weld::Label> mxCreateLabel;
std::unique_ptr<weld::Label> mxAltHelpLabel;
VclPtr<PushButton> mpWriterAllButton;
VclPtr<PushButton> mpCalcAllButton;
VclPtr<PushButton> mpImpressAllButton;
VclPtr<PushButton> mpDrawAllButton;
VclPtr<PushButton> mpDBAllButton;
VclPtr<PushButton> mpMathAllButton;
std::unique_ptr<weld::Button> mxWriterAllButton;
std::unique_ptr<weld::Button> mxCalcAllButton;
std::unique_ptr<weld::Button> mxImpressAllButton;
std::unique_ptr<weld::Button> mxDrawAllButton;
std::unique_ptr<weld::Button> mxDBAllButton;
std::unique_ptr<weld::Button> mxMathAllButton;
VclPtr<PushButton> mpHelpButton;
VclPtr<PushButton> mpExtensionsButton;
std::unique_ptr<weld::Button> mxHelpButton;
std::unique_ptr<weld::Button> mxExtensionsButton;
VclPtr<VclBox> mpAllButtonsBox;
VclPtr<VclBox> mpButtonsBox;
VclPtr<VclBox> mpSmallButtonsBox;
std::unique_ptr<weld::Container> mxAllButtonsBox;
std::unique_ptr<weld::Container> mxButtonsBox;
std::unique_ptr<weld::Container> mxSmallButtonsBox;
VclPtr<sfx2::RecentDocsView> mpAllRecentThumbnails;
VclPtr<TemplateDefaultView> mpLocalView;
std::unique_ptr<sfx2::RecentDocsView> mxAllRecentThumbnails;
std::unique_ptr<weld::CustomWeld> mxAllRecentThumbnailsWin;
std::unique_ptr<TemplateDefaultView> mxLocalView;
std::unique_ptr<weld::CustomWeld> mxLocalViewWin;
bool mbLocalViewInitialized;
std::vector< VclPtr<vcl::Window> > maDndWindows;
css::uno::Reference<css::datatransfer::dnd::XDropTarget> mxDropTarget;
tools::Rectangle maStartCentButtons;
bool mbInitControls;
std::unique_ptr<svt::AcceleratorExecute> mpAccExec;
void setupButton(PushButton* pButton);
void setupButton(MenuToggleButton* pButton);
void setupButton(weld::Button& rButton);
void setupButton(weld::MenuButton& rButton);
void dispatchURL(const OUString& i_rURL,
const OUString& i_rTarget = OUString("_default"),
const css::uno::Reference<css::frame::XDispatchProvider >& i_xProv = css::uno::Reference<css::frame::XDispatchProvider>(),
const css::uno::Sequence<css::beans::PropertyValue >& = css::uno::Sequence<css::beans::PropertyValue>());
DECL_LINK(ClickHdl, Button*, void);
DECL_LINK(MenuSelectHdl, MenuButton*, void);
DECL_LINK(ExtLinkClickHdl, Button*, void);
DECL_LINK(ClickHdl, weld::Button&, void);
DECL_LINK(ClickHelpHdl, weld::Button&, void);
DECL_LINK(MenuSelectHdl, const OString&, void);
DECL_LINK(ExtLinkClickHdl, weld::Button&, void);
DECL_LINK(CreateContextMenuHdl, ThumbnailViewItem*, void);
DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*, void);
DECL_LINK(EditTemplateHdl, ThumbnailViewItem*, void);
@@ -107,13 +107,9 @@ public:
virtual ~BackingWindow() override;
virtual void dispose() override;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
virtual void Resize() override;
virtual bool PreNotify(NotifyEvent& rNEvt) override;
virtual void GetFocus() override;
virtual Size GetOptimalSize() const override;
void setOwningFrame(const css::uno::Reference<css::frame::XFrame>& xFrame );
void clearRecentFileList();

View File

@@ -482,8 +482,6 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, const OString&, rIdent, void)
void SfxTemplateManagerDlg::DefaultTemplateMenuSelectHdl(const OString& rIdent)
{
fprintf(stderr, "DefaultTemplateMenuSelectHdl ident %s\n", rIdent.getStr());
OUString aServiceName = SfxObjectShell::GetServiceNameFromFactory(OUString::fromUtf8(rIdent));
OUString sPrevDefault = SfxObjectFactory::GetStandardTemplate( aServiceName );

View File

@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.36.0 -->
<interface domain="sfx">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="3.0"/>
<object class="GtkImage" id="calc_all_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">res/ods_32_8.png</property>
<property name="icon_name">res/ods_32_8.png</property>
</object>
<object class="GtkMenu" id="clearmenu">
<property name="visible">True</property>
@@ -22,12 +21,12 @@
<object class="GtkImage" id="database_all_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">res/odb_32_8.png</property>
<property name="icon_name">res/odb_32_8.png</property>
</object>
<object class="GtkImage" id="draw_all_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">res/odg_32_8.png</property>
<property name="icon_name">res/odg_32_8.png</property>
</object>
<object class="GtkMenu" id="filtermenu">
<property name="visible">True</property>
@@ -77,40 +76,51 @@
<object class="GtkImage" id="impress_all_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">res/odp_32_8.png</property>
<property name="icon_name">res/odp_32_8.png</property>
</object>
<object class="GtkMenu" id="localmenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<object class="GtkImage" id="math_all_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">res/odf_32_8.png</property>
<property name="icon_name">res/odf_32_8.png</property>
</object>
<object class="GtkImage" id="open_all_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">framework/res/folder_32.png</property>
<property name="icon_name">framework/res/folder_32.png</property>
</object>
<object class="GtkImage" id="open_all_image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">framework/res/recent-documents.png</property>
<property name="icon_name">framework/res/recent-documents.png</property>
</object>
<object class="GtkImage" id="open_all_image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">framework/res/remote-documents.png</property>
<property name="icon_name">framework/res/remote-documents.png</property>
</object>
<object class="GtkMenu" id="recentmenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<object class="GtkImage" id="templates_all_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">framework/res/templates_32.png</property>
<property name="icon_name">framework/res/templates_32.png</property>
</object>
<object class="GtkImage" id="writer_all_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">res/odt_32_8.png</property>
<property name="icon_name">res/odt_32_8.png</property>
</object>
<object class="GtkBox" id="StartCenter">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
@@ -137,7 +147,6 @@
<object class="GtkBox" id="buttons_box">
<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">3</property>
@@ -154,6 +163,7 @@
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -173,6 +183,7 @@
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -194,8 +205,9 @@
</packing>
</child>
<child>
<object class="GtkToggleButton" id="open_recent:clearmenu">
<object class="GtkMenuButton" id="open_recent">
<property name="label" translatable="yes" context="startcenter|open_recent">_Recent Files</property>
<property name="name">MenuToggleButton</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -205,6 +217,10 @@
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="always_show_image">True</property>
<property name="draw_indicator">True</property>
<property name="popup">clearmenu</property>
<property name="use_popover">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -213,8 +229,9 @@
</packing>
</child>
<child>
<object class="GtkToggleButton" id="templates_all:filtermenu">
<object class="GtkMenuButton" id="templates_all">
<property name="label" translatable="yes" context="startcenter|templates_all">T_emplates</property>
<property name="name">MenuToggleButton</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -224,6 +241,10 @@
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="always_show_image">True</property>
<property name="draw_indicator">True</property>
<property name="popup">filtermenu</property>
<property name="use_popover">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -271,6 +292,7 @@
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -290,6 +312,7 @@
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -309,6 +332,7 @@
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -328,6 +352,7 @@
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -347,6 +372,7 @@
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -366,6 +392,7 @@
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -474,6 +501,8 @@
<object class="GtkBox" id="box2">
<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>
<child>
<object class="GtkLabel" id="all_recent_label">
@@ -502,12 +531,29 @@
</packing>
</child>
<child>
<object class="sfxlo-RecentDocsView" id="all_recent">
<object class="GtkScrolledWindow" id="scrollrecent">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin">0</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkDrawingArea" id="all_recent">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
@@ -516,12 +562,29 @@
</packing>
</child>
<child>
<object class="sfxlo-TemplateDefaultView" id="local_view">
<object class="GtkScrolledWindow" id="scrolllocal">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin">0</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkDrawingArea" id="local_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>

View File

@@ -719,9 +719,7 @@ custom_widgets = [
'ManagedMenuButton',
'PriorityHBox',
'PriorityMergedHBox',
'RecentDocsView',
'SidebarToolBox',
'TemplateDefaultView',
]
def get_constructor_guard(constructor):

View File

@@ -32,7 +32,6 @@ sfx2/uiconfig/ui/loadtemplatedialog.ui://GtkDrawingArea[@id='image'] no-labelled
sfx2/uiconfig/ui/managestylepage.ui://GtkLabel[@id='desc'] orphan-label
sfx2/uiconfig/ui/password.ui://GtkLabel[@id='minlenft'] orphan-label
sfx2/uiconfig/ui/startcenter.ui://GtkLabel[@id='create_label'] orphan-label
sfx2/uiconfig/ui/startcenter.ui://GtkImage[@id='motif'] no-labelled-by
sfx2/uiconfig/ui/startcenter.ui://GtkLabel[@id='althelplabel'] orphan-label
sfx2/uiconfig/ui/templatepanel.ui://GtkToggleToolButton[@id='1'] button-no-label
sfx2/uiconfig/ui/templatepanel.ui://GtkToggleToolButton[@id='2'] button-no-label

View File

@@ -725,6 +725,7 @@ gboolean GtkSalMenu::SignalKey(GdkEventKey const * pEvent)
{
if (pEvent->keyval == GDK_KEY_F6)
{
fprintf(stderr, "GtkSalMenu::SignalKey\n");
mbReturnFocusToDocument = false;
gtk_menu_shell_cancel(GTK_MENU_SHELL(mpMenuBarWidget));
//because we return false here, the keypress will continue