summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/fontworkgallery.hxx6
-rw-r--r--svx/source/tbxctrls/fontworkgallery.cxx9
-rw-r--r--svx/source/toolbars/fontworkbar.cxx4
-rw-r--r--sw/source/uibase/uiview/viewdraw.cxx53
4 files changed, 40 insertions, 32 deletions
diff --git a/include/svx/fontworkgallery.hxx b/include/svx/fontworkgallery.hxx
index 3fa657305ad6..46dfd3b26104 100644
--- a/include/svx/fontworkgallery.hxx
+++ b/include/svx/fontworkgallery.hxx
@@ -49,7 +49,8 @@ class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FontWorkGalleryDialog final : public wel
sal_uInt16 mnThemeId;
SdrView& mrSdrView;
- SdrObject** mppSdrObject;
+ bool mbInsertIntoPage;
+ SdrObject* mppSdrObject;
SdrModel* mpDestModel;
std::vector<VclPtr< VirtualDevice >> maFavoritesHorizontal;
@@ -69,7 +70,8 @@ public:
virtual ~FontWorkGalleryDialog() override;
// SJ: if the SdrObject** is set, the SdrObject is not inserted into the page when executing the dialog
- void SetSdrObjectRef( SdrObject**, SdrModel* pModel );
+ void SetSdrObjectRef( SdrModel* pModel, bool bInsertIntoPage = true );
+ SdrObject* GetSdrObjectRef() { return mppSdrObject; }
};
}
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index efef6f786e0d..b9ad40f80dbe 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -52,6 +52,7 @@ FontWorkGalleryDialog::FontWorkGalleryDialog(weld::Window* pParent, SdrView& rSd
: GenericDialogController(pParent, "svx/ui/fontworkgallerydialog.ui", "FontworkGalleryDialog")
, mnThemeId(0xffff)
, mrSdrView(rSdrView)
+ , mbInsertIntoPage(true)
, mppSdrObject(nullptr)
, mpDestModel(nullptr)
, maCtlFavorites(m_xBuilder->weld_icon_view("ctlFavoriteswin"))
@@ -131,9 +132,9 @@ void FontWorkGalleryDialog::fillFavorites(sal_uInt16 nThemeId)
maCtlFavorites->select(0);
}
-void FontWorkGalleryDialog::SetSdrObjectRef( SdrObject** ppSdrObject, SdrModel* pModel )
+void FontWorkGalleryDialog::SetSdrObjectRef( SdrModel* pModel, bool bInsertIntoPage )
{
- mppSdrObject = ppSdrObject;
+ mbInsertIntoPage = bInsertIntoPage;
mpDestModel = pModel;
}
@@ -164,7 +165,7 @@ void FontWorkGalleryDialog::insertSelectedFontwork()
// If this is not used, the correct SdrModel seems to be the one from
// the mrSdrView that is used to insert (InsertObjectAtView below) the
// cloned SdrObject.
- const bool bUseSpecialCalcMode(nullptr != mppSdrObject && nullptr != mpDestModel);
+ const bool bUseSpecialCalcMode(!mbInsertIntoPage && nullptr != mpDestModel);
// center shape on current view
OutputDevice* pOutDev(mrSdrView.GetFirstOutputDevice());
@@ -201,7 +202,7 @@ void FontWorkGalleryDialog::insertSelectedFontwork()
if (bUseSpecialCalcMode)
{
- *mppSdrObject = pNewObject;
+ mppSdrObject = pNewObject;
}
else
{
diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx
index e29becb08be6..36cd9652b2aa 100644
--- a/svx/source/toolbars/fontworkbar.cxx
+++ b/svx/source/toolbars/fontworkbar.cxx
@@ -415,8 +415,8 @@ void FontworkBar::execute( SdrView& rSdrView, SfxRequest const & rReq, SfxBindin
{
case SID_FONTWORK_GALLERY_FLOATER:
{
- FontWorkGalleryDialog aDlg(rReq.GetFrameWeld(), rSdrView);
- aDlg.run();
+ std::shared_ptr<FontWorkGalleryDialog> pDlg = std::make_shared<FontWorkGalleryDialog>(rReq.GetFrameWeld(), rSdrView);
+ weld::DialogController::runAsync(pDlg, [](int){});
}
break;
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index e5284b48e04a..219d4bbf52c8 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -150,35 +150,40 @@ void SwView::ExecDraw(SfxRequest& rReq)
pSdrView = m_pWrtShell->GetDrawView();
if (pSdrView)
{
- SdrObject* pObj = nullptr;
- svx::FontWorkGalleryDialog aDlg(rWin.GetFrameWeld(), *pSdrView);
- aDlg.SetSdrObjectRef( &pObj, pSdrView->GetModel() );
- aDlg.run();
- if ( pObj )
- {
- Size aDocSize( m_pWrtShell->GetDocSize() );
- const SwRect& rVisArea = m_pWrtShell->VisArea();
- Point aPos( rVisArea.Center() );
- Size aSize;
- Size aPrefSize( pObj->GetSnapRect().GetSize() );
+ std::shared_ptr<svx::FontWorkGalleryDialog> pDlg = std::make_shared<svx::FontWorkGalleryDialog>(rWin.GetFrameWeld(), *pSdrView);
+ pDlg->SetSdrObjectRef( pSdrView->GetModel(), false );
+ weld::DialogController::runAsync(pDlg, [this, pDlg](int) {
+ vcl::Window& rWin2 = m_pWrtShell->GetView().GetViewFrame()->GetWindow();
- if( rVisArea.Width() > aDocSize.Width())
- aPos.setX( aDocSize.Width() / 2 + rVisArea.Left() );
+ SdrObject* pObj = pDlg->GetSdrObjectRef();
+ if ( pObj )
+ {
+ Size aDocSize( m_pWrtShell->GetDocSize() );
+ const SwRect& rVisArea = m_pWrtShell->VisArea();
+ Point aPos( rVisArea.Center() );
+ Size aSize;
+ Size aPrefSize( pObj->GetSnapRect().GetSize() );
- if(rVisArea.Height() > aDocSize.Height())
- aPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
+ if( rVisArea.Width() > aDocSize.Width())
+ aPos.setX( aDocSize.Width() / 2 + rVisArea.Left() );
- if( aPrefSize.Width() && aPrefSize.Height() )
- aSize = rWin.PixelToLogic(aPrefSize, MapMode(MapUnit::MapTwip));
- else
- aSize = Size( 2835, 2835 );
+ if(rVisArea.Height() > aDocSize.Height())
+ aPos.setY( aDocSize.Height() / 2 + rVisArea.Top() );
- m_pWrtShell->EnterStdMode();
- m_pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos );
- rReq.Ignore ();
- }
+ if( aPrefSize.Width() && aPrefSize.Height() )
+ aSize = rWin2.PixelToLogic(aPrefSize, MapMode(MapUnit::MapTwip));
+ else
+ aSize = Size( 2835, 2835 );
+
+ m_pWrtShell->EnterStdMode();
+ m_pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos );
+ }
+
+ rWin2.LeaveWait();
+ });
}
- rWin.LeaveWait();
+ else
+ rWin.LeaveWait();
}
else if ( m_nFormSfxId != USHRT_MAX )
GetViewFrame()->GetDispatcher()->Execute( SID_FM_LEAVE_CREATE );