summaryrefslogtreecommitdiff
path: root/sd/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui')
-rw-r--r--sd/source/ui/func/fupage.cxx62
-rw-r--r--sd/source/ui/inc/fupage.hxx2
-rw-r--r--sd/source/ui/sidebar/MasterPageDescriptor.cxx1
-rw-r--r--sd/source/ui/sidebar/SlideBackground.cxx10
4 files changed, 55 insertions, 20 deletions
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index ba77b29c54ef..b410cacb0a1e 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -26,6 +26,7 @@
#include <svl/itempool.hxx>
#include <sfx2/request.hxx>
#include <vcl/prntypes.hxx>
+#include <vcl/graphicfilter.hxx>
#include <stlsheet.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/frmdiritem.hxx>
@@ -111,7 +112,7 @@ rtl::Reference<FuPoor> FuPage::Create( ViewShell* pViewSh, ::sd::Window* pWin, :
return xFunc;
}
-void FuPage::DoExecute( SfxRequest& )
+void FuPage::DoExecute(SfxRequest& rReq)
{
mpDrawViewShell = dynamic_cast<DrawViewShell*>(mpViewShell);
DBG_ASSERT( mpDrawViewShell, "sd::FuPage::FuPage(), called without a current DrawViewShell!" );
@@ -129,10 +130,11 @@ void FuPage::DoExecute( SfxRequest& )
return;
// if there are no arguments given, open the dialog
- if( !mpArgs )
+ const SfxPoolItem* pItem;
+ if (!mpArgs || mpArgs->GetItemState(SID_SELECT_BACKGROUND, true, &pItem) == SfxItemState::SET)
{
mpView->SdrEndTextEdit();
- mpArgs = ExecuteDialog(mpWindow ? mpWindow->GetFrameWeld() : nullptr);
+ mpArgs = ExecuteDialog(mpWindow ? mpWindow->GetFrameWeld() : nullptr, rReq);
}
// if we now have arguments, apply them to current page
@@ -189,7 +191,7 @@ void MergePageBackgroundFilling(SdPage *pPage, SdStyleSheet *pStyleSheet, bool b
}
}
-const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent)
+const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, SfxRequest& rReq)
{
if (!mpDrawViewShell)
return nullptr;
@@ -288,27 +290,51 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent)
}
else if (nId == SID_SELECT_BACKGROUND)
{
- SvxOpenGraphicDialog aDlg(SdResId(STR_SET_BACKGROUND_PICTURE), pParent);
+ OUString aFileName;
+ OUString aFilterName;
+ Graphic aGraphic;
+ ErrCode nError = ERRCODE_GRFILTER_OPENERROR;
- if( aDlg.Execute() == ERRCODE_NONE )
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+
+ if (pArgs && pArgs->GetItemState(SID_SELECT_BACKGROUND, true, &pItem) == SfxItemState::SET)
{
- Graphic aGraphic;
- ErrCode nError = aDlg.GetGraphic(aGraphic);
- if( nError == ERRCODE_NONE )
- {
- pTempSet.reset( new SfxItemSet( mpDoc->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}) );
+ aFileName = static_cast<const SfxStringItem*>(pItem)->GetValue();
- pTempSet->Put( XFillStyleItem( drawing::FillStyle_BITMAP ) );
+ if (pArgs->GetItemState(FN_PARAM_FILTER, true, &pItem) == SfxItemState::SET)
+ aFilterName = static_cast<const SfxStringItem*>(pItem)->GetValue();
- // MigrateItemSet makes sure the XFillBitmapItem will have a unique name
- SfxItemSet aMigrateSet( mpDoc->GetPool(), svl::Items<XATTR_FILLBITMAP, XATTR_FILLBITMAP>{} );
- aMigrateSet.Put(XFillBitmapItem("background", aGraphic));
- SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDoc );
+ nError = GraphicFilter::LoadGraphic(aFileName, aFilterName, aGraphic,
+ &GraphicFilter::GetGraphicFilter());
+ }
+ else
+ {
+ SvxOpenGraphicDialog aDlg(SdResId(STR_SET_BACKGROUND_PICTURE), pParent);
- pTempSet->Put( XFillBmpStretchItem( true ));
- pTempSet->Put( XFillBmpTileItem( false ));
+ nError = aDlg.Execute();
+ if (nError != ERRCODE_NONE)
+ {
+ nError = aDlg.GetGraphic(aGraphic);
+ aFileName = aDlg.GetPath();
+ aFilterName = aDlg.GetDetectedFilter();
}
}
+
+ if (nError == ERRCODE_NONE)
+ {
+ pTempSet.reset( new SfxItemSet( mpDoc->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}) );
+
+ pTempSet->Put( XFillStyleItem( drawing::FillStyle_BITMAP ) );
+
+ // MigrateItemSet makes sure the XFillBitmapItem will have a unique name
+ SfxItemSet aMigrateSet( mpDoc->GetPool(), svl::Items<XATTR_FILLBITMAP, XATTR_FILLBITMAP>{} );
+ aMigrateSet.Put(XFillBitmapItem("background", aGraphic));
+ SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDoc );
+
+ pTempSet->Put( XFillBmpStretchItem( true ));
+ pTempSet->Put( XFillBmpTileItem( false ));
+ }
}
else
diff --git a/sd/source/ui/inc/fupage.hxx b/sd/source/ui/inc/fupage.hxx
index a33277d9fa3e..a17ce7b1adc5 100644
--- a/sd/source/ui/inc/fupage.hxx
+++ b/sd/source/ui/inc/fupage.hxx
@@ -42,7 +42,7 @@ class FuPage
virtual void Activate() override;
virtual void Deactivate() override;
- const SfxItemSet* ExecuteDialog(weld::Window* pParent);
+ const SfxItemSet* ExecuteDialog(weld::Window* pParent, SfxRequest& rReq);
protected:
virtual ~FuPage() override;
diff --git a/sd/source/ui/sidebar/MasterPageDescriptor.cxx b/sd/source/ui/sidebar/MasterPageDescriptor.cxx
index 8151a4f6918c..0f9d21a81c2c 100644
--- a/sd/source/ui/sidebar/MasterPageDescriptor.cxx
+++ b/sd/source/ui/sidebar/MasterPageDescriptor.cxx
@@ -207,6 +207,7 @@ bool MasterPageDescriptor::UpdatePreview (
{
pPage = mpMasterPage;
}
+ //TODO: Notify LOOL of preview updates.
maLargePreview = (*mpPreviewProvider)(
rLargeSize.Width(),
pPage,
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index e7e7424a8932..12df05bfa0d9 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -298,6 +298,14 @@ void SlideBackground::HandleContextChange(
mpInsertImage->Show();
}
+ // The Insert Image button in the sidebar issues .uno:SelectBackground,
+ // which when invoked without arguments will open the file-open-dialog
+ // to prompt the user to select a file. This is useless in LOOL.
+ // Hide for now so the user will only be able to use the menu to insert
+ // background image, which prompts the user for file selection in the browser.
+ if (comphelper::LibreOfficeKit::isActive())
+ mpInsertImage->Hide();
+
// Need to do a relayouting, otherwise the panel size is not updated after show / hide controls
sfx2::sidebar::Panel* pPanel = dynamic_cast<sfx2::sidebar::Panel*>(GetParent());
if(pPanel)
@@ -864,7 +872,7 @@ void SlideBackground::NotifyItemUpdate(
if (pSizeItem)
{
Size aPaperSize = pSizeItem->GetSize();
- if(mpPaperOrientation->GetSelectedEntryPos() == 0)
+ if (mpPaperOrientation->GetSelectedEntryPos() == 0)
Swap(aPaperSize);
Paper ePaper = SvxPaperInfo::GetSvxPaper(aPaperSize, meUnit);