cui/source/factory/dlgfact.hxx | 7 - desktop/qa/desktop_lib/test_desktop_lib.cxx | 1 desktop/source/lib/init.cxx | 29 ++++ sd/source/ui/func/fuarea.cxx | 34 +++-- sd/source/ui/func/fuline.cxx | 40 +++--- sd/source/ui/func/futransf.cxx | 161 +++++++++++++++---------- sd/source/ui/view/drviews2.cxx | 7 - sfx2/source/control/unoctitm.cxx | 25 +++ sfx2/source/dialog/mgetempl.cxx | 8 - sfx2/source/view/viewfrm.cxx | 5 sw/inc/docsh.hxx | 16 +- sw/qa/extras/tiledrendering/tiledrendering.cxx | 26 +++- sw/source/uibase/app/docst.cxx | 159 ++++++++++-------------- sw/source/uibase/shells/basesh.cxx | 5 sw/source/uibase/shells/textsh1.cxx | 37 ++++- 15 files changed, 340 insertions(+), 220 deletions(-)
New commits: commit f2d02ab3b53fcd15c4e98070f3e36705dfc693b4 Author: Henry Castro <hcas...@collabora.com> Date: Tue Jan 9 22:17:23 2018 -0400 sw lokit: add page syles to header & footer Reviewed-on: https://gerrit.libreoffice.org/47687 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Henry Castro <hcas...@collabora.com> (cherry picked from commit 252ce90e39648c47bcfdb39547d0ac82bacdbae6) Change-Id: I3c0b0603d1e03f1cc19af4324dd2b909320d9d4a diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 37c7755a0d08..9eb5e5cb0eb2 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -309,6 +309,7 @@ void DesktopLOKTest::testGetStyles() rPair.first != "CellStyles" && rPair.first != "ShapeStyles" && rPair.first != "TableStyles" && + rPair.first != "HeaderFooter" && rPair.first != "Commands") { CPPUNIT_FAIL("Unknown style family: " + rPair.first); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index ae0a99b8424f..1ea30de95dd0 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2769,6 +2769,35 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren); } + // Header & Footer Styles + { + OUString sName; + bool bIsPhysical; + boost::property_tree::ptree aChild; + uno::Reference<beans::XPropertySet> xProperty; + boost::property_tree::ptree aChildren; + uno::Reference<container::XNameContainer> xContainer; + + if (xStyleFamilies->getByName("PageStyles") >>= xContainer) + { + uno::Sequence<OUString> aSeqNames = xContainer->getElementNames(); + for (sal_Int32 itName = 0; itName < aSeqNames.getLength(); itName++) + { + sName = aSeqNames[itName]; + xProperty.set(xContainer->getByName(sName), uno::UNO_QUERY); + if (xProperty.is() && (xProperty->getPropertyValue("IsPhysical") >>= bIsPhysical) && bIsPhysical) + { + xProperty->getPropertyValue("DisplayName") >>= sName; + aChild.put("", sName.toUtf8()); + aChildren.push_back(std::make_pair("", aChild)); + } + else + bIsPhysical = false; + } + aValues.add_child("HeaderFooter", aChildren); + } + } + { boost::property_tree::ptree aCommandList; diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index af8142a12fcc..5e5b26170fda 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1019,9 +1019,7 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c aEvent.FeatureURL.Path == "AlignLeft" || aEvent.FeatureURL.Path == "AlignHorizontalCenter" || aEvent.FeatureURL.Path == "AlignRight" || - aEvent.FeatureURL.Path == "DocumentRepair" || - aEvent.FeatureURL.Path == "InsertPageHeader" || - aEvent.FeatureURL.Path == "InsertPageFooter") + aEvent.FeatureURL.Path == "DocumentRepair") { bool bTemp = false; aEvent.State >>= bTemp; @@ -1197,6 +1195,27 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c } } } + else if (aEvent.FeatureURL.Path == "InsertPageHeader" || + aEvent.FeatureURL.Path == "InsertPageFooter") + { + if (aEvent.IsEnabled) + { + css::uno::Sequence< OUString > aSeq; + if (aEvent.State >>= aSeq) + { + aBuffer.append(u'{'); + for (sal_Int32 itSeq = 0; itSeq < aSeq.getLength(); itSeq++) + { + aBuffer.append("\"" + aSeq[itSeq]); + if (itSeq != aSeq.getLength() - 1) + aBuffer.append("\":true,"); + else + aBuffer.append("\":true"); + } + aBuffer.append(u'}'); + } + } + } else { return; diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 9c8f35dcc6d2..77caaafe327c 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -23,6 +23,7 @@ #include <editeng/editview.hxx> #include <editeng/outliner.hxx> #include <svl/srchitem.hxx> +#include <svl/slstitm.hxx> #include <drawdoc.hxx> #include <ndtxt.hxx> #include <wrtsh.hxx> @@ -1941,10 +1942,19 @@ namespace { void checkPageHeaderOrFooter(const SfxViewShell* pViewShell, sal_uInt16 nWhich, bool bValue) { + uno::Sequence<OUString> aSeq; const SfxPoolItem* pState = nullptr; pViewShell->GetDispatcher()->QueryState(nWhich, pState); - CPPUNIT_ASSERT(dynamic_cast< const SfxBoolItem * >(pState)); - CPPUNIT_ASSERT_EQUAL(bValue, dynamic_cast< const SfxBoolItem * >(pState)->GetValue()); + const SfxStringListItem* pListItem = dynamic_cast<const SfxStringListItem*>(pState); + CPPUNIT_ASSERT(pListItem); + pListItem->GetStringList(aSeq); + if (bValue) + { + CPPUNIT_ASSERT_EQUAL(1, aSeq.getLength()); + CPPUNIT_ASSERT_EQUAL(OUString("Default Style"), aSeq[0]); + } + else + CPPUNIT_ASSERT_EQUAL(0, aSeq.getLength()); }; } @@ -1959,16 +1969,18 @@ void SwTiledRenderingTest::testPageHeader() checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEHEADER, false); // Insert Page Header { + SfxStringItem aStyle(FN_INSERT_PAGEHEADER, "Default Style"); SfxBoolItem aItem(FN_PARAM_1, true); - pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEHEADER, SfxCallMode::SYNCHRON, {&aItem}); + pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEHEADER, SfxCallMode::API | SfxCallMode::SYNCHRON, {&aStyle, &aItem}); } // Check Page Header State checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEHEADER, true); // Remove Page Header { + SfxStringItem aStyle(FN_INSERT_PAGEHEADER, "Default Style"); SfxBoolItem aItem(FN_PARAM_1, false); - pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEHEADER, SfxCallMode::SYNCHRON, {&aItem}); + pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEHEADER, SfxCallMode::API | SfxCallMode::SYNCHRON, {&aStyle, &aItem}); } // Check Page Header State checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEHEADER, false); @@ -1988,16 +2000,18 @@ void SwTiledRenderingTest::testPageFooter() checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEFOOTER, false); // Insert Page Footer { + SfxStringItem aPageStyle(FN_INSERT_PAGEFOOTER, "Default Style"); SfxBoolItem aItem(FN_PARAM_1, true); - pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEFOOTER, SfxCallMode::SYNCHRON, {&aItem}); + pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEFOOTER, SfxCallMode::API | SfxCallMode::SYNCHRON, {&aPageStyle, &aItem}); } // Check Page Footer State checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEFOOTER, true); // Remove Page Footer { + SfxStringItem aPageStyle(FN_INSERT_PAGEFOOTER, "Default Style"); SfxBoolItem aItem(FN_PARAM_1, false); - pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEFOOTER, SfxCallMode::SYNCHRON, {&aItem}); + pViewShell->GetDispatcher()->ExecuteList(FN_INSERT_PAGEFOOTER, SfxCallMode::API | SfxCallMode::SYNCHRON, {&aPageStyle, &aItem}); } // Check Footer State checkPageHeaderOrFooter(pViewShell, FN_INSERT_PAGEFOOTER, false); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 7133f722f844..a5d008596702 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1303,7 +1303,7 @@ void SwTextShell::Execute(SfxRequest &rReq) bool bOn = true; if( SfxItemState::SET == pArgs->GetItemState(FN_PARAM_1, false, &pItem)) bOn = static_cast<const SfxBoolItem*>(pItem)->GetValue(); - rWrtSh.ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !comphelper::LibreOfficeKit::isActive() && !rReq.IsAPI()); + rWrtSh.ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !rReq.IsAPI()); rReq.Done(); } break; @@ -1650,7 +1650,15 @@ void SwTextShell::GetState( SfxItemSet &rSet ) if (comphelper::LibreOfficeKit::isActive()) { bool bState = false; + bool bAllState = true; bool bIsPhysical = false; + + OUString aStyleName; + std::vector<OUString> aList; + const OUString sPhysical("IsPhysical"); + const OUString sDisplay("DisplayName"); + const OUString sHeaderOn(nWhich == FN_INSERT_PAGEHEADER ? OUString("HeaderIsOn") : OUString("FooterIsOn")); + uno::Reference< XStyleFamiliesSupplier > xSupplier(GetView().GetDocShell()->GetBaseModel(), uno::UNO_QUERY); if (xSupplier.is()) { @@ -1659,18 +1667,31 @@ void SwTextShell::GetState( SfxItemSet &rSet ) if (xFamilies->getByName("PageStyles") >>= xContainer) { uno::Sequence< OUString > aSeqNames = xContainer->getElementNames(); - for (sal_Int32 itNames = 0; itNames < aSeqNames.getLength(); itNames++) + for (sal_Int32 itName = 0; itName < aSeqNames.getLength(); itName++) { - uno::Reference< XPropertySet > xPropSet(xContainer->getByName(aSeqNames[itNames]), uno::UNO_QUERY); - if (xPropSet.is() && (xPropSet->getPropertyValue("IsPhysical") >>= bIsPhysical) && bIsPhysical) + aStyleName = aSeqNames[itName]; + uno::Reference<XPropertySet> xPropSet(xContainer->getByName(aStyleName), uno::UNO_QUERY); + if (xPropSet.is() && (xPropSet->getPropertyValue(sPhysical) >>= bIsPhysical) && bIsPhysical) { - if ((xPropSet->getPropertyValue(nWhich == FN_INSERT_PAGEHEADER ? OUString("HeaderIsOn") : OUString("FooterIsOn")) >>= bState) && bState) - break; + xPropSet->getPropertyValue(sDisplay) >>= aStyleName; + if ((xPropSet->getPropertyValue(sHeaderOn)>>= bState) && bState) + aList.push_back(aStyleName); + else + bState = false; + + // Check if all entries have the same state + bAllState &= bState; } - } + else + bIsPhysical = false; + } } } - rSet.Put(SfxBoolItem(nWhich, bState)); + + if (bAllState && aList.size() > 1) + aList.push_back("_ALL_"); + + rSet.Put(SfxStringListItem(nWhich, &aList)); } else { commit c82a01c3251d79ac2bb19ba6ef490e8402c7347e Author: Jan Holesovsky <ke...@collabora.com> Date: Thu Jan 18 09:06:33 2018 +0100 No need for an 'if' when the body is empty. Reviewed-on: https://gerrit.libreoffice.org/48091 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Jan Holesovsky <ke...@collabora.com> (cherry picked from commit 73c0abb8e001e3f48bbd0d04f11482972fe82fe4) Change-Id: I69e3f2145f95424e7c524127492fd7f8a03ed3ca diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index b6e78d3a5ff9..1dc87a2c537d 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -314,7 +314,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() { const SfxPoolItem* pPoolItem = pModule->GetItem( SID_ATTR_METRIC ); if ( pPoolItem ) - eFieldUnit = (FieldUnit) static_cast<const SfxUInt16Item*>( pPoolItem )->GetValue(); + eFieldUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>( pPoolItem )->GetValue()); } switch ( eFieldUnit ) @@ -348,9 +348,7 @@ IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditStyleSelectHdl_Impl, ListBox&, voi IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditStyleHdl_Impl, Button*, void ) { OUString aTemplName(m_pFollowLb->GetSelectedEntry()); - if (Execute_Impl( SID_STYLE_EDIT, aTemplName, OUString(),(sal_uInt16)pStyle->GetFamily() )) - { - } + Execute_Impl(SID_STYLE_EDIT, aTemplName, OUString(), static_cast<sal_uInt16>(pStyle->GetFamily())); } IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditLinkStyleSelectHdl_Impl, ListBox&, void ) @@ -366,7 +364,7 @@ IMPL_LINK_NOARG( SfxManageStyleSheetPage, EditLinkStyleHdl_Impl, Button*, void ) { OUString aTemplName(m_pBaseLb->GetSelectedEntry()); if (aTemplName != SfxResId(STR_NONE)) - Execute_Impl( SID_STYLE_EDIT, aTemplName, OUString(),(sal_uInt16)pStyle->GetFamily() ); + Execute_Impl( SID_STYLE_EDIT, aTemplName, OUString(),static_cast<sal_uInt16>(pStyle->GetFamily()) ); } // Internal: Perform functions through the Dispatcher commit bc07afdc5db575ce87374cde1d21f6a09fe528f2 Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Jan 17 20:15:22 2018 +0100 lokdialog: Convert the Format -> ... -> Area... to async exec. Change-Id: I3756bd472b4e54db1d1c9da382d5d655f472bdb7 Reviewed-on: https://gerrit.libreoffice.org/48080 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Jan Holesovsky <ke...@collabora.com> (cherry picked from commit b479e9625475e87546b7945732a0e66a2a9dbb1f) diff --git a/sd/source/ui/func/fuarea.cxx b/sd/source/ui/func/fuarea.cxx index 1e891416483a..1d9197871071 100644 --- a/sd/source/ui/func/fuarea.cxx +++ b/sd/source/ui/func/fuarea.cxx @@ -52,19 +52,28 @@ rtl::Reference<FuPoor> FuArea::Create( ViewShell* pViewSh, ::sd::Window* pWin, : void FuArea::DoExecute( SfxRequest& rReq ) { + rReq.Ignore (); + const SfxItemSet* pArgs = rReq.GetArgs(); + if (pArgs) + { + mpViewShell->Cancel(); + return; + } + + SfxItemSet aNewAttr( mpDoc->GetPool() ); + mpView->GetAttributes( aNewAttr ); - if( !pArgs ) + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact ? pFact->CreateSvxAreaTabDialog(nullptr, &aNewAttr, mpDoc, true) : nullptr); + if (!pDlg) { - SfxItemSet aNewAttr( mpDoc->GetPool() ); - mpView->GetAttributes( aNewAttr ); - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact ? pFact->CreateSvxAreaTabDialog( nullptr, - &aNewAttr, - mpDoc, - true) : nullptr); - if( pDlg && (pDlg->Execute() == RET_OK) ) + mpViewShell->Cancel(); + return; + } + + pDlg->StartExecuteAsync([=](sal_Int32 nResult){ + if (nResult == RET_OK) { mpView->SetAttributes (*(pDlg->GetOutputItemSet ())); @@ -81,10 +90,7 @@ void FuArea::DoExecute( SfxRequest& rReq ) mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray ); } - } - - rReq.Ignore (); - + }, pDlg); } void FuArea::Activate() diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index a3b1bcc9c355..1979cb91bcb4 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1374,7 +1374,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_ATTRIBUTES_AREA: // BASIC { SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); - Cancel(); + // Cancel() called directly in FuTransform::Create() } break; commit 5663295a16340b7d122991300831388edf45eb18 Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Jan 17 19:17:30 2018 +0100 lokdialog: Convert the Format -> ... -> Line... to async exec. Change-Id: Ieaf440abf819d503d388a8b060dbf7fe6548db9e Reviewed-on: https://gerrit.libreoffice.org/48073 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Jan Holesovsky <ke...@collabora.com> (cherry picked from commit cb84fdb368ed4b09d086681fe777a0f4c0f07f76) diff --git a/sd/source/ui/func/fuline.cxx b/sd/source/ui/func/fuline.cxx index cb4bd715581d..67ad104ecc31 100644 --- a/sd/source/ui/func/fuline.cxx +++ b/sd/source/ui/func/fuline.cxx @@ -60,23 +60,34 @@ rtl::Reference<FuPoor> FuLine::Create( ViewShell* pViewSh, ::sd::Window* pWin, : void FuLine::DoExecute( SfxRequest& rReq ) { - bool bHasMarked = mpView->AreObjectsMarked(); + rReq.Ignore(); const SfxItemSet* pArgs = rReq.GetArgs(); - - if( !pArgs ) + if (pArgs) { - const SdrObject* pObj = nullptr; - const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); - if( rMarkList.GetMarkCount() == 1 ) - pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + mpViewShell->Cancel(); + return; + } + + const SdrObject* pObj = nullptr; + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + if( rMarkList.GetMarkCount() == 1 ) + pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + + std::unique_ptr<SfxItemSet> pNewAttr(new SfxItemSet( mpDoc->GetPool() )); + mpView->GetAttributes( *pNewAttr ); - std::unique_ptr<SfxItemSet> pNewAttr(new SfxItemSet( mpDoc->GetPool() )); - mpView->GetAttributes( *pNewAttr ); + bool bHasMarked = mpView->AreObjectsMarked(); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + VclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSvxLineTabDialog(nullptr,pNewAttr.get(),mpDoc,pObj,bHasMarked) : nullptr); + if (!pDlg) + { + mpViewShell->Cancel(); + return; + } - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSvxLineTabDialog(nullptr,pNewAttr.get(),mpDoc,pObj,bHasMarked) : nullptr); - if( pDlg && (pDlg->Execute() == RET_OK) ) + pDlg->StartExecuteAsync([=](sal_Int32 nResult){ + if (nResult == RET_OK) { mpView->SetAttributes (*(pDlg->GetOutputItemSet ())); @@ -95,9 +106,8 @@ void FuLine::DoExecute( SfxRequest& rReq ) mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray ); } - } - - rReq.Ignore (); + mpViewShell->Cancel(); + }, pDlg); } void FuLine::Activate() diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 89ba3063be78..a3b1bcc9c355 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1367,7 +1367,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_ATTRIBUTES_LINE: // BASIC { SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); - Cancel(); + // Cancel() called directly in FuTransform::Create() } break; commit 6af2f75bf74bd596c45884cf5e000e0c83d68404 Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Jan 17 15:20:31 2018 +0100 lokdialog: Convert the Format -> ... -> Position and Size... to async exec. Change-Id: Idcdbfb1366db61e247c31eab5cb27a39978b0fd9 Reviewed-on: https://gerrit.libreoffice.org/48055 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Jan Holesovsky <ke...@collabora.com> (cherry picked from commit d3dbbdce4eb71ae848e7682374e011c4a6129b15) diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 39e4b54379bd..e997d784f261 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -67,12 +67,17 @@ public: \ explicit Class( DialogClass* p) \ : pDlg(p) \ {} \ - virtual short Execute() override ; + virtual short Execute() override; \ + virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override; #define IMPL_ABSTDLG_BASE(Class) \ short Class::Execute() \ { \ return pDlg->Execute(); \ +} \ +bool Class::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) \ +{ \ + return pDlg->StartExecuteAsync(rCtx); \ } class VclAbstractDialog2_Impl : public VclAbstractDialog2 diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx index 4a811aa62a75..0d0a7788d43a 100644 --- a/sd/source/ui/func/futransf.cxx +++ b/sd/source/ui/func/futransf.cxx @@ -32,8 +32,7 @@ #include <memory> -namespace sd { - +using namespace sd; FuTransform::FuTransform(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq) @@ -48,74 +47,112 @@ rtl::Reference<FuPoor> FuTransform::Create( ViewShell* pViewSh, ::sd::Window* pW return xFunc; } -void FuTransform::DoExecute( SfxRequest& rReq ) +namespace { + +void setUndo(::sd::View* pView, const SfxItemSet* pArgs) +{ + // Undo + OUString aString(pView->GetDescriptionOfMarkedObjects()); + aString += " " + SdResId(STR_TRANSFORM); + pView->BegUndo(aString); + + pView->SetGeoAttrToMarked(*pArgs); + pView->SetAttributes(*pArgs); + pView->EndUndo(); +} + +class ScopeCleanup { - if( mpView->AreObjectsMarked() ) + ViewShell* mpViewShell; +public: + ScopeCleanup(ViewShell* pViewShell) : mpViewShell(pViewShell) { - const SfxItemSet* pArgs = rReq.GetArgs(); + } - if( !pArgs ) + ~ScopeCleanup() + { + if (mpViewShell) { - // --------- itemset for size and position -------- - SfxItemSet aSet( mpView->GetGeoAttrFromMarked() ); - - const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); - SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if( rMarkList.GetMarkCount() == 1 && - pObj->GetObjInventor() == SdrInventor::Default && - pObj->GetObjIdentifier() == OBJ_CAPTION ) - { - // --------- itemset for caption -------- - SfxItemSet aNewAttr( mpDoc->GetPool() ); - mpView->GetAttributes( aNewAttr ); - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - { - ScopedVclPtr< SfxAbstractTabDialog > pDlg( pFact->CreateCaptionDialog( nullptr, mpView ) ); - - const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); - SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange ); - aCombSet.Put( aNewAttr ); - aCombSet.Put( aSet ); - pDlg->SetInputSet( &aCombSet ); - - if( pDlg.get() && (pDlg->Execute() == RET_OK) ) - { - rReq.Done( *( pDlg->GetOutputItemSet() ) ); - pArgs = rReq.GetArgs(); - } - } - } - else - { - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr< SfxAbstractTabDialog > pDlg( pFact->CreateSvxTransformTabDialog( nullptr, &aSet, mpView ) ); - if( pDlg.get() && (pDlg->Execute() == RET_OK) ) - { - rReq.Done( *( pDlg->GetOutputItemSet() ) ); - pArgs = rReq.GetArgs(); - } - } - } + mpViewShell->Invalidate(SID_RULER_OBJECT); + mpViewShell->Cancel(); } + } - if( pArgs ) - { - // Undo - OUString aString( mpView->GetDescriptionOfMarkedObjects() ); - aString += " " + SdResId( STR_TRANSFORM ); - mpView->BegUndo( aString ); - - mpView->SetGeoAttrToMarked( *pArgs ); - mpView->SetAttributes( *pArgs ); - mpView->EndUndo(); - } + void ignore() + { + mpViewShell = nullptr; } +}; + } -} // end of namespace sd +void FuTransform::DoExecute( SfxRequest& rReq ) +{ + ScopeCleanup aCleanup(mpViewShell); + + if (!mpView->AreObjectsMarked()) + return; + + const SfxItemSet* pArgs = rReq.GetArgs(); + + if (pArgs) + { + setUndo(mpView, pArgs); + return; + } + + // --------- itemset for size and position -------- + SfxItemSet aSet( mpView->GetGeoAttrFromMarked() ); + VclPtr<SfxAbstractTabDialog> pDlg; + + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + if( rMarkList.GetMarkCount() == 1 && + pObj->GetObjInventor() == SdrInventor::Default && + pObj->GetObjIdentifier() == OBJ_CAPTION ) + { + // --------- itemset for caption -------- + SfxItemSet aNewAttr( mpDoc->GetPool() ); + mpView->GetAttributes( aNewAttr ); + + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + if (!pFact) + return; + + pDlg.reset(pFact->CreateCaptionDialog(nullptr, mpView)); + + const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); + SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange ); + aCombSet.Put( aNewAttr ); + aCombSet.Put( aSet ); + pDlg->SetInputSet( &aCombSet ); + } + else + { + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + if (!pFact) + return; + + pDlg.reset(pFact->CreateSvxTransformTabDialog(nullptr, &aSet, mpView)); + } + + if (!pDlg) + return; + + std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq)); + rReq.Ignore(); // the 'old' request is not relevant any more + aCleanup.ignore(); // the lambda does it + + pDlg->StartExecuteAsync([=](sal_Int32 nResult){ + if (nResult == RET_OK) + { + pRequest->Done(*(pDlg->GetOutputItemSet())); + setUndo(mpView, pRequest->GetArgs()); + } + + mpViewShell->Invalidate(SID_RULER_OBJECT); + mpViewShell->Cancel(); + }, pDlg); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 4fd1a539607f..89ba3063be78 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1381,8 +1381,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_ATTR_TRANSFORM: { SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); - Invalidate(SID_RULER_OBJECT); - Cancel(); + // Cancel() and Invalidate() called directly in FuTransform::Create() } break; commit ff25702c53157935e32858df919e9051767032a2 Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Jan 17 12:42:42 2018 +0100 lokdialog: Convert the Format -> Page... dialog to async exec. This actually also converts the Style -> Edit Style... at the same time. Reviewed-on: https://gerrit.libreoffice.org/48043 Tested-by: Jan Holesovsky <ke...@collabora.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> (cherry picked from commit e6e125946358865990ea999c8a4845ec84eb7088) Change-Id: I4c09fcdfd7a543cce613eaa3620d0b623540d7e8 diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 9ab55372c184..8b2c064403b3 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -127,7 +127,8 @@ class SW_DLLPUBLIC SwDocShell const bool bNew, const OString& sPageId, SwWrtShell* pActShell = nullptr, - SfxRequest* pRequest = nullptr); + SfxRequest* pRequest = nullptr, + sal_uInt16 nSlot = 0); SAL_DLLPRIVATE void Delete(const OUString &rName, SfxStyleFamily nFamily); SAL_DLLPRIVATE void Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden); diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index bfbe6438110c..4361dd18068c 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -322,15 +322,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if (sName.isEmpty() && m_xBasePool.get()) sName = SfxStyleDialog::GenerateUnusedName(*m_xBasePool); - Edit(sName, sParent, nFamily, nMask, true, OString(), nullptr, &rReq); - - // Update Watermark if new page style was created - if( nFamily == SfxStyleFamily::Page ) - { - SwWrtShell* pShell = GetWrtShell(); - const SfxWatermarkItem aWatermark = pShell->GetWatermark(); - pShell->SetWatermark( aWatermark ); - } + Edit(sName, sParent, nFamily, nMask, true, OString(), nullptr, &rReq, nSlot); } break; @@ -657,10 +649,11 @@ void SwDocShell::Edit( const bool bNew, const OString& sPage, SwWrtShell* pActShell, - SfxRequest* pRequest) + SfxRequest* pReq, + sal_uInt16 nSlot) { assert( GetWrtShell() ); - const bool bBasic = pRequest && pRequest->IsAPI(); + const bool bBasic = pReq && pReq->IsAPI(); SfxStyleSheetBase *pStyle = nullptr; bool bModified = m_xDoc->getIDocumentState().IsModified(); @@ -830,36 +823,52 @@ void SwDocShell::Edit( *(xTmp.get()), nFamily, sPage, pActShell ? pActShell : m_pWrtShell, bNew)); assert( pDlg ); - ApplyStyle aApplyStyleHelper(*this, bNew, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified); - pDlg->SetApplyHdl(LINK(&aApplyStyleHelper, ApplyStyle, ApplyHdl)); + std::shared_ptr<ApplyStyle> pApplyStyleHelper(new ApplyStyle(*this, bNew, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified)); + pDlg->SetApplyHdl(LINK(pApplyStyleHelper.get(), ApplyStyle, ApplyHdl)); - short nDlgRet = pDlg->Execute(); - - if (RET_OK == nDlgRet) + std::shared_ptr<SfxRequest> pRequest; + if (pReq) { - aApplyStyleHelper.apply(); + pRequest.reset(new SfxRequest(*pReq)); + pReq->Ignore(); // the 'old' request is not relevant any more } - if (bNew) - { - SwRewriter aRewriter; - aRewriter.AddRule(UndoArg1, xTmp->GetName()); - //Group the create style and change style operations together under the - //one "create style" comment - m_pWrtShell->EndUndo(nNewStyleUndoId, &aRewriter); - } + pDlg->StartExecuteAsync([=](sal_Int32 nResult){ + if (RET_OK == nResult) + pApplyStyleHelper->apply(); - if (RET_OK != nDlgRet) - { - if( bNew ) + if (bNew) { - GetWrtShell()->Undo(); - m_xDoc->GetIDocumentUndoRedo().ClearRedo(); + SwRewriter aRewriter; + aRewriter.AddRule(UndoArg1, xTmp->GetName()); + //Group the create style and change style operations together under the + //one "create style" comment + m_pWrtShell->EndUndo(nNewStyleUndoId, &aRewriter); } - if( !bModified ) - m_xDoc->getIDocumentState().ResetModified(); - } + if (RET_OK != nResult) + { + if (bNew) + { + GetWrtShell()->Undo(); + m_xDoc->GetIDocumentUndoRedo().ClearRedo(); + } + + if (!bModified) + m_xDoc->getIDocumentState().ResetModified(); + } + + // Update Watermark if new page style was created + if (nSlot == SID_STYLE_NEW && nFamily == SfxStyleFamily::Page) + { + SwWrtShell* pShell = GetWrtShell(); + const SfxWatermarkItem aWatermark = pShell->GetWatermark(); + pShell->SetWatermark(aWatermark); + } + + if (pRequest) + pRequest->Done(); + }, pDlg); } else { diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index a8e7ff358020..2d38db9fdea0 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2450,6 +2450,8 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) rTempView.GetDocShell()->FormatPage(rPageDesc.GetName(), sPageId, rSh, &rReq); rTempView.InvalidateRulerPos(); + + bDone = true; // FormatPage() takes care of calling Done() } } break; commit adabda5056d99a1efade39a47bceafa9a467d149 Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Jan 17 12:06:34 2018 +0100 sw: Cleanup various unused return values. Reviewed-on: https://gerrit.libreoffice.org/48042 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> (cherry picked from commit 2bd262305cae9b4268c8fb50993119f1bcd7de14) Change-Id: Ic0e0c6cfd4b6d79f7c3807ac4300f30343269dea diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 6829837d91cf..9ab55372c184 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -119,7 +119,7 @@ class SW_DLLPUBLIC SwDocShell /// @param nSlot /// Only used for nFamily == SfxStyleFamily::Page. Identifies optional Slot by which the edit is triggered. /// Used to activate certain dialog pane - SAL_DLLPRIVATE sal_uInt16 Edit( + SAL_DLLPRIVATE void Edit( const OUString &rName, const OUString& rParent, const SfxStyleFamily nFamily, @@ -127,17 +127,17 @@ class SW_DLLPUBLIC SwDocShell const bool bNew, const OString& sPageId, SwWrtShell* pActShell = nullptr, - const bool bBasic = false ); + SfxRequest* pRequest = nullptr); - SAL_DLLPRIVATE bool Delete(const OUString &rName, SfxStyleFamily nFamily); - SAL_DLLPRIVATE bool Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden); + SAL_DLLPRIVATE void Delete(const OUString &rName, SfxStyleFamily nFamily); + SAL_DLLPRIVATE void Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden); SAL_DLLPRIVATE SfxStyleFamily ApplyStyles(const OUString &rName, const SfxStyleFamily nFamily, SwWrtShell* pShell, sal_uInt16 nMode = 0); SAL_DLLPRIVATE SfxStyleFamily DoWaterCan( const OUString &rName, SfxStyleFamily nFamily); - SAL_DLLPRIVATE SfxStyleFamily UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell); - SAL_DLLPRIVATE SfxStyleFamily MakeByExample(const OUString &rName, + SAL_DLLPRIVATE void UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell); + SAL_DLLPRIVATE void MakeByExample(const OUString &rName, SfxStyleFamily nFamily, sal_uInt16 nMask, SwWrtShell* pShell); SAL_DLLPRIVATE void SubInitNew(); ///< for InitNew and HtmlSourceMode. @@ -257,7 +257,8 @@ public: void FormatPage( const OUString& rPage, const OString& rPageId, - SwWrtShell& rActShell ); + SwWrtShell& rActShell, + SfxRequest* pRequest = nullptr); // #i59688# /** linked graphics are now loaded on demand. diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index b17e936dd02e..bfbe6438110c 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -93,7 +93,7 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh) { SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); - SfxStyleFamily nActualFamily = (SfxStyleFamily)USHRT_MAX; + SfxStyleFamily nActualFamily = SfxStyleFamily(USHRT_MAX); SwWrtShell* pShell = pSh ? pSh : GetWrtShell(); if(!pShell) @@ -242,7 +242,7 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh) { SwEditWin& rEdtWin = pShell->GetView().GetEditWin(); SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); - rSet.Put(SfxBoolItem(nWhich, pApply && pApply->eType != (SfxStyleFamily)0)); + rSet.Put(SfxBoolItem(nWhich, pApply && pApply->eType != SfxStyleFamily(0))); } break; case SID_STYLE_UPDATE_BY_EXAMPLE: @@ -304,7 +304,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY, false, &pItem )) { - const SfxStyleFamily nFamily = (SfxStyleFamily) static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + const SfxStyleFamily nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); OUString sName; sal_uInt16 nMask = 0; @@ -322,7 +322,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if (sName.isEmpty() && m_xBasePool.get()) sName = SfxStyleDialog::GenerateUnusedName(*m_xBasePool); - Edit(sName, sParent, nFamily, nMask, true, OString(), nullptr, rReq.IsAPI()); + Edit(sName, sParent, nFamily, nMask, true, OString(), nullptr, &rReq); // Update Watermark if new page style was created if( nFamily == SfxStyleFamily::Page ) @@ -422,7 +422,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_FAMILY, false, &pItem )) - nFamily = (SfxStyleFamily) static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_FAMILYNAME, false, &pItem )) { @@ -514,18 +514,18 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) break; case SID_STYLE_APPLY: // Shell-switch in ApplyStyles - nRet = (sal_uInt16) ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() ); + nRet = static_cast<sal_uInt16>(ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() )); bReturns = true; break; case SID_STYLE_WATERCAN: - nRet = (sal_uInt16) DoWaterCan(aParam, nFamily); + nRet = static_cast<sal_uInt16>(DoWaterCan(aParam, nFamily)); bReturns = true; break; case SID_STYLE_UPDATE_BY_EXAMPLE: - nRet = static_cast<sal_uInt16>(UpdateStyle(aParam, nFamily, pActShell)); + UpdateStyle(aParam, nFamily, pActShell); break; case SID_STYLE_NEW_BY_EXAMPLE: - nRet = static_cast<sal_uInt16>(MakeByExample(aParam, nFamily, nMask, pActShell )); + MakeByExample(aParam, nFamily, nMask, pActShell); break; default: @@ -551,15 +551,13 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) class ApplyStyle { public: - ApplyStyle(SwDocShell &rDocSh, bool bNew, SfxStyleSheetBase* pStyle, - sal_uInt16 nRet, rtl::Reference< SwDocStyleSheet > const & xTmp, + ApplyStyle(SwDocShell &rDocSh, bool bNew, + rtl::Reference< SwDocStyleSheet > const & xTmp, SfxStyleFamily nFamily, SfxAbstractApplyTabDialog *pDlg, rtl::Reference< SfxStyleSheetBasePool > const & xBasePool, bool bModified) : m_rDocSh(rDocSh) , m_bNew(bNew) - , m_pStyle(pStyle) - , m_nRet(nRet) , m_xTmp(xTmp) , m_nFamily(nFamily) , m_pDlg(pDlg) @@ -572,12 +570,9 @@ public: { ApplyHdl(nullptr); } - sal_uInt16 getRet() const { return m_nRet; } private: SwDocShell &m_rDocSh; bool m_bNew; - SfxStyleSheetBase* m_pStyle; - sal_uInt16 m_nRet; rtl::Reference< SwDocStyleSheet > m_xTmp; SfxStyleFamily m_nFamily; VclPtr<SfxAbstractApplyTabDialog> m_pDlg; @@ -593,16 +588,6 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) pWrtShell->StartAllAction(); - // newly set the mask only with paragraph-templates - if( m_bNew ) - { - m_nRet = SfxStyleFamily::Para == m_pStyle->GetFamily() - ? m_xTmp->GetMask() - : SFXSTYLEBIT_USERDEF; - } - else if( m_pStyle->GetMask() != m_xTmp->GetMask() ) - m_nRet = m_xTmp->GetMask(); - if( SfxStyleFamily::Para == m_nFamily ) { SfxItemSet aSet( *m_pDlg->GetOutputItemSet() ); @@ -664,7 +649,7 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) pWrtShell->EndAllAction(); } -sal_uInt16 SwDocShell::Edit( +void SwDocShell::Edit( const OUString &rName, const OUString &rParent, const SfxStyleFamily nFamily, @@ -672,12 +657,12 @@ sal_uInt16 SwDocShell::Edit( const bool bNew, const OString& sPage, SwWrtShell* pActShell, - const bool bBasic ) + SfxRequest* pRequest) { assert( GetWrtShell() ); + const bool bBasic = pRequest && pRequest->IsAPI(); SfxStyleSheetBase *pStyle = nullptr; - sal_uInt16 nRet = nMask; bool bModified = m_xDoc->getIDocumentState().IsModified(); SwUndoId nNewStyleUndoId(SwUndoId::EMPTY); @@ -696,7 +681,7 @@ sal_uInt16 SwDocShell::Edit( else nMask = SFXSTYLEBIT_USERDEF; - pStyle = &m_xBasePool->Make( rName, (SfxStyleFamily)nFamily, nMask ); + pStyle = &m_xBasePool->Make( rName, nFamily, nMask ); // set the current one as Parent SwDocStyleSheet* pDStyle = static_cast<SwDocStyleSheet*>(pStyle); @@ -788,12 +773,12 @@ sal_uInt16 SwDocShell::Edit( } else { - pStyle = m_xBasePool->Find( rName, (SfxStyleFamily)nFamily ); + pStyle = m_xBasePool->Find( rName, nFamily ); SAL_WARN_IF( !pStyle, "sw.ui", "Style not found" ); } if(!pStyle) - return 0; + return; // put dialogues together rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pStyle) ) ); @@ -845,7 +830,7 @@ sal_uInt16 SwDocShell::Edit( *(xTmp.get()), nFamily, sPage, pActShell ? pActShell : m_pWrtShell, bNew)); assert( pDlg ); - ApplyStyle aApplyStyleHelper(*this, bNew, pStyle, nRet, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified); + ApplyStyle aApplyStyleHelper(*this, bNew, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified); pDlg->SetApplyHdl(LINK(&aApplyStyleHelper, ApplyStyle, ApplyHdl)); short nDlgRet = pDlg->Execute(); @@ -875,8 +860,6 @@ sal_uInt16 SwDocShell::Edit( if( !bModified ) m_xDoc->getIDocumentState().ResetModified(); } - - nRet = aApplyStyleHelper.getRet(); } else { @@ -885,16 +868,6 @@ sal_uInt16 SwDocShell::Edit( GetWrtShell()->StartAllAction(); - // newly set the mask only with paragraph-templates - if( bNew ) - { - nRet = SfxStyleFamily::Para == pStyle->GetFamily() - ? xTmp->GetMask() - : SFXSTYLEBIT_USERDEF; - } - else if( pStyle->GetMask() != xTmp->GetMask() ) - nRet = xTmp->GetMask(); - if( SfxStyleFamily::Para == nFamily ) ::SfxToSwPageDescAttr( *GetWrtShell(), xTmp->GetItemSet() ); else @@ -914,11 +887,9 @@ sal_uInt16 SwDocShell::Edit( } GetWrtShell()->EndAllAction(); } - - return nRet; } -bool SwDocShell::Delete(const OUString &rName, SfxStyleFamily nFamily) +void SwDocShell::Delete(const OUString &rName, SfxStyleFamily nFamily) { SfxStyleSheetBase *pStyle = m_xBasePool->Find(rName, nFamily); @@ -929,13 +900,10 @@ bool SwDocShell::Delete(const OUString &rName, SfxStyleFamily nFamily) GetWrtShell()->StartAllAction(); m_xBasePool->Remove(pStyle); GetWrtShell()->EndAllAction(); - - return true; } - return false; } -bool SwDocShell::Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden) +void SwDocShell::Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidden) { SfxStyleSheetBase *pStyle = m_xBasePool->Find(rName, nFamily); @@ -947,10 +915,7 @@ bool SwDocShell::Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidde rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pStyle) ) ); xTmp->SetHidden( bHidden ); GetWrtShell()->EndAllAction(); - - return true; } - return false; } // apply template @@ -1027,7 +992,7 @@ SfxStyleFamily SwDocShell::DoWaterCan(const OUString &rName, SfxStyleFamily nFam SwEditWin& rEdtWin = m_pView->GetEditWin(); SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); - bool bWaterCan = !(pApply && pApply->eType != (SfxStyleFamily)0); + bool bWaterCan = !(pApply && pApply->eType != SfxStyleFamily(0)); if( rName.isEmpty() ) bWaterCan = false; @@ -1067,7 +1032,7 @@ SfxStyleFamily SwDocShell::DoWaterCan(const OUString &rName, SfxStyleFamily nFam } } else - aTemplate.eType = (SfxStyleFamily)0; + aTemplate.eType = SfxStyleFamily(0); m_pView->GetEditWin().SetApplyTemplate(aTemplate); @@ -1075,7 +1040,7 @@ SfxStyleFamily SwDocShell::DoWaterCan(const OUString &rName, SfxStyleFamily nFam } // update template -SfxStyleFamily SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell) +void SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell) { SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell(); assert( pCurrWrtShell ); @@ -1083,8 +1048,8 @@ SfxStyleFamily SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFa SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>( m_xBasePool->Find(rName, nFamily) ); - if(!pStyle) - return nFamily; + if (!pStyle) + return; switch(nFamily) { @@ -1170,11 +1135,10 @@ SfxStyleFamily SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFa break; default: break; } - return nFamily; } // NewByExample -SfxStyleFamily SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily, +void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily, sal_uInt16 nMask, SwWrtShell* pShell ) { SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell(); @@ -1334,7 +1298,6 @@ SfxStyleFamily SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily default: break; } - return nFamily; } std::set<Color> SwDocShell::GetDocColors() @@ -1401,9 +1364,10 @@ void SwDocShell::LoadStyles_( SfxObjectShell& rSource, bool bPreserveCurrentDocu void SwDocShell::FormatPage( const OUString& rPage, const OString& rPageId, - SwWrtShell& rActShell ) + SwWrtShell& rActShell, + SfxRequest* pRequest) { - Edit( rPage, aEmptyOUStr, SfxStyleFamily::Page, 0, false, rPageId, &rActShell); + Edit(rPage, aEmptyOUStr, SfxStyleFamily::Page, 0, false, rPageId, &rActShell, pRequest); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index b938767159bb..a8e7ff358020 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2448,8 +2448,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) break; } - rTempView.GetDocShell()->FormatPage( - rPageDesc.GetName(), sPageId, rSh); + rTempView.GetDocShell()->FormatPage(rPageDesc.GetName(), sPageId, rSh, &rReq); rTempView.InvalidateRulerPos(); } } commit f72cd9bd5a51afd531de914bf81ab041b2cb92b7 Author: Pranav Kant <pran...@collabora.co.uk> Date: Thu Jan 18 19:06:23 2018 +0530 lokdialog: No modal mode in LOK ... otherwise the cursor in the document goes invisible as soon as the dialog is launched. Change-Id: I77bc30879550b354e1a9593db3c2db7ad3c68193 Reviewed-on: https://gerrit.libreoffice.org/48126 Reviewed-by: pranavk <pran...@collabora.co.uk> Tested-by: pranavk <pran...@collabora.co.uk> (cherry picked from commit 0e8d0fe001ceecea95ad7115b835527e13252a17) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index e6db9e2d4fee..36cb0dbf3f4d 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -67,6 +67,7 @@ #include <rtl/ustrbuf.hxx> #include <unotools/ucbhelper.hxx> +#include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/docpasswordrequest.hxx> @@ -2249,6 +2250,10 @@ OUString SfxViewFrame::GetActualPresentationURL_Impl() const void SfxViewFrame::SetModalMode( bool bModal ) { + // no real modality for LOK + if (comphelper::LibreOfficeKit::isActive()) + return; + m_pImpl->bModal = bModal; if ( m_xObjSh.is() ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits