desktop/source/lib/init.cxx | 40 +++++++++ include/vcl/jsdialog/jsdialogbuilder.hxx | 39 +++++++++ include/vcl/salvtables.hxx | 39 +++++++++ include/vcl/svapp.hxx | 3 include/vcl/vclmedit.hxx | 2 include/vcl/weld.hxx | 2 sc/inc/global.hxx | 4 sc/source/core/data/global.cxx | 24 ----- sc/source/core/data/validat.cxx | 7 + sc/source/ui/app/inputhdl.cxx | 16 ++- sc/source/ui/inc/tabvwsh.hxx | 6 + sc/source/ui/vba/vbarange.cxx | 15 ++- sc/source/ui/view/tabvwsh4.cxx | 5 - sc/source/ui/view/tabvwsha.cxx | 2 sc/source/ui/view/tabvwshe.cxx | 32 ++++++- sc/source/ui/view/viewfun2.cxx | 6 - sd/inc/sdmod.hxx | 5 - sd/source/ui/app/sdmod.cxx | 9 -- sd/source/ui/docshell/docshel3.cxx | 4 sd/source/ui/docshell/docshell.cxx | 2 sd/source/ui/inc/ViewShell.hxx | 5 + sd/source/ui/view/viewshel.cxx | 10 ++ svx/source/dialog/srchdlg.cxx | 10 +- sw/inc/view.hxx | 14 +-- sw/source/core/crsr/findtxt.cxx | 2 sw/source/uibase/uiview/view.cxx | 17 +--- vcl/jsdialog/jsdialogbuilder.cxx | 85 ++++++++++++++++++++- vcl/source/app/salvtables.cxx | 125 +++++++++++++------------------ vcl/source/edit/vclmedit.cxx | 9 ++ vcl/source/window/builder.cxx | 10 +- vcl/source/window/dialog.cxx | 2 vcl/source/window/layout.cxx | 2 32 files changed, 388 insertions(+), 165 deletions(-)
New commits: commit 8bc6891e71b996c4713c784c9d599e71c26bc135 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Mar 20 16:41:27 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri Mar 20 16:41:27 2020 +0100 Deglobalize find & replace data in Impress Change-Id: I16e914b4673e2aa80823d630306217b4cda50bad diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx index 3196bafe07da..362691794a9e 100644 --- a/sd/inc/sdmod.hxx +++ b/sd/inc/sdmod.hxx @@ -33,7 +33,6 @@ #include <memory> class SdOptions; -class SvxSearchItem; class EditFieldInfo; class SdTransferable; class SvNumberFormatter; @@ -94,9 +93,6 @@ public: bool GetWaterCan() const { return bWaterCan; } void SetWaterCan( bool bWC ) { bWaterCan = bWC; } - SvxSearchItem* GetSearchItem() { return pSearchItem.get(); } - void SetSearchItem(std::unique_ptr<SvxSearchItem> pItem); - /** Return the virtual device that can be used for printer independent layout. @return @@ -123,7 +119,6 @@ private: SdOptions* pImpressOptions; SdOptions* pDrawOptions; - std::unique_ptr<SvxSearchItem> pSearchItem; std::unique_ptr<SvNumberFormatter> pNumberFormatter; tools::SvRef<SotStorage> xOptionStorage; bool bWaterCan; diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx index b55213c44ed2..8d80c8f1b058 100644 --- a/sd/source/ui/app/sdmod.cxx +++ b/sd/source/ui/app/sdmod.cxx @@ -37,7 +37,6 @@ #include <svtools/ehdl.hxx> #include <svx/svxids.hrc> -#include <svl/srchitem.hxx> #include <svx/svxerr.hxx> #include <svx/xmlsecctrl.hxx> @@ -76,8 +75,6 @@ SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 ) mpColorConfig(new svtools::ColorConfig) { SetName( "StarDraw" ); // Do not translate! - pSearchItem.reset( new SvxSearchItem(SID_SEARCH_ITEM) ); - pSearchItem->SetAppFlag(SvxSearchApp::DRAW); StartListening( *SfxGetpApp() ); SvxErrorHandler::ensure(); mpErrorHdl.reset( new SfxErrorHandler(RID_SD_ERRHDL, ErrCodeArea::Sd, ErrCodeArea::Sd, GetResLocale()) ); @@ -98,7 +95,6 @@ OUString SdResId(const char* pId) // Dtor SdModule::~SdModule() { - pSearchItem.reset(); pNumberFormatter.reset(); if (mbEventListenerAdded) @@ -110,11 +106,6 @@ SdModule::~SdModule() mpVirtualRefDevice.disposeAndClear(); } -void SdModule::SetSearchItem(std::unique_ptr<SvxSearchItem> pItem) -{ - pSearchItem = std::move(pItem); -} - /// get notifications void SdModule::Notify( SfxBroadcaster&, const SfxHint& rHint ) { diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index 8aab98e8dd65..2143771a147d 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -157,7 +157,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) { const SvxSearchItem & rSearchItem = pReqArgs->Get(SID_SEARCH_ITEM); - SD_MOD()->SetSearchItem(std::unique_ptr<SvxSearchItem>(static_cast<SvxSearchItem*>(rSearchItem.Clone()))); + GetViewShell()->SetSearchItem(std::unique_ptr<SvxSearchItem>(static_cast<SvxSearchItem*>(rSearchItem.Clone()))); } rReq.Done(); @@ -220,7 +220,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) { const SvxSearchItem& rSearchItem = pReqArgs->Get(SID_SEARCH_ITEM); - SD_MOD()->SetSearchItem(std::unique_ptr<SvxSearchItem>(static_cast<SvxSearchItem*>( rSearchItem.Clone() ))); + GetViewShell()->SetSearchItem(std::unique_ptr<SvxSearchItem>(static_cast<SvxSearchItem*>( rSearchItem.Clone() ))); xFuSearch->SearchAndReplace(&rSearchItem); } } diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 13e9dcd72771..8baae6075ee5 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -227,7 +227,7 @@ void DrawDocShell::GetState(SfxItemSet &rSet) case SID_SEARCH_ITEM: { - rSet.Put( *SD_MOD()->GetSearchItem() ); + rSet.Put( *GetViewShell()->GetSearchItem() ); } break; diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 57c2d1df78c6..070ff47333a3 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -417,6 +417,9 @@ public: /// Allows starting or ending a graphic move or resize action. void SetGraphicMm100Position(bool bStart, const Point& rPosition); + SvxSearchItem* GetSearchItem() { return mpSearchItem.get(); } + void SetSearchItem(std::unique_ptr<SvxSearchItem> pItem); + class Implementation; protected: @@ -546,6 +549,8 @@ private: /** Create the rulers. */ void SetupRulers(); + + std::unique_ptr<SvxSearchItem> mpSearchItem; }; SdrView* ViewShell::GetDrawView() const diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 6a5afbc3d366..9bbbc423e934 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -87,6 +87,7 @@ #include <editeng/editview.hxx> #include <editeng/editeng.hxx> #include <svl/poolitem.hxx> +#include <svl/srchitem.hxx> #include <strings.hxx> #include <sdmod.hxx> #include <AccessibleDocumentViewBase.hxx> @@ -137,12 +138,16 @@ SfxViewFrame* ViewShell::GetViewFrame() const ViewShell::ViewShell( vcl::Window* pParentWindow, ViewShellBase& rViewShellBase) : SfxShell(&rViewShellBase) , mpParentWindow(pParentWindow) +, mpSearchItem(new SvxSearchItem(SID_SEARCH_ITEM)) { + mpSearchItem->SetAppFlag(SvxSearchApp::DRAW); construct(); } ViewShell::~ViewShell() { + mpSearchItem.reset(); + // Keep the content window from accessing in its destructor the // WindowUpdater. if (mpContentWindow) @@ -1575,6 +1580,11 @@ sd::Window* ViewShell::GetContentWindow() const return mpContentWindow.get(); } +void ViewShell::SetSearchItem(std::unique_ptr<SvxSearchItem> pItem) +{ + mpSearchItem = std::move(pItem); +} + } // end of namespace sd //===== ViewShellObjectBarFactory ============================================= commit 213dbcb71ecc4b23bb2b787a3e0b3cf07f3e21ed Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Mar 20 15:21:17 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri Mar 20 15:21:17 2020 +0100 Deglobalize find & replace data in Calc Change-Id: I57d28b53ff1f5aa1bc578a52d250230f3c78ccab diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index cb0c522e30ad..d1d1e5ed86e1 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -466,7 +466,6 @@ struct ScImportParam }; class ScDocShell; -class SvxSearchItem; class ScAutoFormat; class LegacyFuncCollection; class ScUnoAddInCollection; @@ -501,7 +500,6 @@ namespace utl { class ScGlobal { - static SvxSearchItem* pSearchItem; static ScAutoFormat* pAutoFormat; static std::atomic<LegacyFuncCollection*> pLegacyFuncCollection; static std::atomic<ScUnoAddInCollection*> pAddInCollection; @@ -555,8 +553,6 @@ public: static const OUString& GetClipDocName(); static void SetClipDocName( const OUString& rNew ); - SC_DLLPUBLIC static const SvxSearchItem& GetSearchItem(); - SC_DLLPUBLIC static void SetSearchItem( const SvxSearchItem& rNew ); SC_DLLPUBLIC static ScAutoFormat* GetAutoFormat(); SC_DLLPUBLIC static ScAutoFormat* GetOrCreateAutoFormat(); static void ClearAutoFormat(); //BugId 54209 diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index aed73d93b3bd..27cd2af9cf25 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -68,7 +68,6 @@ #include <docsh.hxx> tools::SvRef<ScDocShell> ScGlobal::xDrawClipDocShellRef; -SvxSearchItem* ScGlobal::pSearchItem = nullptr; ScAutoFormat* ScGlobal::pAutoFormat = nullptr; std::atomic<LegacyFuncCollection*> ScGlobal::pLegacyFuncCollection(nullptr); std::atomic<ScUnoAddInCollection*> ScGlobal::pAddInCollection(nullptr); @@ -210,28 +209,6 @@ bool ScGlobal::CheckWidthInvalidate( bool& bNumFormatChanged, ); } -const SvxSearchItem& ScGlobal::GetSearchItem() -{ - assert(!bThreadedGroupCalcInProgress); - if (!pSearchItem) - { - pSearchItem = new SvxSearchItem( SID_SEARCH_ITEM ); - pSearchItem->SetAppFlag( SvxSearchApp::CALC ); - } - return *pSearchItem; -} - -void ScGlobal::SetSearchItem( const SvxSearchItem& rNew ) -{ - assert(!bThreadedGroupCalcInProgress); - // FIXME: An assignment operator would be nice here - delete pSearchItem; - pSearchItem = static_cast<SvxSearchItem*>(rNew.Clone()); - - pSearchItem->SetWhich( SID_SEARCH_ITEM ); - pSearchItem->SetAppFlag( SvxSearchApp::CALC ); -} - void ScGlobal::ClearAutoFormat() { assert(!bThreadedGroupCalcInProgress); @@ -541,7 +518,6 @@ void ScGlobal::Clear() theAddInAsyncTbl.clear(); ExitExternalFunc(); ClearAutoFormat(); - DELETEZ(pSearchItem); delete pLegacyFuncCollection.load(); pLegacyFuncCollection = nullptr; delete pAddInCollection.load(); pAddInCollection = nullptr; DELETEZ(pUserList); diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index e09d1ceb93c4..10c1f6ce5b8f 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -168,6 +168,9 @@ private: bool mbInSwitch; OUString maName; OUString maScope; + + SvxSearchItem* pSearchItem; + private: void Construct( TriState nForceDesignMode ); @@ -403,6 +406,9 @@ public: void InitFormEditData(); void ClearFormEditData(); ScFormEditData* GetFormEditData() { return mpFormEditData.get(); } + + const SvxSearchItem& GetSearchItem(); + void SetSearchItem( const SvxSearchItem& rNew ); }; #endif diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index d3bdf3a59796..1820a97d1643 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -3037,7 +3037,11 @@ ScVbaRange::Replace( const OUString& What, const OUString& Replacement, const un OUString sWhat = VBAToRegexp( What); // #TODO #FIXME SearchFormat & ReplacesFormat are not processed // What do we do about MatchByte.. we don't seem to support that - const SvxSearchItem& globalSearchOptions = ScGlobal::GetSearchItem(); + ScTabViewShell* pViewShell = static_cast<ScTabViewShell*>(SfxViewShell::Current()); + if (!pViewShell) + return true; + + const SvxSearchItem& globalSearchOptions = pViewShell->GetSearchItem(); SvxSearchItem newOptions( globalSearchOptions ); uno::Reference< util::XReplaceable > xReplace( mxRange, uno::UNO_QUERY ); @@ -3089,7 +3093,7 @@ ScVbaRange::Replace( const OUString& What, const OUString& Replacement, const un xDescriptor->setPropertyValue( SC_UNO_SRCHCASE, uno::makeAny( bMatchCase ) ); } - ScGlobal::SetSearchItem( newOptions ); + pViewShell->SetSearchItem( newOptions ); // ignore MatchByte for the moment, it's not supported in // OOo.org afaik @@ -3144,7 +3148,10 @@ ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& L OUString sSearch = VBAToRegexp( sWhat ); - const SvxSearchItem& globalSearchOptions = ScGlobal::GetSearchItem(); + ScTabViewShell* pViewShell = static_cast<ScTabViewShell*>(SfxViewShell::Current()); + if (!pViewShell) + return uno::Reference< excel::XRange >(); + const SvxSearchItem& globalSearchOptions = pViewShell->GetSearchItem(); SvxSearchItem newOptions( globalSearchOptions ); uno::Reference< util::XSearchable > xSearch( mxRange, uno::UNO_QUERY ); @@ -3254,7 +3261,7 @@ ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& L // SearchFormat // ignore - ScGlobal::SetSearchItem( newOptions ); + pViewShell->SetSearchItem( newOptions ); uno::Reference< uno::XInterface > xInterface = xStartCell.is() ? xSearch->findNext( xStartCell, xDescriptor) : xSearch->findFirst( xDescriptor ); uno::Reference< table::XCellRange > xCellRange( xInterface, uno::UNO_QUERY ); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index ec912c115848..82981bbf63e2 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1645,7 +1645,8 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, bInPrepareClose(false), bInDispose(false), nCurRefDlgId(0), - mbInSwitch(false) + mbInSwitch(false), + pSearchItem(nullptr) { const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions(); @@ -1787,6 +1788,8 @@ ScTabViewShell::~ScTabViewShell() pFormShell.reset(); pAccessibilityBroadcaster.reset(); + + DELETEZ(pSearchItem); } void ScTabViewShell::SetDialogDPObject( std::unique_ptr<ScDPObject> pObj ) diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 815ae6745a80..167bc282001c 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -219,7 +219,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) case SID_SEARCH_ITEM: { - SvxSearchItem aItem(ScGlobal::GetSearchItem()); // make a copy. + SvxSearchItem aItem(GetSearchItem()); // make a copy. // Search on current selection if a range is marked. aItem.SetSelection(rMark.IsMarked()); rSet.Put(aItem); diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index d6557932ea34..9f5b711727ff 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -232,6 +232,28 @@ void ScTabViewShell::InsertURLField( const OUString& rName, const OUString& rURL pHdl->DataChanged(); } +const SvxSearchItem& ScTabViewShell::GetSearchItem() +{ + assert(!ScGlobal::bThreadedGroupCalcInProgress); + if (!pSearchItem) + { + pSearchItem = new SvxSearchItem( SID_SEARCH_ITEM ); + pSearchItem->SetAppFlag( SvxSearchApp::CALC ); + } + return *pSearchItem; +} + +void ScTabViewShell::SetSearchItem( const SvxSearchItem& rNew ) +{ + assert(!ScGlobal::bThreadedGroupCalcInProgress); + // FIXME: An assignment operator would be nice here + delete pSearchItem; + pSearchItem = static_cast<SvxSearchItem*>(rNew.Clone()); + + pSearchItem->SetWhich( SID_SEARCH_ITEM ); + pSearchItem->SetAppFlag( SvxSearchApp::CALC ); +} + void ScTabViewShell::ExecSearch( SfxRequest& rReq ) { const SfxItemSet* pReqArgs = rReq.GetArgs(); @@ -248,7 +270,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) OSL_ENSURE( dynamic_cast<const SvxSearchItem*>( pItem) != nullptr, "wrong Item" ); const SvxSearchItem* pSearchItem = static_cast<const SvxSearchItem*>(pItem); - ScGlobal::SetSearchItem( *pSearchItem ); + SetSearchItem( *pSearchItem ); bool bSuccess = SearchAndReplace( pSearchItem, true, rReq.IsAPI() ); SfxChildWindow* pChildWindow = SfxViewFrame::Current()->GetChildWindow( SvxSearchDialogWrapper::GetChildWindowId()); @@ -280,7 +302,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) { // remember search item OSL_ENSURE( dynamic_cast<const SvxSearchItem*>( pItem) != nullptr, "wrong Item" ); - ScGlobal::SetSearchItem( *static_cast<const SvxSearchItem*>(pItem )); + SetSearchItem( *static_cast<const SvxSearchItem*>(pItem )); } else { @@ -296,7 +318,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) { // get search item - SvxSearchItem aSearchItem = ScGlobal::GetSearchItem(); + SvxSearchItem aSearchItem = GetSearchItem(); // fill search item @@ -349,9 +371,9 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) break; case FID_REPEAT_SEARCH: { - // once more with ScGlobal::GetSearchItem() + // once more with GetSearchItem() - SvxSearchItem aSearchItem = ScGlobal::GetSearchItem(); + SvxSearchItem aSearchItem = GetSearchItem(); aSearchItem.SetWhich(SID_SEARCH_ITEM); GetViewData().GetDispatcher().ExecuteList( FID_SEARCH_NOW, rReq.IsAPI() ? SfxCallMode::API|SfxCallMode::SYNCHRON : diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 1b948b916746..4d78adb15ed6 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2013,11 +2013,13 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, { pDocSh->PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PaintPartFlags::Grid ); + ScTabViewShell* pViewShell = GetViewData().GetViewShell(); + // jump to next cell if we replaced everything in the cell // where the cursor was positioned (but avoid switching tabs) - if ( nCol == nOldCol && nRow == nOldRow && nTab == nOldTab ) + if ( nCol == nOldCol && nRow == nOldRow && nTab == nOldTab && pViewShell ) { - SvxSearchItem aSearchItem = ScGlobal::GetSearchItem(); + SvxSearchItem aSearchItem = pViewShell->GetSearchItem(); aSearchItem.SetCommand(SvxSearchCmd::FIND); aSearchItem.SetWhich(SID_SEARCH_ITEM); commit 5135d9596b06e6146217adffb7d5febe5860592a Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Mar 20 10:19:56 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri Mar 20 15:20:36 2020 +0100 Deglobalize find & replace data in Writer Thanks to that we don't interfere with searching options in other views in online case. Change-Id: Ie7c3eb06f34743d4e96a44f8f952652df092022d diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index fdeb5b29266b..9ec0d2fde52a 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -154,8 +154,11 @@ struct SearchDlg_Impl static void ListToStrArr_Impl( sal_uInt16 nId, std::vector<OUString>& rStrLst, weld::ComboBox& rCBox ) { + SfxShell* pShell = comphelper::LibreOfficeKit::isActive() + ? static_cast<SfxShell*>(SfxViewShell::Current()) + : static_cast<SfxShell*>(SfxGetpApp()); const SfxStringListItem* pSrchItem = - static_cast<const SfxStringListItem*>(SfxGetpApp()->GetItem( nId )); + static_cast<const SfxStringListItem*>(pShell->GetItem( nId )); if (pSrchItem) { @@ -172,7 +175,10 @@ static void ListToStrArr_Impl( sal_uInt16 nId, std::vector<OUString>& rStrLst, w static void StrArrToList_Impl( sal_uInt16 nId, const std::vector<OUString>& rStrLst ) { DBG_ASSERT( !rStrLst.empty(), "check in advance"); - SfxGetpApp()->PutItem( SfxStringListItem( nId, &rStrLst ) ); + SfxShell* pShell = comphelper::LibreOfficeKit::isActive() + ? static_cast<SfxShell*>(SfxViewShell::Current()) + : static_cast<SfxShell*>(SfxGetpApp()); + pShell->PutItem( SfxStringListItem( nId, &rStrLst ) ); } SearchAttrItemList::SearchAttrItemList( const SearchAttrItemList& rList ) : diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index 94e2cc86e81e..dc652f9e23f4 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -149,17 +149,17 @@ class SW_DLLPUBLIC SwView: public SfxViewShell friend class SwClipboardChangeListener; // search & replace - static SvxSearchItem *m_pSrchItem; + SvxSearchItem *m_pSrchItem; static sal_uInt16 m_nMoveType; // for buttons below the scrollbar (viewmdi) static sal_Int32 m_nActMark; // current jump mark for unknown mark - static bool m_bExtra; - static bool m_bFound; - static bool m_bJustOpened; + bool m_bExtra; + bool m_bFound; + bool m_bJustOpened; - static SearchAttrItemList* m_pSrchList; - static SearchAttrItemList* m_pReplList; + SearchAttrItemList* m_pSrchList; + SearchAttrItemList* m_pReplList; Timer m_aTimer; // for delayed ChgLnks during an action OUString m_sSwViewData, @@ -629,7 +629,7 @@ public: SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const override; SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage(TabPageParent pParent, const SfxItemSet& rSet) override; - static SvxSearchItem* GetSearchItem() { return m_pSrchItem; } + SvxSearchItem* GetSearchItem() { return m_pSrchItem; } /// See SfxViewShell::getPart(). int getPart() const override; /// See SfxViewShell::dumpAsXml(). diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 03239dfb1063..436d84eec2c0 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -532,7 +532,7 @@ bool FindTextImpl(SwPaM & rSearchPam, if (comphelper::LibreOfficeKit::isActive()) { // Writer and editeng selections are not supported in parallel. - SvxSearchItem* pSearchItem = SwView::GetSearchItem(); + SvxSearchItem* pSearchItem = pDocShell->GetView()->GetSearchItem(); // If we just finished search in shape text, don't attempt to do that again. if (!bEndedTextEdit && !(pSearchItem && pSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL)) { diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 039977ff6827..46b3f68ba5c9 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -125,19 +125,8 @@ using namespace ::com::sun::star::scanner; #define SWVIEWFLAGS SfxViewShellFlags::HAS_PRINTOPTIONS -// Statics. OMG. - bool bDocSzUpdated = true; -SvxSearchItem* SwView::m_pSrchItem = nullptr; - -bool SwView::m_bExtra = false; -bool SwView::m_bFound = false; -bool SwView::m_bJustOpened = false; - -SearchAttrItemList* SwView::m_pSrchList = nullptr; -SearchAttrItemList* SwView::m_pReplList = nullptr; - SfxDispatcher &SwView::GetDispatcher() { return *GetViewFrame()->GetDispatcher(); @@ -715,6 +704,12 @@ void SwView::CheckReadonlySelection() SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) : SfxViewShell( _pFrame, SWVIEWFLAGS ), + m_pSrchItem(nullptr), + m_bExtra(false), + m_bFound(false), + m_bJustOpened(false), + m_pSrchList(nullptr), + m_pReplList(nullptr), m_nNewPage(USHRT_MAX), m_nOldPageNum(0), m_pNumRuleNodeFromDoc(nullptr), commit c156551a08a6a5920868668b1c753cc2901af3d3 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Mar 19 13:54:18 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Thu Mar 19 13:54:21 2020 +0100 Fix sending reference marks for current selection When selecting range on mobile in validation dialog the message wasn't sent due to missing ViewShell Change-Id: Iaab543368469cd363b54b1a89f6983b8c01877ce diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 5c4d4de77f96..d5a341089e2a 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -465,10 +465,16 @@ ReferenceMark ScInputHandler::GetReferenceMark( ScViewData& rViewData, ScDocShel void ScInputHandler::UpdateLokReferenceMarks() { - if ( !comphelper::LibreOfficeKit::isActive() || !pActiveViewSh ) + if ( !comphelper::LibreOfficeKit::isActive()) return; - ScViewData& rViewData = pActiveViewSh->GetViewData(); + ScTabViewShell* pShell = pActiveViewSh ? pActiveViewSh + : dynamic_cast<ScTabViewShell*>(SfxViewShell::Current()); + + if (!pShell) + return; + + ScViewData& rViewData = pShell->GetViewData(); ScDocShell* pDocSh = rViewData.GetDocShell(); ScRangeFindList* pRangeFinder = GetRangeFindList(); @@ -521,18 +527,18 @@ void ScInputHandler::UpdateLokReferenceMarks() nX1, nX2, nY1, nY2, nTab, Color( rData.nColor ) ); - ScInputHandler::SendReferenceMarks( pActiveViewSh, aReferenceMarks ); + ScInputHandler::SendReferenceMarks( pShell, aReferenceMarks ); } } else if ( nCount ) { - ScInputHandler::SendReferenceMarks( pActiveViewSh, aReferenceMarks ); + ScInputHandler::SendReferenceMarks( pShell, aReferenceMarks ); } else { // Clear aReferenceMarks.clear(); - ScInputHandler::SendReferenceMarks( pActiveViewSh, aReferenceMarks ); + ScInputHandler::SendReferenceMarks( pShell, aReferenceMarks ); } } commit 88d2f871156b5380f0a8176c3def36a88e9ca6e3 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Mar 19 12:45:59 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Thu Mar 19 12:45:59 2020 +0100 jsdialog: rerender after action Change-Id: I2896d22d915502b1a7a8dcead1a056235a65a0b8 diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 4316974be9ad..215979d0d5d0 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3641,10 +3641,32 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin bContinueWithLOKWindow = true; } } + else if (sControlType == "checkbox") + { + auto pCheckButton = dynamic_cast<weld::CheckButton*>(pWidget); + if (pCheckButton) + { + if (sAction == "change") + { + if (aMap["data"] == "true" || aMap["data"] == "false") + pCheckButton->set_state( + aMap["data"] == "true" ? TRISTATE_TRUE : TRISTATE_FALSE); + } + else + bContinueWithLOKWindow = true; + } + } else { bContinueWithLOKWindow = true; } + + if (!bContinueWithLOKWindow) + { + JSDialogSender* pSender = dynamic_cast<JSDialogSender*>(pWidget); + if (pSender) + pSender->notifyDialogState(); + } } if (!bIsWeldedDialog || bContinueWithLOKWindow) diff --git a/include/vcl/jsdialog/jsdialogbuilder.hxx b/include/vcl/jsdialog/jsdialogbuilder.hxx index 9014dd94207b..6e7324edc6b9 100644 --- a/include/vcl/jsdialog/jsdialogbuilder.hxx +++ b/include/vcl/jsdialog/jsdialogbuilder.hxx @@ -13,7 +13,7 @@ typedef std::map<OString, weld::Widget*> WidgetMap; -class JSDialogSender +class VCL_DLLPUBLIC JSDialogSender { VclPtr<vcl::Window> m_aOwnedToplevel; public: commit 7a202adec230df7b67bd296e6fdd23dbc14aa3a7 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Mar 19 12:29:33 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Thu Mar 19 12:29:33 2020 +0100 jsdialog: checkbutton set_state action Change-Id: I259d79004f795d1e5892b9fc163e6c1eca9ddc68 diff --git a/include/vcl/jsdialog/jsdialogbuilder.hxx b/include/vcl/jsdialog/jsdialogbuilder.hxx index 9e32fe034d25..9014dd94207b 100644 --- a/include/vcl/jsdialog/jsdialogbuilder.hxx +++ b/include/vcl/jsdialog/jsdialogbuilder.hxx @@ -76,8 +76,10 @@ public: virtual void set_sensitive(bool sensitive) override { + bool change = sensitive != BaseInstanceClass::get_sensitive(); BaseInstanceClass::set_sensitive(sensitive); - notifyDialogState(); + if (change) + notifyDialogState(); } }; @@ -177,7 +179,7 @@ public: JSCheckButton(VclPtr<vcl::Window> aOwnedToplevel, ::CheckBox* pCheckBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership); - virtual void set_active(bool active) override; + virtual void set_state(TriState eState) override; }; #endif diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 6c207e59cc13..8e4cf537414a 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -617,7 +617,7 @@ public: return TRISTATE_FALSE; } - void set_state(TriState eState) + virtual void set_state(TriState eState) { switch (eState) { diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index ff07303dcc16..c0d56198bfdd 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -415,8 +415,8 @@ JSCheckButton::JSCheckButton(VclPtr<vcl::Window> aOwnedToplevel, ::CheckBox* pCh { } -void JSCheckButton::set_active(bool active) +void JSCheckButton::set_state(TriState eState) { - SalInstanceCheckButton::set_active(active); + SalInstanceCheckButton::set_state(eState); notifyDialogState(); } commit 93d4afbc235c9f6a2ce10dc3b7be4e2410525d26 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Mar 18 11:12:36 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Wed Mar 18 11:14:22 2020 +0100 jsdialog: weld checkbutton Change-Id: I4bf89601e2ff6a0534e76ef78d2d896160a72850 diff --git a/include/vcl/jsdialog/jsdialogbuilder.hxx b/include/vcl/jsdialog/jsdialogbuilder.hxx index cef8c602e6cc..9e32fe034d25 100644 --- a/include/vcl/jsdialog/jsdialogbuilder.hxx +++ b/include/vcl/jsdialog/jsdialogbuilder.hxx @@ -45,6 +45,7 @@ public: virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id, bool bTakeOwnership = false) override; virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString &id, bool bTakeOwnership = false) override; virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString &id, bool bTakeOwnership = false) override; + virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OString &id, bool bTakeOwnership = false) override; static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString& rPrimaryMessage); @@ -170,4 +171,13 @@ public: virtual void set_secondary_text(const OUString& rText) override; }; +class VCL_DLLPUBLIC JSCheckButton : public JSWidget<SalInstanceCheckButton, ::CheckBox> +{ +public: + JSCheckButton(VclPtr<vcl::Window> aOwnedToplevel, ::CheckBox* pCheckBox, + SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_active(bool active) override; +}; + #endif diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 73a34564f4c1..ff07303dcc16 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -209,6 +209,19 @@ std::unique_ptr<weld::SpinButton> JSInstanceBuilder::weld_spin_button(const OStr return pWeldWidget; } +std::unique_ptr<weld::CheckButton> JSInstanceBuilder::weld_check_button(const OString &id, bool bTakeOwnership) +{ + CheckBox* pCheckButton = m_xBuilder->get<CheckBox>(id); + auto pWeldWidget = pCheckButton ? + std::make_unique<JSCheckButton>(m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog, + pCheckButton, this, bTakeOwnership) : nullptr; + + if (pWeldWidget) + RememberWidget(id, pWeldWidget.get()); + + return pWeldWidget; +} + weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString& rPrimaryMessage) { @@ -395,3 +408,15 @@ void JSMessageDialog::set_secondary_text(const OUString& rText) SalInstanceMessageDialog::set_secondary_text(rText); notifyDialogState(); } + +JSCheckButton::JSCheckButton(VclPtr<vcl::Window> aOwnedToplevel, ::CheckBox* pCheckBox, + SalInstanceBuilder* pBuilder, bool bTakeOwnership) +: JSWidget<SalInstanceCheckButton, ::CheckBox>(aOwnedToplevel, pCheckBox, pBuilder, bTakeOwnership) +{ +} + +void JSCheckButton::set_active(bool active) +{ + SalInstanceCheckButton::set_active(active); + notifyDialogState(); +} commit 83e2b4ca9aadba6908a1a6e3d5d408395609b790 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Mar 18 11:07:02 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Wed Mar 18 11:07:02 2020 +0100 Move SalInstanceCheckButton to header file Change-Id: Id6597cd259abefe69a61f0ab414c6bd2114c9749 diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx index bdc9963c30d9..07defb2472ef 100644 --- a/include/vcl/salvtables.hxx +++ b/include/vcl/salvtables.hxx @@ -729,4 +729,24 @@ public: virtual weld::Container* weld_message_area() override; }; +class SalInstanceCheckButton : public SalInstanceButton, public virtual weld::CheckButton +{ +private: + VclPtr<CheckBox> m_xCheckButton; + + DECL_LINK(ToggleHdl, CheckBox&, void); +public: + SalInstanceCheckButton(CheckBox* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_active(bool active) override; + + virtual bool get_active() const override; + + virtual void set_inconsistent(bool inconsistent) override; + + virtual bool get_inconsistent() const override; + + virtual ~SalInstanceCheckButton() override; +}; + #endif \ No newline at end of file diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 5f03ccf8e88b..52babe2355b3 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1553,51 +1553,43 @@ IMPL_LINK(SalInstanceToggleButton, ToggleListener, VclWindowEvent&, rEvent, void signal_toggled(); } -class SalInstanceCheckButton : public SalInstanceButton, public virtual weld::CheckButton +SalInstanceCheckButton::SalInstanceCheckButton(CheckBox* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : SalInstanceButton(pButton, pBuilder, bTakeOwnership) + , m_xCheckButton(pButton) { -private: - VclPtr<CheckBox> m_xCheckButton; - - DECL_LINK(ToggleHdl, CheckBox&, void); -public: - SalInstanceCheckButton(CheckBox* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership) - : SalInstanceButton(pButton, pBuilder, bTakeOwnership) - , m_xCheckButton(pButton) - { - m_xCheckButton->SetToggleHdl(LINK(this, SalInstanceCheckButton, ToggleHdl)); - } + m_xCheckButton->SetToggleHdl(LINK(this, SalInstanceCheckButton, ToggleHdl)); +} - virtual void set_active(bool active) override - { - disable_notify_events(); - m_xCheckButton->EnableTriState(false); - m_xCheckButton->Check(active); - enable_notify_events(); - } +void SalInstanceCheckButton::set_active(bool active) +{ + disable_notify_events(); + m_xCheckButton->EnableTriState(false); + m_xCheckButton->Check(active); + enable_notify_events(); +} - virtual bool get_active() const override - { - return m_xCheckButton->IsChecked(); - } +bool SalInstanceCheckButton::get_active() const +{ + return m_xCheckButton->IsChecked(); +} - virtual void set_inconsistent(bool inconsistent) override - { - disable_notify_events(); - m_xCheckButton->EnableTriState(true); - m_xCheckButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE); - enable_notify_events(); - } +void SalInstanceCheckButton::set_inconsistent(bool inconsistent) +{ + disable_notify_events(); + m_xCheckButton->EnableTriState(true); + m_xCheckButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE); + enable_notify_events(); +} - virtual bool get_inconsistent() const override - { - return m_xCheckButton->GetState() == TRISTATE_INDET; - } +bool SalInstanceCheckButton::get_inconsistent() const +{ + return m_xCheckButton->GetState() == TRISTATE_INDET; +} - virtual ~SalInstanceCheckButton() override - { - m_xCheckButton->SetToggleHdl(Link<CheckBox&, void>()); - } -}; +SalInstanceCheckButton::~SalInstanceCheckButton() +{ + m_xCheckButton->SetToggleHdl(Link<CheckBox&, void>()); +} IMPL_LINK_NOARG(SalInstanceCheckButton, ToggleHdl, CheckBox&, void) { commit 061af5f34d130f823050daae429f11eb1f6092fa Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Mar 18 10:31:09 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Wed Mar 18 10:31:09 2020 +0100 jsdialog: implement plus/minus for welded spinfields Change-Id: I8a0bf4190c09520d7be78c44742902539cb9bf38 diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index e0449a3827ee..4316974be9ad 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3624,6 +3624,23 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin bContinueWithLOKWindow = true; } } + else if (sControlType == "spinfield") + { + auto pSpinField = dynamic_cast<weld::SpinButton*>(pWidget); + if (pSpinField) + { + if (sAction == "plus") + { + pSpinField->set_value(pSpinField->get_value() + 1); + } + else if (sAction == "minus") + { + pSpinField->set_value(pSpinField->get_value() - 1); + } + else + bContinueWithLOKWindow = true; + } + } else { bContinueWithLOKWindow = true; commit b83ca87974f1707799285b23aa474f1c5ad59707 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Mar 18 09:57:09 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Wed Mar 18 09:57:09 2020 +0100 Move messagedialog header to shared include Change-Id: Ice8d01d2bb62667667a4c5f0366120cdb7600472 diff --git a/vcl/inc/messagedialog.hxx b/include/vcl/messagedialog.hxx similarity index 100% rename from vcl/inc/messagedialog.hxx rename to include/vcl/messagedialog.hxx diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx index 88ba9b1e0507..bdc9963c30d9 100644 --- a/include/vcl/salvtables.hxx +++ b/include/vcl/salvtables.hxx @@ -13,7 +13,7 @@ #include <vcl/lstbox.hxx> #include <vcl/tabctrl.hxx> #include <vcl/layout.hxx> -#include <messagedialog.hxx> +#include <vcl/messagedialog.hxx> class SalInstanceBuilder : public weld::Builder { diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 666fe5a70fbc..efd46f9adec0 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -53,7 +53,7 @@ #include <vcl/commandinfoprovider.hxx> #include <svdata.hxx> #include <bitmaps.hlst> -#include <messagedialog.hxx> +#include <vcl/messagedialog.hxx> #include <window.h> #include <xmlreader/xmlreader.hxx> #include <desktop/crashreport.hxx> diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 79e2cd95300d..209179cc9591 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -63,7 +63,7 @@ #include <vcl/uitest/logger.hxx> #include <vcl/virdev.hxx> #include <vcl/IDialogRenderable.hxx> -#include <messagedialog.hxx> +#include <vcl/messagedialog.hxx> #include <salframe.hxx> #include <iostream> diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index ce7a69e6455d..355a0d338778 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -16,7 +16,7 @@ #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> -#include <messagedialog.hxx> +#include <vcl/messagedialog.hxx> #include <window.h> #include <boost/multi_array.hpp> #include <officecfg/Office/Common.hxx> commit 86e5db11442ef2a7918087c73f0de5ade74ed387 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Mar 18 09:46:03 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Wed Mar 18 09:46:03 2020 +0100 jsdialog: regenerate JSON on dialog collapse Change-Id: I407979546a7610630e8109b57db8c98c956baaee diff --git a/include/vcl/jsdialog/jsdialogbuilder.hxx b/include/vcl/jsdialog/jsdialogbuilder.hxx index 9cc569ed0f1b..cef8c602e6cc 100644 --- a/include/vcl/jsdialog/jsdialogbuilder.hxx +++ b/include/vcl/jsdialog/jsdialogbuilder.hxx @@ -80,6 +80,16 @@ public: } }; +class VCL_DLLPUBLIC JSDialog : public JSWidget<SalInstanceDialog, ::Dialog> +{ +public: + JSDialog(VclPtr<vcl::Window> aOwnedToplevel, ::Dialog* pDialog, + SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) override; + virtual void undo_collapse() override; +}; + class VCL_DLLPUBLIC JSLabel : public JSWidget<SalInstanceLabel, FixedText> { public: diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index e7f5380a5523..73a34564f4c1 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -95,7 +95,6 @@ std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& id, InsertWindowToMap(m_nWindowId); - std::unique_ptr<weld::Dialog> pRet(pDialog ? new SalInstanceDialog(pDialog, this, false) : nullptr); if (bTakeOwnership && pDialog) { assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed"); @@ -103,6 +102,7 @@ std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& id, m_xBuilder->drop_ownership(pDialog); m_bHasTopLevelDialog = true; } + std::unique_ptr<weld::Dialog> pRet(pDialog ? new JSDialog(m_aOwnedToplevel, pDialog, this, false) : nullptr); const vcl::ILibreOfficeKitNotifier* pNotifier = pDialog->GetLOKNotifier(); if (pNotifier) @@ -231,6 +231,24 @@ weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParen return new JSMessageDialog(xMessageDialog, nullptr, true); } +JSDialog::JSDialog(VclPtr<vcl::Window> aOwnedToplevel, ::Dialog* pDialog, + SalInstanceBuilder* pBuilder, bool bTakeOwnership) +: JSWidget<SalInstanceDialog, ::Dialog>(aOwnedToplevel, pDialog, pBuilder, bTakeOwnership) +{ +} + +void JSDialog::collapse(weld::Widget* pEdit, weld::Widget* pButton) +{ + SalInstanceDialog::collapse(pEdit, pButton); + notifyDialogState(); +} + +void JSDialog::undo_collapse() +{ + SalInstanceDialog::undo_collapse(); + notifyDialogState(); +} + JSLabel::JSLabel(VclPtr<vcl::Window> aOwnedToplevel, FixedText* pLabel, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget<SalInstanceLabel, FixedText>(aOwnedToplevel, pLabel, pBuilder, bTakeOwnership) commit 2591c2890d9fd78532716be54ee392799d13e880 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Mar 17 15:17:14 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Tue Mar 17 15:32:17 2020 +0100 jsdialog: export cursor visibility for text areas Change-Id: I404e496a6f68f5cc2e2e628b51c759be49c7fecd diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx index eaffca059a0d..8742f130877f 100644 --- a/include/vcl/vclmedit.hxx +++ b/include/vcl/vclmedit.hxx @@ -179,6 +179,8 @@ public: virtual FactoryFunction GetUITestFactory() const override; virtual bool set_property(const OString &rKey, const OUString &rValue) override; + + virtual boost::property_tree::ptree DumpAsPropertyTree() override; }; #endif // INCLUDED_VCL_VCLMEDIT_HXX diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 7ba7ee3c056f..a6b9ca5129bf 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -1562,4 +1562,13 @@ bool VclMultiLineEdit::set_property(const OString &rKey, const OUString &rValue) return true; } +boost::property_tree::ptree VclMultiLineEdit::DumpAsPropertyTree() +{ + boost::property_tree::ptree aTree = Edit::DumpAsPropertyTree(); + + aTree.put("cursor", pImpVclMEdit->GetTextWindow()->GetTextView()->IsCursorEnabled()); + + return aTree; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 953caeaf85707f281fcd87fe5a1678a589e69961 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Mar 17 14:50:39 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Tue Mar 17 15:32:11 2020 +0100 jsdialog: use for message dialogs on mobile Change-Id: Ib172dc264d7f55fef08dc474f7e6f4d1b3108085 diff --git a/include/vcl/jsdialog/jsdialogbuilder.hxx b/include/vcl/jsdialog/jsdialogbuilder.hxx index 5e79197f09e1..9cc569ed0f1b 100644 --- a/include/vcl/jsdialog/jsdialogbuilder.hxx +++ b/include/vcl/jsdialog/jsdialogbuilder.hxx @@ -45,6 +45,9 @@ public: virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id, bool bTakeOwnership = false) override; virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString &id, bool bTakeOwnership = false) override; virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString &id, bool bTakeOwnership = false) override; + + static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, + VclButtonsType eButtonType, const OUString& rPrimaryMessage); static weld::Widget* FindWeldWidgetsMap(vcl::LOKWindowId nWindowId, const OString& rWidget); }; @@ -147,4 +150,14 @@ public: virtual void set_value(int value) override; }; +class VCL_DLLPUBLIC JSMessageDialog : public SalInstanceMessageDialog, public JSDialogSender +{ +public: + JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_primary_text(const OUString& rText) override; + + virtual void set_secondary_text(const OUString& rText) override; +}; + #endif diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx index eef1403fbcd4..88ba9b1e0507 100644 --- a/include/vcl/salvtables.hxx +++ b/include/vcl/salvtables.hxx @@ -713,7 +713,7 @@ public: class SalInstanceMessageDialog : public SalInstanceDialog, public virtual weld::MessageDialog { -private: +protected: VclPtr<::MessageDialog> m_xMessageDialog; public: SalInstanceMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership); diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index f8be58bb6629..0707a4668e14 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -1381,7 +1381,8 @@ public: static weld::Builder* CreateInterimBuilder(weld::Widget* pParent, const OUString &rUIFile); //for the duration of same SfxTabPages in mixed parent types static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, - VclButtonsType eButtonType, const OUString& rPrimaryMessage); + VclButtonsType eButtonType, const OUString& rPrimaryMessage, + bool bMobile = false); static weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow); private: diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index c194da86e3e2..7ad0e836a4e3 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -47,6 +47,8 @@ #include <tokenarray.hxx> #include <scmatrix.hxx> #include <cellvalue.hxx> +#include <comphelper/lok.hxx> +#include <sfx2/lokhelper.hxx> #include <math.h> #include <memory> @@ -403,8 +405,11 @@ bool ScValidationData::DoError(weld::Window* pParent, const OUString& rInput, break; } + bool bIsMobile = comphelper::LibreOfficeKit::isActive() + && comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, eType, - eStyle, aMessage)); + eStyle, aMessage, bIsMobile)); xBox->set_title(aTitle); switch (eErrorStyle) diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index afdd7158e51b..e7f5380a5523 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -209,6 +209,28 @@ std::unique_ptr<weld::SpinButton> JSInstanceBuilder::weld_spin_button(const OStr return pWeldWidget; } +weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, + VclButtonsType eButtonType, const OUString& rPrimaryMessage) +{ + SalInstanceWidget* pParentInstance = dynamic_cast<SalInstanceWidget*>(pParent); + SystemWindow* pParentWidget = pParentInstance ? pParentInstance->getSystemWindow() : nullptr; + VclPtrInstance<::MessageDialog> xMessageDialog(pParentWidget, rPrimaryMessage, eMessageType, + eButtonType); + + const vcl::ILibreOfficeKitNotifier* pNotifier = xMessageDialog->GetLOKNotifier(); + if (pNotifier) + { + std::stringstream aStream; + boost::property_tree::ptree aTree = xMessageDialog->DumpAsPropertyTree(); + aTree.put("id", xMessageDialog->GetLOKWindowId()); + boost::property_tree::write_json(aStream, aTree); + const std::string message = aStream.str(); + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); + } + + return new JSMessageDialog(xMessageDialog, nullptr, true); +} + JSLabel::JSLabel(VclPtr<vcl::Window> aOwnedToplevel, FixedText* pLabel, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget<SalInstanceLabel, FixedText>(aOwnedToplevel, pLabel, pBuilder, bTakeOwnership) @@ -337,3 +359,21 @@ void JSSpinButton::set_value(int value) SalInstanceSpinButton::set_value(value); notifyDialogState(); } + +JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership) +: SalInstanceMessageDialog(pDialog, pBuilder, bTakeOwnership) +, JSDialogSender(m_xMessageDialog) +{ +} + +void JSMessageDialog::set_primary_text(const OUString& rText) +{ + SalInstanceMessageDialog::set_primary_text(rText); + notifyDialogState(); +} + +void JSMessageDialog::set_secondary_text(const OUString& rText) +{ + SalInstanceMessageDialog::set_secondary_text(rText); + notifyDialogState(); +} diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 95c9240c441d..666fe5a70fbc 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -170,9 +170,13 @@ weld::Builder* Application::CreateInterimBuilder(vcl::Window* pParent, const OUS } weld::MessageDialog* Application::CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, - VclButtonsType eButtonType, const OUString& rPrimaryMessage) + VclButtonsType eButtonType, const OUString& rPrimaryMessage, + bool bMobile) { - return ImplGetSVData()->mpDefInst->CreateMessageDialog(pParent, eMessageType, eButtonType, rPrimaryMessage); + if (bMobile) + return JSInstanceBuilder::CreateMessageDialog(pParent, eMessageType, eButtonType, rPrimaryMessage); + else + return ImplGetSVData()->mpDefInst->CreateMessageDialog(pParent, eMessageType, eButtonType, rPrimaryMessage); } weld::Window* Application::GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow) commit 4d83431585d72ecbdf3ae8aa4be4181ecb405feb Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Mar 17 14:25:01 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Tue Mar 17 15:32:05 2020 +0100 Move SalInstanceMessageDialog to header file Change-Id: Ie982bae356f3e13ec40012e5dd9bac45887d2925 diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx index 3a798e560a25..eef1403fbcd4 100644 --- a/include/vcl/salvtables.hxx +++ b/include/vcl/salvtables.hxx @@ -13,6 +13,7 @@ #include <vcl/lstbox.hxx> #include <vcl/tabctrl.hxx> #include <vcl/layout.hxx> +#include <messagedialog.hxx> class SalInstanceBuilder : public weld::Builder { @@ -710,4 +711,22 @@ public: virtual ~SalInstanceNotebook() override; }; +class SalInstanceMessageDialog : public SalInstanceDialog, public virtual weld::MessageDialog +{ +private: + VclPtr<::MessageDialog> m_xMessageDialog; +public: + SalInstanceMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_primary_text(const OUString& rText) override; + + virtual OUString get_primary_text() const override; + + virtual void set_secondary_text(const OUString& rText) override; + + virtual OUString get_secondary_text() const override; + + virtual weld::Container* weld_message_area() override; +}; + #endif \ No newline at end of file diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index c88426dd61b6..5f03ccf8e88b 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -30,7 +30,6 @@ #include <salobj.hxx> #include <salmenu.hxx> #include <svdata.hxx> -#include <messagedialog.hxx> #include <unotools/accessiblerelationsethelper.hxx> #include <utility> #include <vcl/builder.hxx> @@ -991,42 +990,36 @@ weld::Container* SalInstanceDialog::weld_content_area() return new SalInstanceContainer(m_xDialog->get_content_area(), m_pBuilder, false); } -class SalInstanceMessageDialog : public SalInstanceDialog, public virtual weld::MessageDialog +SalInstanceMessageDialog::SalInstanceMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : SalInstanceDialog(pDialog, pBuilder, bTakeOwnership) + , m_xMessageDialog(pDialog) { -private: - VclPtr<::MessageDialog> m_xMessageDialog; -public: - SalInstanceMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership) - : SalInstanceDialog(pDialog, pBuilder, bTakeOwnership) - , m_xMessageDialog(pDialog) - { - } +} - virtual void set_primary_text(const OUString& rText) override - { - m_xMessageDialog->set_primary_text(rText); - } +void SalInstanceMessageDialog::set_primary_text(const OUString& rText) +{ + m_xMessageDialog->set_primary_text(rText); +} - virtual OUString get_primary_text() const override - { - return m_xMessageDialog->get_primary_text(); - } +OUString SalInstanceMessageDialog::get_primary_text() const +{ + return m_xMessageDialog->get_primary_text(); +} - virtual void set_secondary_text(const OUString& rText) override - { - m_xMessageDialog->set_secondary_text(rText); - } +void SalInstanceMessageDialog::set_secondary_text(const OUString& rText) +{ + m_xMessageDialog->set_secondary_text(rText); +} - virtual OUString get_secondary_text() const override - { - return m_xMessageDialog->get_secondary_text(); - } +OUString SalInstanceMessageDialog::get_secondary_text() const +{ + return m_xMessageDialog->get_secondary_text(); +} - virtual Container* weld_message_area() override - { - return new SalInstanceContainer(m_xMessageDialog->get_message_area(), m_pBuilder, false); - } -}; +weld::Container* SalInstanceMessageDialog::weld_message_area() +{ + return new SalInstanceContainer(m_xMessageDialog->get_message_area(), m_pBuilder, false); +} class SalInstanceFrame : public SalInstanceContainer, public virtual weld::Frame { commit 4c44decc50449908b4100c68abbeaabf51043377 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Mon Mar 16 19:02:00 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Tue Mar 17 15:31:57 2020 +0100 jsdialog: optimization, use latest state, ignore previous Change-Id: Id637accc4f006ae6206b4e87a44b30d1a8340723 diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 02b020d8ea1b..e0449a3827ee 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1481,6 +1481,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) case LOK_CALLBACK_TEXT_VIEW_SELECTION: case LOK_CALLBACK_VIEW_CURSOR_VISIBLE: case LOK_CALLBACK_CALC_FUNCTION_LIST: + case LOK_CALLBACK_JSDIALOG: { const int nViewId = lcl_getViewId(payload); removeAll( _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits