summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Göthel <sven.gothel@collabora.com>2024-08-02 10:17:50 +0200
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-08-06 11:00:10 +0200
commitca466a4a01657e2dad61ca909bd6ab5188f8ccc9 (patch)
tree3217572c19ed0dc1594e6c570c30b1fbace8fe0e
parentcf22d66c5837f108296b37bc98f17ee96869a7ef (diff)
cool#7710: Make Slide Properties Dialog in Impress Async
How to reproduce the synchronous dialog: - Build in debug mode - Click on 'Format' menu, then sub-menu 'Slide Properties' - The sync-dialog warning shows up This commit updates the dialog from synchronous to asynchronous processing. How to manually test the asynchronous dialog: - Apply patch - Build in debug mode - Click on 'Format' menu, then sub-menu 'Slide Properties' - The 'Slide Properties' modal dialog box opens and is functional. Tested manually within COOL 24.04 (online) with - Changing aspect-ratio and background color FuPage's lifecycle is extended by wrapping itself into rtl::Reference<FuPage> and passing a copy to the async-action lambda-capture, as it is being called from FuTemporary and managed as rtl::Reference<FuPoor>. Otherwised resources are passed to the async-action simply using std::shared_ptr<>. Signed-off-by: Sven Göthel <sven.gothel@collabora.com> Change-Id: I692204403e8a6ee526e7b463c8bf8a41c1416489 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171393 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171508 Tested-by: Jenkins
-rw-r--r--sd/source/ui/func/fupage.cxx317
-rw-r--r--sd/source/ui/inc/fupage.hxx6
2 files changed, 161 insertions, 162 deletions
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index ff48aca5d3be..f8b8fad5b0ba 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -18,6 +18,7 @@
*/
#include <fupage.hxx>
+#include <sal/types.h>
// arrange Tab-Page
@@ -101,8 +102,6 @@ static void mergeItemSetsImpl( SfxItemSet& rTarget, const SfxItemSet& rSource )
FuPage::FuPage( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
SdDrawDocument* pDoc, SfxRequest& rReq )
: FuPoor(pViewSh, pWin, pView, pDoc, rReq),
- mrReq(rReq),
- mpArgs( rReq.GetArgs() ),
mbPageBckgrdDeleted( false ),
mbMasterPage( false ),
mbDisplayBackgroundTabPage( true ),
@@ -132,20 +131,18 @@ void FuPage::DoExecute(SfxRequest& rReq)
mpPage = mpDrawViewShell->getCurrentPage();
}
- if( !mpPage )
+ if( !mpPage ) {
return;
-
- // if there are no arguments given, open the dialog
- if (!mpArgs || mpArgs->GetItemState(SID_SELECT_BACKGROUND) == SfxItemState::SET)
- {
- mpView->SdrEndTextEdit();
- mpArgs = ExecuteDialog(mpWindow ? mpWindow->GetFrameWeld() : nullptr, rReq);
}
-
- // if we now have arguments, apply them to current page
- if( mpArgs )
+ const SfxItemSet *args = rReq.GetArgs();
+ if (!args || args->GetItemState(SID_SELECT_BACKGROUND) == SfxItemState::SET)
{
- ApplyItemSet( mpArgs );
+ // No arguments given -> open the async dialog which may apply new arguments
+ mpView->SdrEndTextEdit();
+ ExecuteAsyncDialog(mpWindow ? mpWindow->GetFrameWeld() : nullptr, rReq);
+ } else {
+ // Have arguments -> apply them to current page in-thread
+ ApplyItemSet( args );
}
}
@@ -196,32 +193,32 @@ void MergePageBackgroundFilling(SdPage *pPage, SdStyleSheet *pStyleSheet, bool b
}
}
-const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest& rReq)
+void FuPage::ExecuteAsyncDialog(weld::Window* pParent, const SfxRequest& rReq)
{
- if (!mpDrawViewShell)
- return nullptr;
-
- SfxItemSetFixed<
- XATTR_FILL_FIRST, XATTR_FILL_LAST,
- EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
- SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER,
- SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW,
- SID_ATTR_PAGE, SID_ATTR_PAGE_SHARED,
- SID_ATTR_CHAR_GRABBAG, SID_ATTR_CHAR_GRABBAG,
- SID_ATTR_PAGE_COLOR, SID_ATTR_PAGE_FILLSTYLE
- > aNewAttr(mpDoc->GetPool());
+ if (!mpDrawViewShell) {
+ return;
+ }
+
+ std::shared_ptr<SfxItemSet> aNewAttr = std::make_shared<
+ SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST,
+ EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
+ SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER,
+ SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW,
+ SID_ATTR_PAGE, SID_ATTR_PAGE_SHARED,
+ SID_ATTR_CHAR_GRABBAG, SID_ATTR_CHAR_GRABBAG,
+ SID_ATTR_PAGE_COLOR, SID_ATTR_PAGE_FILLSTYLE>>(mpDoc->GetPool());
// Keep it sorted
- aNewAttr.MergeRange(mpDoc->GetPool().GetWhichIDFromSlotID(SID_ATTR_LRSPACE),
- mpDoc->GetPool().GetWhichIDFromSlotID(SID_ATTR_ULSPACE));
+ aNewAttr->MergeRange(mpDoc->GetPool().GetWhichIDFromSlotID(SID_ATTR_LRSPACE),
+ mpDoc->GetPool().GetWhichIDFromSlotID(SID_ATTR_ULSPACE));
// Retrieve additional data for dialog
SvxShadowItem aShadowItem(SID_ATTR_BORDER_SHADOW);
- aNewAttr.Put( aShadowItem );
+ aNewAttr->Put( aShadowItem );
SvxBoxItem aBoxItem( SID_ATTR_BORDER_OUTER );
- aNewAttr.Put( aBoxItem );
+ aNewAttr->Put( aBoxItem );
- aNewAttr.Put( SvxFrameDirectionItem(
+ aNewAttr->Put( SvxFrameDirectionItem(
mpDoc->GetDefaultWritingMode() == css::text::WritingMode_RL_TB ? SvxFrameDirection::Horizontal_RL_TB : SvxFrameDirection::Horizontal_LR_TB,
EE_PARA_WRITINGDIR ) );
@@ -232,30 +229,30 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest&
aPageItem.SetPageUsage( SvxPageUsage::All );
aPageItem.SetLandscape( mpPage->GetOrientation() == Orientation::Landscape );
aPageItem.SetNumType( mpDoc->GetPageNumType() );
- aNewAttr.Put( aPageItem );
+ aNewAttr->Put( aPageItem );
// size
maSize = mpPage->GetSize();
SvxSizeItem aSizeItem( SID_ATTR_PAGE_SIZE, maSize );
- aNewAttr.Put( aSizeItem );
+ aNewAttr->Put( aSizeItem );
// Max size
SvxSizeItem aMaxSizeItem( SID_ATTR_PAGE_MAXSIZE, Size( MAXWIDTH, MAXHEIGHT ) );
- aNewAttr.Put( aMaxSizeItem );
+ aNewAttr->Put( aMaxSizeItem );
// paperbin
SvxPaperBinItem aPaperBinItem( SID_ATTR_PAGE_PAPERBIN, static_cast<sal_uInt8>(mpPage->GetPaperBin()) );
- aNewAttr.Put( aPaperBinItem );
+ aNewAttr->Put( aPaperBinItem );
SvxLRSpaceItem aLRSpaceItem( static_cast<sal_uInt16>(mpPage->GetLeftBorder()), static_cast<sal_uInt16>(mpPage->GetRightBorder()), 0, mpDoc->GetPool().GetWhichIDFromSlotID(SID_ATTR_LRSPACE));
- aNewAttr.Put( aLRSpaceItem );
+ aNewAttr->Put( aLRSpaceItem );
SvxULSpaceItem aULSpaceItem( static_cast<sal_uInt16>(mpPage->GetUpperBorder()), static_cast<sal_uInt16>(mpPage->GetLowerBorder()), mpDoc->GetPool().GetWhichIDFromSlotID(SID_ATTR_ULSPACE));
- aNewAttr.Put( aULSpaceItem );
+ aNewAttr->Put( aULSpaceItem );
// Application
bool bScale = mpDoc->GetDocumentType() != DocumentType::Draw;
- aNewAttr.Put( SfxBoolItem( SID_ATTR_PAGE_EXT1, bScale ) );
+ aNewAttr->Put( SfxBoolItem( SID_ATTR_PAGE_EXT1, bScale ) );
bool bFullSize = mpPage->IsMasterPage() ?
mpPage->IsBackgroundFullSize() : static_cast<SdPage&>(mpPage->TRG_GetMasterPage()).IsBackgroundFullSize();
@@ -263,11 +260,11 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest&
SfxGrabBagItem grabBag(SID_ATTR_CHAR_GRABBAG);
grabBag.GetGrabBag()[u"BackgroundFullSize"_ustr] <<= bFullSize;
- aNewAttr.Put(grabBag);
+ aNewAttr->Put(grabBag);
// Merge ItemSet for dialog
- const WhichRangesContainer& rRanges = aNewAttr.GetRanges();
+ const WhichRangesContainer& rRanges = aNewAttr->GetRanges();
sal_uInt16 p1 = rRanges[0].first, p2 = rRanges[0].second;
sal_Int32 idx = 1;
while(idx < rRanges.size() && (rRanges[idx].first - p2 == 1))
@@ -275,27 +272,25 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest&
p2 = rRanges[idx].second;
++idx;
}
- SfxItemSet aMergedAttr( *aNewAttr.GetPool(), p1, p2 );
+ std::shared_ptr<SfxItemSet> aMergedAttr = std::make_shared<SfxItemSet>( *aNewAttr->GetPool(), p1, p2 );
- mergeItemSetsImpl( aMergedAttr, aNewAttr );
+ mergeItemSetsImpl( *aMergedAttr, *aNewAttr );
SdStyleSheet* pStyleSheet = mpPage->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND);
// merge page background filling to the dialogs input set
if( mbDisplayBackgroundTabPage )
{
- MergePageBackgroundFilling(mpPage, pStyleSheet, mbMasterPage, aMergedAttr);
+ MergePageBackgroundFilling(mpPage, pStyleSheet, mbMasterPage, *aMergedAttr);
}
- std::optional< SfxItemSet > pTempSet;
-
const sal_uInt16 nId = GetSlotID();
if (nId == SID_SAVE_BACKGROUND)
{
- const XFillStyleItem& rStyleItem = aMergedAttr.Get(XATTR_FILLSTYLE);
+ const XFillStyleItem& rStyleItem = aMergedAttr->Get(XATTR_FILLSTYLE);
if (drawing::FillStyle_BITMAP == rStyleItem.GetValue())
{
- const XFillBitmapItem& rBitmap = aMergedAttr.Get(XATTR_FILLBITMAP);
+ const XFillBitmapItem& rBitmap = aMergedAttr->Get(XATTR_FILLBITMAP);
const GraphicObject& rGraphicObj = rBitmap.GetGraphicObject();
GraphicHelper::ExportGraphic(pParent, rGraphicObj.GetGraphic(), u""_ustr);
}
@@ -332,159 +327,163 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest&
if (nError == ERRCODE_NONE)
{
- pTempSet.emplace( mpDoc->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST> );
+ SfxItemSet tempSet( mpDoc->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST> );
- pTempSet->Put( XFillStyleItem( drawing::FillStyle_BITMAP ) );
+ tempSet.Put( XFillStyleItem( drawing::FillStyle_BITMAP ) );
// MigrateItemSet makes sure the XFillBitmapItem will have a unique name
SfxItemSetFixed<XATTR_FILLBITMAP, XATTR_FILLBITMAP> aMigrateSet( mpDoc->GetPool() );
aMigrateSet.Put(XFillBitmapItem(u"background"_ustr, std::move(aGraphic)));
- SdrModel::MigrateItemSet( &aMigrateSet, &*pTempSet, *mpDoc );
+ SdrModel::MigrateItemSet( &aMigrateSet, &tempSet, *mpDoc );
- pTempSet->Put( XFillBmpStretchItem( true ));
- pTempSet->Put( XFillBmpTileItem( false ));
+ tempSet.Put( XFillBmpStretchItem( true ));
+ tempSet.Put( XFillBmpTileItem( false ));
+ if( pStyleSheet ) {
+ ApplyItemSet(*pStyleSheet, aNewAttr, tempSet, aMergedAttr);
+ }
}
- }
-
- else
- {
+ } else {
bool bIsImpressDoc = mpDrawViewShell->GetDoc()->GetDocumentType() == DocumentType::Impress;
- // create the dialog
+ // create the dialog and start async execution
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
- ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdTabPageDialog(mpViewShell->GetFrameWeld(), &aMergedAttr, mpDocSh, mbDisplayBackgroundTabPage, bIsImpressDoc) );
- if( pDlg->Execute() == RET_OK )
- pTempSet.emplace( *pDlg->GetOutputItemSet() );
+ VclPtr<SfxAbstractTabDialog> xDlg( pFact->CreateSdTabPageDialog(mpViewShell->GetFrameWeld(),
+ aMergedAttr.get(), mpDocSh, mbDisplayBackgroundTabPage, bIsImpressDoc) );
+ rtl::Reference<FuPage> xThis( this ); // avoid destruction within async processing
+ xDlg->StartExecuteAsync([xDlg, xThis, pStyleSheet, aNewAttr, aMergedAttr](sal_Int32 nResult) {
+ if (nResult == RET_OK && pStyleSheet) {
+ SfxItemSet tempSet(*xDlg->GetOutputItemSet());
+ xThis->ApplyItemSet(*pStyleSheet, aNewAttr, tempSet, aMergedAttr);
+ }
+ xDlg->disposeOnce();
+ // Final release of xThis (post async use, RIAA)
+ });
}
+}
- if (pTempSet && pStyleSheet)
- {
- pStyleSheet->AdjustToFontHeight(*pTempSet);
+void FuPage::ApplyItemSet(SdStyleSheet& styleSheet, std::shared_ptr<SfxItemSet> aNewAttr, SfxItemSet& tempSet, std::shared_ptr<SfxItemSet> aMergedAttr) {
+ styleSheet.AdjustToFontHeight(tempSet);
- if( mbDisplayBackgroundTabPage )
+ if( mbDisplayBackgroundTabPage )
+ {
+ // if some fillstyle-items are not set in the dialog, then
+ // try to use the items before
+ bool bChanges = false;
+ for( sal_uInt16 i=XATTR_FILL_FIRST; i<XATTR_FILL_LAST; i++ )
{
- // if some fillstyle-items are not set in the dialog, then
- // try to use the items before
- bool bChanges = false;
- for( sal_uInt16 i=XATTR_FILL_FIRST; i<XATTR_FILL_LAST; i++ )
+ if( aMergedAttr->GetItemState( i ) != SfxItemState::DEFAULT )
{
- if( aMergedAttr.GetItemState( i ) != SfxItemState::DEFAULT )
- {
- if( pTempSet->GetItemState( i ) == SfxItemState::DEFAULT )
- pTempSet->Put( aMergedAttr.Get( i ) );
- else
- if( !SfxPoolItem::areSame(aMergedAttr.GetItem( i ), pTempSet->GetItem( i ) ) )
- bChanges = true;
+ if( tempSet.GetItemState( i ) == SfxItemState::DEFAULT )
+ tempSet.Put( aMergedAttr->Get( i ) );
+ else {
+ if( !SfxPoolItem::areSame(aMergedAttr->GetItem( i ), tempSet.GetItem( i ) ) ) {
+ bChanges = true;
+ }
}
}
+ }
- // if the background for this page was set to invisible, the background-object has to be deleted, too.
- const XFillStyleItem* pTempFillStyleItem = pTempSet->GetItem<XFillStyleItem>(XATTR_FILLSTYLE);
- assert(pTempFillStyleItem);
- if (pTempFillStyleItem->GetValue() == drawing::FillStyle_NONE)
- mbPageBckgrdDeleted = true;
- else
+ // if the background for this page was set to invisible, the background-object has to be deleted, too.
+ const XFillStyleItem* pTempFillStyleItem = tempSet.GetItem<XFillStyleItem>(XATTR_FILLSTYLE);
+ assert(pTempFillStyleItem);
+ if (pTempFillStyleItem->GetValue() == drawing::FillStyle_NONE)
+ mbPageBckgrdDeleted = true;
+ else
+ {
+ if (tempSet.GetItemState(XATTR_FILLSTYLE) == SfxItemState::DEFAULT)
{
- if (pTempSet->GetItemState(XATTR_FILLSTYLE) == SfxItemState::DEFAULT)
- {
- const XFillStyleItem* pMergedFillStyleItem = aMergedAttr.GetItem<XFillStyleItem>(XATTR_FILLSTYLE);
- assert(pMergedFillStyleItem);
- if (pMergedFillStyleItem->GetValue() == drawing::FillStyle_NONE)
- mbPageBckgrdDeleted = true;
- }
+ const XFillStyleItem* pMergedFillStyleItem = aMergedAttr->GetItem<XFillStyleItem>(XATTR_FILLSTYLE);
+ assert(pMergedFillStyleItem);
+ if (pMergedFillStyleItem->GetValue() == drawing::FillStyle_NONE)
+ mbPageBckgrdDeleted = true;
}
+ }
- const XFillGradientItem* pTempGradItem = pTempSet->GetItem<XFillGradientItem>(XATTR_FILLGRADIENT);
- if (pTempGradItem && pTempGradItem->GetName().isEmpty())
- {
- // MigrateItemSet guarantees unique gradient names
- SfxItemSetFixed<XATTR_FILLGRADIENT, XATTR_FILLGRADIENT> aMigrateSet( mpDoc->GetPool() );
- aMigrateSet.Put( XFillGradientItem(u"gradient"_ustr, pTempGradItem->GetGradientValue()) );
- SdrModel::MigrateItemSet( &aMigrateSet, &*pTempSet, *mpDoc);
- }
+ const XFillGradientItem* pTempGradItem = tempSet.GetItem<XFillGradientItem>(XATTR_FILLGRADIENT);
+ if (pTempGradItem && pTempGradItem->GetName().isEmpty())
+ {
+ // MigrateItemSet guarantees unique gradient names
+ SfxItemSetFixed<XATTR_FILLGRADIENT, XATTR_FILLGRADIENT> aMigrateSet( mpDoc->GetPool() );
+ aMigrateSet.Put( XFillGradientItem(u"gradient"_ustr, pTempGradItem->GetGradientValue()) );
+ SdrModel::MigrateItemSet( &aMigrateSet, &tempSet, *mpDoc);
+ }
- const XFillHatchItem* pTempHatchItem = pTempSet->GetItem<XFillHatchItem>(XATTR_FILLHATCH);
- if (pTempHatchItem && pTempHatchItem->GetName().isEmpty())
- {
- // MigrateItemSet guarantees unique hatch names
- SfxItemSetFixed<XATTR_FILLHATCH, XATTR_FILLHATCH> aMigrateSet( mpDoc->GetPool() );
- aMigrateSet.Put( XFillHatchItem(u"hatch"_ustr, pTempHatchItem->GetHatchValue()) );
- SdrModel::MigrateItemSet( &aMigrateSet, &*pTempSet, *mpDoc);
- }
+ const XFillHatchItem* pTempHatchItem = tempSet.GetItem<XFillHatchItem>(XATTR_FILLHATCH);
+ if (pTempHatchItem && pTempHatchItem->GetName().isEmpty())
+ {
+ // MigrateItemSet guarantees unique hatch names
+ SfxItemSetFixed<XATTR_FILLHATCH, XATTR_FILLHATCH> aMigrateSet( mpDoc->GetPool() );
+ aMigrateSet.Put( XFillHatchItem(u"hatch"_ustr, pTempHatchItem->GetHatchValue()) );
+ SdrModel::MigrateItemSet( &aMigrateSet, &tempSet, *mpDoc);
+ }
+
+ if( !mbMasterPage && bChanges && mbPageBckgrdDeleted )
+ {
+ mpBackgroundObjUndoAction.reset( new SdBackgroundObjUndoAction(
+ *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet()) );
- if( !mbMasterPage && bChanges && mbPageBckgrdDeleted )
+ if(!mpPage->IsMasterPage())
{
- mpBackgroundObjUndoAction.reset( new SdBackgroundObjUndoAction(
- *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet()) );
-
- if(!mpPage->IsMasterPage())
- {
- // on normal pages, switch off fill attribute usage
- SdrPageProperties& rPageProperties = mpPage->getSdrPageProperties();
- rPageProperties.ClearItem( XATTR_FILLBITMAP );
- rPageProperties.ClearItem( XATTR_FILLGRADIENT );
- rPageProperties.ClearItem( XATTR_FILLHATCH );
- rPageProperties.PutItem(XFillStyleItem(drawing::FillStyle_NONE));
- }
+ // on normal pages, switch off fill attribute usage
+ SdrPageProperties& rPageProperties = mpPage->getSdrPageProperties();
+ rPageProperties.ClearItem( XATTR_FILLBITMAP );
+ rPageProperties.ClearItem( XATTR_FILLGRADIENT );
+ rPageProperties.ClearItem( XATTR_FILLHATCH );
+ rPageProperties.PutItem(XFillStyleItem(drawing::FillStyle_NONE));
}
+ }
- /* Special treatment: reset the INVALIDS to
- NULL-Pointer (otherwise INVALIDs or pointer point
- to DefaultItems in the template; both would
- prevent the attribute inheritance) */
- pTempSet->ClearInvalidItems();
+ /* Special treatment: reset the INVALIDS to
+ NULL-Pointer (otherwise INVALIDs or pointer point
+ to DefaultItems in the template; both would
+ prevent the attribute inheritance) */
+ tempSet.ClearInvalidItems();
- if( mbMasterPage )
- {
- mpDocSh->GetUndoManager()->AddUndoAction(std::make_unique<StyleSheetUndoAction>(
- mpDoc, *static_cast<SfxStyleSheet*>(pStyleSheet), &(*pTempSet)));
- pStyleSheet->GetItemSet().Put( *pTempSet );
- sdr::properties::CleanupFillProperties( pStyleSheet->GetItemSet() );
- pStyleSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
- }
-
- // if background filling is set to master pages then clear from page set
- if( mbMasterPage )
- {
- for( sal_uInt16 nWhich = XATTR_FILL_FIRST; nWhich <= XATTR_FILL_LAST; nWhich++ )
- {
- pTempSet->ClearItem( nWhich );
- }
- pTempSet->Put(XFillStyleItem(drawing::FillStyle_NONE));
- }
+ if( mbMasterPage )
+ {
+ mpDocSh->GetUndoManager()->AddUndoAction(std::make_unique<StyleSheetUndoAction>(
+ mpDoc, *static_cast<SfxStyleSheet*>(&styleSheet), &tempSet));
+ styleSheet.GetItemSet().Put( tempSet );
+ sdr::properties::CleanupFillProperties( styleSheet.GetItemSet() );
+ styleSheet.Broadcast(SfxHint(SfxHintId::DataChanged));
+ }
- if( const SvxFrameDirectionItem* pItem = pTempSet->GetItemIfSet( EE_PARA_WRITINGDIR, false ) )
+ // if background filling is set to master pages then clear from page set
+ if( mbMasterPage )
+ {
+ for( sal_uInt16 nWhich = XATTR_FILL_FIRST; nWhich <= XATTR_FILL_LAST; nWhich++ )
{
- SvxFrameDirection nVal = pItem->GetValue();
- mpDoc->SetDefaultWritingMode( nVal == SvxFrameDirection::Horizontal_RL_TB ? css::text::WritingMode_RL_TB : css::text::WritingMode_LR_TB );
+ tempSet.ClearItem( nWhich );
}
+ tempSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
+ }
- mpDoc->SetChanged();
-
- // BackgroundFill of Masterpage: no hard attributes allowed
- SdrPage& rUsedMasterPage = mpPage->IsMasterPage() ? *mpPage : mpPage->TRG_GetMasterPage();
- OSL_ENSURE(rUsedMasterPage.IsMasterPage(), "No MasterPage (!)");
- rUsedMasterPage.getSdrPageProperties().ClearItem();
- OSL_ENSURE(nullptr != rUsedMasterPage.getSdrPageProperties().GetStyleSheet(),
- "MasterPage without StyleSheet detected (!)");
+ if( const SvxFrameDirectionItem* pItem = tempSet.GetItemIfSet( EE_PARA_WRITINGDIR, false ) )
+ {
+ SvxFrameDirection nVal = pItem->GetValue();
+ mpDoc->SetDefaultWritingMode( nVal == SvxFrameDirection::Horizontal_RL_TB ? css::text::WritingMode_RL_TB : css::text::WritingMode_LR_TB );
}
- aNewAttr.Put(*pTempSet);
- mrReq.Done( aNewAttr );
+ mpDoc->SetChanged();
- return mrReq.GetArgs();
- }
- else
- {
- return nullptr;
+ // BackgroundFill of Masterpage: no hard attributes allowed
+ SdrPage& rUsedMasterPage = mpPage->IsMasterPage() ? *mpPage : mpPage->TRG_GetMasterPage();
+ OSL_ENSURE(rUsedMasterPage.IsMasterPage(), "No MasterPage (!)");
+ rUsedMasterPage.getSdrPageProperties().ClearItem();
+ OSL_ENSURE(nullptr != rUsedMasterPage.getSdrPageProperties().GetStyleSheet(),
+ "MasterPage without StyleSheet detected (!)");
}
+
+ aNewAttr->Put( tempSet );
+ ApplyItemSet( aNewAttr.get() );
}
void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
{
- if (!pArgs || !mpDrawViewShell)
+ if (!pArgs || !mpDrawViewShell) {
return;
+ }
// Set new page-attributes
PageKind ePageKind = mpDrawViewShell->GetPageKind();
diff --git a/sd/source/ui/inc/fupage.hxx b/sd/source/ui/inc/fupage.hxx
index f3b30f310952..3dd2598cea9b 100644
--- a/sd/source/ui/inc/fupage.hxx
+++ b/sd/source/ui/inc/fupage.hxx
@@ -22,6 +22,7 @@
#include <memory>
#include "fupoor.hxx"
#include <vcl/weld.hxx>
+#include <stlsheet.hxx>
class SfxItemSet;
class SdBackgroundObjUndoAction;
@@ -41,7 +42,7 @@ class FuPage final
virtual void Activate() override;
virtual void Deactivate() override;
- const SfxItemSet* ExecuteDialog(weld::Window* pParent, const SfxRequest& rReq);
+ void ExecuteAsyncDialog(weld::Window* pParent, const SfxRequest& rReq);
protected:
virtual ~FuPage() override;
@@ -54,10 +55,9 @@ private:
SdDrawDocument* pDoc,
SfxRequest& rReq );
+ void ApplyItemSet( SdStyleSheet& styleSheet, std::shared_ptr<SfxItemSet> aNewAttr, SfxItemSet& tempSet, std::shared_ptr<SfxItemSet> aMergedAttr);
void ApplyItemSet( const SfxItemSet* pArgs );
- SfxRequest& mrReq;
- const SfxItemSet* mpArgs;
std::unique_ptr<SdBackgroundObjUndoAction>
mpBackgroundObjUndoAction;
Size maSize;