summaryrefslogtreecommitdiff
path: root/cui/source
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source')
-rw-r--r--cui/source/customize/cfg.cxx81
-rw-r--r--cui/source/dialogs/welcomedlg.cxx111
-rw-r--r--cui/source/dialogs/whatsnewtabpage.cxx89
-rw-r--r--cui/source/factory/dlgfact.cxx6
-rw-r--r--cui/source/factory/dlgfact.hxx2
-rw-r--r--cui/source/inc/welcomedlg.hxx31
-rw-r--r--cui/source/inc/whatsnewtabpage.hxx41
7 files changed, 315 insertions, 46 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 0bd6b44ede66..c2a2fc1f1a48 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -3061,21 +3061,16 @@ namespace
void SvxIconSelectorDialog::ImportGraphics(
const uno::Sequence< OUString >& rPaths )
{
- std::vector< OUString > rejected( rPaths.getLength() );
- sal_Int32 rejectedCount = 0;
-
- sal_uInt16 ret = 0;
- sal_Int32 aIndex;
- OUString aIconName;
+ std::vector<OUString> rejected;
if ( rPaths.getLength() == 1 )
{
if ( m_xImportedImageManager->hasImage( SvxConfigPageHelper::GetImageType(), rPaths[0] ) )
{
- aIndex = rPaths[0].lastIndexOf( '/' );
- aIconName = rPaths[0].copy( aIndex+1 );
+ sal_Int32 aIndex = rPaths[0].lastIndexOf('/');
+ OUString aIconName = rPaths[0].copy(aIndex + 1);
SvxIconReplacementDialog aDlg(m_xDialog.get(), aIconName, false);
- ret = aDlg.run();
+ sal_uInt16 ret = aDlg.run();
if ( ret == 2 )
{
ReplaceGraphicItem( rPaths[0] );
@@ -3085,72 +3080,66 @@ void SvxIconSelectorDialog::ImportGraphics(
{
if ( !ImportGraphic( rPaths[0] ) )
{
- rejected[0] = rPaths[0];
- rejectedCount = 1;
+ rejected.push_back(rPaths[0]);
}
}
}
else
{
OUString aSourcePath( rPaths[0] );
- if ( rPaths[0].lastIndexOf( '/' ) != rPaths[0].getLength() -1 )
- aSourcePath = rPaths[0] + "/";
+ if (!aSourcePath.endsWith("/"))
+ aSourcePath += "/";
+ bool replaceAll = false;
for ( sal_Int32 i = 1; i < rPaths.getLength(); ++i )
{
OUString aPath = aSourcePath + rPaths[i];
+ bool result = true;
if ( m_xImportedImageManager->hasImage( SvxConfigPageHelper::GetImageType(), aPath ) )
{
- aIndex = rPaths[i].lastIndexOf( '/' );
- aIconName = rPaths[i].copy( aIndex+1 );
- SvxIconReplacementDialog aDlg(m_xDialog.get(), aIconName, true);
- ret = aDlg.run();
- if ( ret == 2 )
- {
- ReplaceGraphicItem( aPath );
- }
- else if ( ret == 5 )
+ bool replace = replaceAll;
+ if (!replace)
{
- for ( sal_Int32 k = i; k < rPaths.getLength(); ++k )
+ sal_Int32 aIndex = rPaths[i].lastIndexOf('/');
+ OUString aIconName = rPaths[i].copy(aIndex + 1);
+ SvxIconReplacementDialog aDlg(m_xDialog.get(), aIconName, true);
+ sal_uInt16 ret = aDlg.run();
+ if (ret == 2)
{
- aPath = aSourcePath + rPaths[k];
- bool bHasReplaced = ReplaceGraphicItem( aPath );
-
- if ( !bHasReplaced )
- {
- bool result = ImportGraphic( aPath );
- if ( !result )
- {
- rejected[ rejectedCount ] = rPaths[i];
- ++rejectedCount;
- }
- }
+ replace = true;
}
- break;
+ else if (ret == 5)
+ {
+ replace = true;
+ replaceAll = true;
+ }
+ }
+ if (replace)
+ {
+ ReplaceGraphicItem(aPath);
}
}
else
{
- bool result = ImportGraphic( aSourcePath + rPaths[i] );
- if ( !result )
- {
- rejected[ rejectedCount ] = rPaths[i];
- ++rejectedCount;
- }
+ result = ImportGraphic(aPath);
+ }
+ if (!result)
+ {
+ rejected.push_back(rPaths[i]);
}
}
}
- if ( rejectedCount == 0 )
+ if (rejected.empty())
return;
OUStringBuffer message;
OUString fPath;
- if (rejectedCount > 1)
+ if (rPaths.getLength() > 1)
fPath = OUString::Concat(rPaths[0].subView(8)) + "/";
- for ( sal_Int32 i = 0; i < rejectedCount; ++i )
+ for (const auto& rejected_item : rejected)
{
- message.append(fPath + rejected[i] + "\n");
+ message.append(fPath + rejected_item + "\n");
}
SvxIconChangeDialog aDialog(m_xDialog.get(), message.makeStringAndClear());
diff --git a/cui/source/dialogs/welcomedlg.cxx b/cui/source/dialogs/welcomedlg.cxx
new file mode 100644
index 000000000000..941bda793035
--- /dev/null
+++ b/cui/source/dialogs/welcomedlg.cxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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 <welcomedlg.hxx>
+
+#include <whatsnewtabpage.hxx>
+#include <uitabpage.hxx>
+#include "../options/appearance.hxx"
+
+#include <comphelper/dispatchcommand.hxx>
+
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/sfxresid.hxx>
+#include <sfx2/strings.hrc>
+#include <sfx2/viewfrm.hxx>
+
+constexpr OUString sNewsTab = u"WhatsNewTabPage"_ustr;
+constexpr OUString sUITab = u"UITabPage"_ustr;
+constexpr OUString sAppearanceTab = u"AppearanceTabPage"_ustr;
+
+WelcomeDialog::WelcomeDialog(weld::Window* pParent)
+ : SfxTabDialogController(pParent, u"cui/ui/welcomedialog.ui"_ustr, u"WelcomeDialog"_ustr)
+ , m_xActionBtn(m_xBuilder->weld_button(u"action"_ustr)) // release notes / apply
+ , m_xNextBtn(m_xBuilder->weld_button(u"next"_ustr)) // next / close
+ , m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr)) // hidden
+ , m_xResetBtn(m_xBuilder->weld_button(u"reset"_ustr)) // hidden
+ , m_xCancelBtn(m_xBuilder->weld_button(u"cancel"_ustr)) // hidden
+{
+ m_xDialog->set_title(SfxResId(STR_WELCOME_LINE1));
+
+ AddTabPage(sNewsTab, WhatsNewTabPage::Create, nullptr);
+ AddTabPage(sUITab, UITabPage::Create, nullptr);
+ AddTabPage(sAppearanceTab, SvxAppearanceTabPage::Create, nullptr);
+
+ m_xTabCtrl->connect_enter_page(LINK(this, WelcomeDialog, OnActivatePage));
+ m_xResetBtn->set_visible(false);
+ m_xOKBtn->set_visible(false);
+ m_xCancelBtn->set_visible(false);
+
+ m_xNextBtn->connect_clicked(LINK(this, WelcomeDialog, OnNextClick));
+ m_xActionBtn->connect_clicked(LINK(this, WelcomeDialog, OnActionClick));
+
+ m_xTabCtrl->set_current_page(sNewsTab);
+ OnActivatePage(sNewsTab);
+}
+
+IMPL_LINK(WelcomeDialog, OnActivatePage, const OUString&, rPage, void)
+{
+ if (rPage == sNewsTab)
+ m_xActionBtn->set_label(SfxResId(STR_CREDITS_BUTTON));
+ else
+ m_xActionBtn->set_label(SfxResId(STR_WELCOME_APPLY));
+
+ if (rPage == sAppearanceTab)
+ m_xNextBtn->set_label(SfxResId(STR_WELCOME_CLOSE));
+ else
+ m_xNextBtn->set_label(SfxResId(STR_WELCOME_NEXT));
+}
+
+IMPL_LINK_NOARG(WelcomeDialog, OnNextClick, weld::Button&, void)
+{
+ const int nCurrentTabPage(m_xTabCtrl->get_current_page());
+
+ if (nCurrentTabPage < 2)
+ {
+ m_xTabCtrl->set_current_page(nCurrentTabPage + 1);
+ OnActivatePage(m_xTabCtrl->get_page_ident(nCurrentTabPage + 1));
+ }
+ else
+ m_xDialog->response(RET_OK);
+}
+
+IMPL_LINK_NOARG(WelcomeDialog, OnActionClick, weld::Button&, void)
+{
+ switch (m_xTabCtrl->get_current_page())
+ {
+ case 0:
+ {
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if (pViewFrame)
+ pViewFrame->GetBindings().GetDispatcher()->Execute(SID_CREDITS);
+ }
+ break;
+ case 1:
+ {
+ UITabPage* pUITabPage = static_cast<UITabPage*>(GetCurTabPage());
+ OUString sCmd = pUITabPage->GetSelectedMode();
+ comphelper::dispatchCommand(".uno:ToolbarMode?Mode:string=" + sCmd, {});
+ }
+ break;
+ case 2:
+ {
+ SvxAppearanceTabPage* pAppearanceTabPage
+ = static_cast<SvxAppearanceTabPage*>(GetCurTabPage());
+ pAppearanceTabPage->FillItemSet(nullptr);
+ }
+ break;
+ default:
+ m_xDialog->response(RET_OK);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ \ No newline at end of file
diff --git a/cui/source/dialogs/whatsnewtabpage.cxx b/cui/source/dialogs/whatsnewtabpage.cxx
new file mode 100644
index 000000000000..128c4d765ff6
--- /dev/null
+++ b/cui/source/dialogs/whatsnewtabpage.cxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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 <whatsnewtabpage.hxx>
+
+#include <config_folders.h>
+#include <rtl/bootstrap.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfxresid.hxx>
+#include <sfx2/strings.hrc>
+#include <sfx2/viewfrm.hxx>
+#include <svx/dlgctrl.hxx>
+#include <vcl/graphicfilter.hxx>
+
+WhatsNewTabPage::WhatsNewTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rAttr)
+ : SfxTabPage(pPage, pController, u"cui/ui/whatsnewtabpage.ui"_ustr, u"WhatsNewTabPage"_ustr,
+ &rAttr)
+ , m_aBrand()
+ , m_pBrand(new weld::CustomWeld(*m_xBuilder, u"imBrand"_ustr, m_aBrand))
+{
+ const Size aGraphicSize = m_aBrand.GetGraphicSize();
+ m_pBrand->set_size_request(aGraphicSize.getWidth(), aGraphicSize.getHeight());
+}
+
+std::unique_ptr<SfxTabPage> WhatsNewTabPage::Create(weld::Container* pPage,
+ weld::DialogController* pController,
+ const SfxItemSet* rAttr)
+{
+ return std::make_unique<WhatsNewTabPage>(pPage, pController, *rAttr);
+}
+
+AnimatedBrand::AnimatedBrand()
+{
+ OUString aURL(u"$BRAND_BASE_DIR/" LIBO_SHARE_SHELL_FOLDER "/animatedbrand.gif"_ustr);
+ rtl::Bootstrap::expandMacros(aURL);
+ GraphicFilter::LoadGraphic(aURL, OUString(), m_pGraphic);
+ m_pGraphicSize = m_pGraphic.GetSizePixel();
+}
+
+void AnimatedBrand::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
+{
+ //clear
+ rRenderContext.SetBackground(COL_WHITE);
+ rRenderContext.Erase();
+
+ const Point aGraphicPosition((rRect.GetWidth() - m_pGraphicSize.Width()),
+ (rRect.GetHeight() - m_pGraphicSize.Height()) >> 1);
+ if (m_pGraphic.IsAnimated() && MiscSettings::IsAnimatedOthersAllowed())
+ m_pGraphic.StartAnimation(rRenderContext, aGraphicPosition, m_pGraphicSize);
+ else
+ m_pGraphic.Draw(rRenderContext, aGraphicPosition, m_pGraphicSize);
+
+ tools::Rectangle aTextRect;
+ if (m_pGraphic.isAvailable())
+ {
+ aTextRect.SetPos(Point(8, 8));
+ aTextRect.SetSize(Size(aGraphicPosition.getX(), m_pGraphicSize.Height() - 20));
+ }
+ else
+ aTextRect = rRect;
+
+ //text
+ OUString sText(SfxResId(STR_WHATSNEW_FIRST));
+
+ vcl::Font aFont = rRenderContext.GetFont();
+ aFont.SetFontSize(Size(0, 24));
+ aFont.SetColor(COL_BLACK);
+ aFont.SetWeight(WEIGHT_BOLD);
+ rRenderContext.SetFont(aFont);
+
+ DrawTextFlags nDrawTextStyle(DrawTextFlags::MultiLine | DrawTextFlags::WordBreak
+ | DrawTextFlags::EndEllipsis);
+ const bool bIsRTL = rRenderContext.GetTextIsRTL(sText, 0, sText.getLength());
+ if (bIsRTL)
+ nDrawTextStyle |= DrawTextFlags::Right;
+
+ aTextRect.shrink(6);
+ aTextRect.setWidth(aTextRect.GetWidth() - 12);
+ rRenderContext.DrawText(aTextRect, sText, nDrawTextStyle);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ \ No newline at end of file
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 34d735b8beb0..60c14b21c92d 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -99,6 +99,7 @@
#include <fileextcheckdlg.hxx>
#include <TextColumnsPage.hxx>
#include <querydialog.hxx>
+#include <welcomedlg.hxx>
#include <MacroManagerDialog.hxx>
@@ -1403,6 +1404,11 @@ public:
};
}
+VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateWelcomeDialog(weld::Window* pParent)
+{
+ return VclPtr<CuiAbstractTabController_Impl<WelcomeDialog>>::Create(pParent);
+}
+
VclPtr<SfxAbstractPasteDialog> AbstractDialogFactory_Impl::CreatePasteDialog(weld::Window* pParent)
{
return VclPtr<AbstractPasteDialog_Impl>::Create(pParent);
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 333b9f7fe230..b758e5ab90ff 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -181,6 +181,8 @@ public:
virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet& rAttr, const SdrModel& rModel, bool bStyle) override;
+ virtual VclPtr<SfxAbstractTabDialog> CreateWelcomeDialog(weld::Window* pParent) override;
+
virtual VclPtr<SvxAbstractSplitTableDialog> CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, tools::Long nMaxVertical) override;
virtual std::shared_ptr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog(weld::Window* pParent) override ;
diff --git a/cui/source/inc/welcomedlg.hxx b/cui/source/inc/welcomedlg.hxx
new file mode 100644
index 000000000000..0af9fbab053a
--- /dev/null
+++ b/cui/source/inc/welcomedlg.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#pragma once
+
+#include <sfx2/tabdlg.hxx>
+
+class WelcomeDialog : public SfxTabDialogController
+{
+private:
+ std::unique_ptr<weld::Button> m_xActionBtn; // release notes / apply
+ std::unique_ptr<weld::Button> m_xNextBtn; // next / close
+ std::unique_ptr<weld::Button> m_xOKBtn; // hidden
+ std::unique_ptr<weld::Button> m_xResetBtn; // hidden
+ std::unique_ptr<weld::Button> m_xCancelBtn; // hidden
+
+ DECL_LINK(OnActivatePage, const OUString&, void);
+ DECL_LINK(OnActionClick, weld::Button&, void);
+ DECL_LINK(OnNextClick, weld::Button&, void);
+
+public:
+ WelcomeDialog(weld::Window* pParent);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/inc/whatsnewtabpage.hxx b/cui/source/inc/whatsnewtabpage.hxx
new file mode 100644
index 000000000000..81d274a7c563
--- /dev/null
+++ b/cui/source/inc/whatsnewtabpage.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#pragma once
+
+#include <vcl/customweld.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <vcl/graph.hxx>
+
+class AnimatedBrand : public weld::CustomWidgetController
+{
+private:
+ Graphic m_pGraphic;
+ Size m_pGraphicSize;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
+
+public:
+ AnimatedBrand();
+ const Size& GetGraphicSize() const { return m_pGraphicSize; };
+};
+
+class WhatsNewTabPage : public SfxTabPage
+{
+private:
+ AnimatedBrand m_aBrand;
+ std::unique_ptr<weld::CustomWeld> m_pBrand;
+
+public:
+ WhatsNewTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rSet);
+ static std::unique_ptr<SfxTabPage>
+ Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */