[Libreoffice-commits] core.git: include/vcl sw/source vcl/source
include/vcl/pdfextoutdevdata.hxx|9 ++--- sw/source/core/text/EnhancedPDFExportHelper.cxx |3 +-- vcl/source/gdi/pdfextoutdevdata.cxx | 19 +-- 3 files changed, 12 insertions(+), 19 deletions(-) New commits: commit 1ea27b7e35faf6619112bf3f1d69e4ec41c0bf23 Author: Michael Stahl AuthorDate: Mon Oct 2 20:42:41 2023 +0200 Commit: Michael Stahl CommitDate: Wed Oct 4 11:43:40 2023 +0200 vcl: remove defensive programming from SetCurrentStructureElement() Change-Id: I47b0f29a564cdbdd1a55fe4a332fa9efd63af557 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157505 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx index 631ba74eadfa..199f30a00c59 100644 --- a/include/vcl/pdfextoutdevdata.hxx +++ b/include/vcl/pdfextoutdevdata.hxx @@ -405,14 +405,9 @@ public: @param nElement -the id of the new current structure element - -@returns -True if the current structure element could be set successfully -False if the current structure element could not be changed -(e.g. if the passed element id is invalid) +the id of the new current structure element, which must be valid */ -bool SetCurrentStructureElement( sal_Int32 nElement ); +void SetCurrentStructureElement( sal_Int32 nElement ); /** get the current structure element id @returns diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 9ebc233dc687..b71b699b8e36 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -478,8 +478,7 @@ void SwTaggedPDFHelper::CheckRestoreTag() const { if ( m_nRestoreCurrentTag != -1 ) { -const bool bSuccess = mpPDFExtOutDevData->SetCurrentStructureElement( m_nRestoreCurrentTag ); -OSL_ENSURE( bSuccess, "Failed to restore reopened tag" ); +mpPDFExtOutDevData->SetCurrentStructureElement( m_nRestoreCurrentTag ); #if OSL_DEBUG_LEVEL > 1 aStructStack.pop_back(); diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 7719d6bb97d1..1eac67561084 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -851,25 +851,24 @@ sal_Int32 PDFExtOutDevData::WrapBeginStructureElement( void PDFExtOutDevData::EndStructureElement() { +assert(mpGlobalSyncData->mCurrentStructElement != 0); // underflow? mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::EndStructureElement ); mpGlobalSyncData->mCurrentStructElement = mpGlobalSyncData->mStructParents[ mpGlobalSyncData->mCurrentStructElement ]; } -bool PDFExtOutDevData::SetCurrentStructureElement( sal_Int32 nStructId ) + +void PDFExtOutDevData::SetCurrentStructureElement(sal_Int32 const nStructId) { -bool bSuccess = false; -if( o3tl::make_unsigned(nStructId) < mpGlobalSyncData->mStructParents.size() ) -{ -mpGlobalSyncData->mCurrentStructElement = nStructId; -mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetCurrentStructureElement ); -mpPageSyncData->mParaInts.push_back( nStructId ); -bSuccess = true; -} -return bSuccess; +assert(o3tl::make_unsigned(nStructId) < mpGlobalSyncData->mStructParents.size()); +mpGlobalSyncData->mCurrentStructElement = nStructId; +mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetCurrentStructureElement ); +mpPageSyncData->mParaInts.push_back( nStructId ); } + sal_Int32 PDFExtOutDevData::GetCurrentStructureElement() const { return mpGlobalSyncData->mCurrentStructElement; } + void PDFExtOutDevData::SetStructureAttribute( PDFWriter::StructAttribute eAttr, PDFWriter::StructAttributeValue eVal ) { mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetStructureAttribute );
[Libreoffice-commits] core.git: include/vcl sw/source vcl/source
include/vcl/gdimtf.hxx |1 sw/source/core/view/vprint.cxx | 65 +++-- vcl/source/gdi/gdimtf.cxx |7 +++- 3 files changed, 25 insertions(+), 48 deletions(-) New commits: commit a225b4dbd46897903b217969da5f97f2660022c9 Author: Michael Stahl AuthorDate: Fri Jun 30 14:44:21 2023 +0200 Commit: Michael Stahl CommitDate: Mon Jul 3 11:32:14 2023 +0200 tdf#152231 vcl,sw: PDF/UA export: fix comments in the margin If enabled, the comments mess up the structure elements, because the PageSyncData::mActions stores indexes into the GDIMetaFile::m_aList vector, and in PageSyncData::PlaySyncPageAct() the indexes don't match. This is because SwViewShell::PrintOrPDFExport() replaces the GDIMetaFile with a temporary one, then records the page content, then applies scaling to the temporary one and replays it, recording with the original one; somehow replaying a temporary GDIMetaFile with 270 actions to one that already has 4 actions results in 392 actions. It's not obvious how this can work with the temporary GDIMetaFile, so try to get rid of it; not sure if there any drawbacks to this but the GDIMetaFile is freshly created by the caller in any case. Change-Id: Ic297367ea307aa8eee8d609751d06abf417e9629 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153808 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx index d62cd899623b..63bde564dcfd 100644 --- a/include/vcl/gdimtf.hxx +++ b/include/vcl/gdimtf.hxx @@ -115,6 +115,7 @@ public: voidMove( tools::Long nX, tools::Long nY ); // additional Move method getting specifics how to handle MapMode( MapUnit::MapPixel ) voidMove( tools::Long nX, tools::Long nY, tools::Long nDPIX, tools::Long nDPIY ); +voidScaleActions(double fScaleX, double fScaleY); voidScale( double fScaleX, double fScaleY ); voidScale( const Fraction& rScaleX, const Fraction& rScaleY ); voidRotate( Degree10 nAngle10 ); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 0ad22ccf5357..3cd0c524007e 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -446,32 +446,12 @@ bool SwViewShell::PrintOrPDFExport( // output device is now provided by a call from outside the Writer) pOutDev->Push(); -// fdo#36815 for comments in margins print to a metafile -// and then scale that metafile down so that the comments -// will fit on the real page, and replay that scaled -// output to the real outputdevice -GDIMetaFile *pOrigRecorder(nullptr); -std::unique_ptr pMetaFile; SwPostItMode nPostItMode = rPrintData.GetPrintPostIts(); // tdf#91680 Reserve space in margin for comments only if there are comments const bool bHasPostItsToPrintInMargins = ( nPostItMode == SwPostItMode::InMargins ) && sw_GetPostIts( GetDoc()->getIDocumentFieldsAccess(), nullptr ); - -if ( bHasPostItsToPrintInMargins ) -{ -//get and disable the existing recorder -pOrigRecorder = pOutDev->GetConnectMetaFile(); -pOutDev->SetConnectMetaFile(nullptr); -// turn off output to the device -pOutDev->EnableOutput(false); -// just record the rendering commands to the metafile -// instead -pMetaFile.reset(new GDIMetaFile); -pMetaFile->SetPrefSize(pOutDev->GetOutputSize()); -pMetaFile->SetPrefMapMode(pOutDev->GetMapMode()); -pMetaFile->Record(pOutDev); -} +::std::optional oOrigHeight; // Print/PDF export for (multi-)selection has already generated a // temporary document with the selected text. @@ -535,32 +515,7 @@ bool SwViewShell::PrintOrPDFExport( pPostItManager->CalcRects(); pPostItManager->LayoutPostIts(); pPostItManager->DrawNotesForPage(pOutDev, nPage-1); - -//Stop recording now -pMetaFile->Stop(); -pMetaFile->WindStart(); -//Enable output to the device again -pOutDev->EnableOutput(); -//Restore the original recorder -pOutDev->SetConnectMetaFile(pOrigRecorder); - -//Now scale the recorded page down so the notes -//will fit in the final page -double fScale = 0.75; -tools::Long nOrigHeight = pStPage->getFrameArea().Height(); -tools::Long nNewHeight = nOrigHeight*fScale; -tools::Long nShiftY = (nOrigHeight-nNewHeight)/2; -pMetaFile->Scale( fScale, fScale ); -pMetaFile->WindStart(); -//Move the scaled page down to center it -//the other variant of Move does not map pixels -//back to the logical units correctly -pMetaFile->Move(0, co
[Libreoffice-commits] core.git: include/vcl sw/source vcl/source
include/vcl/InterimItemWindow.hxx |7 +++ sw/source/uibase/docvw/AnnotationWin2.cxx |5 + vcl/source/control/InterimItemWindow.cxx | 20 3 files changed, 32 insertions(+) New commits: commit 0659c488efb00e2a87fa98edf498288470688a9a Author: Caolán McNamara AuthorDate: Mon Nov 15 17:27:58 2021 + Commit: Caolán McNamara CommitDate: Tue Nov 16 11:26:33 2021 +0100 Resolves: tdf#143511 SysObj is clipped out if the widget is out of view so the sizes and relative positions are invalid under gtk, unclip the SysObj when using get_extents_relative_to Change-Id: Ibdaff20531a2a40b3b9b7dc9ac880d014db07d5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125272 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/include/vcl/InterimItemWindow.hxx b/include/vcl/InterimItemWindow.hxx index 3fc0903b110f..4cf4dd4ebeca 100644 --- a/include/vcl/InterimItemWindow.hxx +++ b/include/vcl/InterimItemWindow.hxx @@ -51,6 +51,13 @@ protected: virtual void Layout(); +// unclip a "SysObj" which is a native window element hosted in a vcl::Window +// if the SysObj is logically "visible" in the vcl::Window::IsVisible sense but +// is partially or wholly clipped out due to being overlapped or scrolled out +// of view. The clip state is flagged as dirty after this and vcl will restore +// the clip state the next time it evaluates the clip status +void UnclipVisibleSysObj(); + std::unique_ptr m_xBuilder; VclPtr m_xVclContentArea; std::unique_ptr m_xContainer; diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 47d0cdd7bb6f..33dc2cb54b5b 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -152,6 +152,10 @@ void SwAnnotationWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint void SwAnnotationWin::DrawForPage(OutputDevice* pDev, const Point& rPt) { +// tdf#143511 unclip SysObj so get_extents_relative_to of children +// of the SysObj can provide meaningful results +UnclipVisibleSysObj(); + pDev->Push(); pDev->SetFillColor(mColorDark); @@ -163,6 +167,7 @@ void SwAnnotationWin::DrawForPage(OutputDevice* pDev, const Point& rPt) pDev->SetFont(aFont); Size aSz = PixelToLogic(GetSizePixel()); + pDev->DrawRect(tools::Rectangle(rPt, aSz)); if (mxMetadataAuthor->get_visible()) diff --git a/vcl/source/control/InterimItemWindow.cxx b/vcl/source/control/InterimItemWindow.cxx index d47da4a02d19..0017065d7ddb 100644 --- a/vcl/source/control/InterimItemWindow.cxx +++ b/vcl/source/control/InterimItemWindow.cxx @@ -9,6 +9,8 @@ #include #include +#include +#include InterimItemWindow::InterimItemWindow(vcl::Window* pParent, const OUString& rUIXMLDescription, const OString& rID, bool bAllowCycleFocusOut, @@ -69,6 +71,24 @@ void InterimItemWindow::queue_resize(StateChangedType eReason) void InterimItemWindow::Resize() { Layout(); } +void InterimItemWindow::UnclipVisibleSysObj() +{ +if (!IsVisible()) +return; +vcl::Window* pChild = m_xVclContentArea->GetWindow(GetWindowType::FirstChild); +if (!pChild) +return; +WindowImpl* pWindowImpl = pChild->ImplGetWindowImpl(); +if (!pWindowImpl) +return; +if (!pWindowImpl->mpSysObj) +return; +pWindowImpl->mpSysObj->Show(true); +pWindowImpl->mpSysObj->ResetClipRegion(); +// flag that sysobj clip is dirty and needs to be recalculated on next use +pWindowImpl->mbInitWinClipRegion = true; +} + IMPL_LINK_NOARG(InterimItemWindow, DoLayout, Timer*, void) { Layout(); } void InterimItemWindow::Layout()
[Libreoffice-commits] core.git: include/vcl sw/source vcl/source
include/vcl/outdev.hxx |2 +- sw/source/core/txtnode/fntcache.cxx |6 -- vcl/source/outdev/textline.cxx |4 +--- 3 files changed, 6 insertions(+), 6 deletions(-) New commits: commit 4141c13da8245b5ed46be3b7034d014d75f433f9 Author: Heiko Tietze AuthorDate: Thu Nov 11 11:34:08 2021 +0100 Commit: Heiko Tietze CommitDate: Fri Nov 12 14:47:06 2021 +0100 Resolves tdf#70519 - Make wavy lines depend on zoom factor Solves accessibility issue of too faint spellchecking indicators Change-Id: Ic5bc9e205981e90c8f4ee12aa52dde723da1e7aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125038 Tested-by: Jenkins Reviewed-by: Heiko Tietze diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 8c0746215a50..a1c26747c882 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -910,7 +910,7 @@ public: voidImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontLineStyle eUnderline, FontLineStyle eOverline, bool bWordLine, bool bUnderlineAbove ); -voidDrawWaveLine( const Point& rStartPos, const Point& rEndPos, tools::Long nLineWidth = 1 ); +voidDrawWaveLine( const Point& rStartPos, const Point& rEndPos, tools::Long nLineWidth = 1, tools::Long nWaveHeight = 3); boolImplDrawRotateText( SalLayout& ); diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index b23ba26a5d34..ccc25f50df9c 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -801,17 +801,19 @@ static void lcl_DrawLineForWrongListData( SwWrongArea const*const wrongArea = pWList->GetWrongElement(nNextStart + rInf.GetIdx()); if (wrongArea != nullptr) { +const SwViewShell* pShell = rInf.GetShell(); +sal_uInt16 nZoom = pShell ? round(pShell->GetViewOptions()->GetZoom()/100) : 1; if (WRONGAREA_WAVE == wrongArea->mLineType) { vcl::ScopedAntialiasing a(rInf.GetOut(), true); rInf.GetOut().SetLineColor( wrongArea->mColor ); -rInf.GetOut().DrawWaveLine( aStart, aEnd, 1 ); +rInf.GetOut().DrawWaveLine( aStart, aEnd, 1 + nZoom, 3 + nZoom ); } else if (WRONGAREA_BOLDWAVE == wrongArea->mLineType) { vcl::ScopedAntialiasing a(rInf.GetOut(), true); rInf.GetOut().SetLineColor( wrongArea->mColor ); -rInf.GetOut().DrawWaveLine( aStart, aEnd, 2 ); +rInf.GetOut().DrawWaveLine( aStart, aEnd, 2 + nZoom, 4 + nZoom ); } else if (WRONGAREA_BOLD == wrongArea->mLineType) { diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index 0b3ca866b37a..7015d768986c 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -969,7 +969,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, tools::Long nWidth, mpAlphaVDev->DrawTextLine( rPos, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove ); } -void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, tools::Long nLineWidth) +void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, tools::Long nLineWidth, tools::Long nWaveHeight) { assert(!is_double_buffered_window()); @@ -1008,8 +1008,6 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, to aStartPt.RotateAround(nEndX, nEndY, Degree10(static_cast(-fOrientation * 10.0))); } -tools::Long nWaveHeight = 3; - // Handle HiDPI float fScaleFactor = GetDPIScaleFactor(); if (fScaleFactor > 1.0f)
[Libreoffice-commits] core.git: include/vcl sw/source vcl/source vcl/unx
include/vcl/weld.hxx |2 -- sw/source/ui/misc/outline.cxx |6 -- vcl/source/app/salvtables.cxx | 12 vcl/unx/gtk3/gtkinst.cxx | 41 - 4 files changed, 61 deletions(-) New commits: commit 716c20460372e3f3543f4dc81a49368a5291cd34 Author: Caolán McNamara AuthorDate: Wed Jul 7 11:30:12 2021 +0100 Commit: Caolán McNamara CommitDate: Wed Jul 7 14:44:23 2021 +0200 remove [g|s]et_item_help_id for menubutton menu items a fairly obscure functionality that was used in just one menu that can be dropped now that the help is changed to contain references to the help ids the menu items already have Change-Id: I4efa2f11e7d48b398152d7308341bd3e4308c377 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118561 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 4546da76b18e..3e085e0af6aa 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1536,9 +1536,7 @@ public: virtual void set_item_active(const OString& rIdent, bool bActive) = 0; virtual void set_item_label(const OString& rIdent, const OUString& rLabel) = 0; virtual OUString get_item_label(const OString& rIdent) const = 0; -virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) = 0; virtual void set_item_visible(const OString& rIdent, bool bVisible) = 0; -virtual OString get_item_help_id(const OString& rIdent) const = 0; virtual void set_popover(weld::Widget* pPopover) = 0; }; diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index ebac78812a6c..506388528608 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -219,12 +219,6 @@ IMPL_LINK_NOARG(SwOutlineTabDialog, FormHdl, weld::Toggleable&, void) continue; m_xMenuButton->set_item_label("form" + OString::number(i + 1), pRules->GetName()); } - -OString sHelpId(m_xMenuButton->get_item_help_id("form1")); -for (sal_Int32 i = 2; i <= 9; ++i) -{ -m_xMenuButton->set_item_help_id("form" + OString::number(i), sHelpId); -} } IMPL_LINK(SwOutlineTabDialog, MenuSelectHdl, const OString&, rIdent, void) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 608baded3b4f..2a93a80711de 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -2765,18 +2765,6 @@ public: pMenu->ShowItem(pMenu->GetItemId(rIdent), bShow); } -virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override -{ -PopupMenu* pMenu = m_xMenuButton->GetPopupMenu(); -pMenu->SetHelpId(pMenu->GetItemId(rIdent), rHelpId); -} - -virtual OString get_item_help_id(const OString& rIdent) const override -{ -PopupMenu* pMenu = m_xMenuButton->GetPopupMenu(); -return pMenu->GetHelpId(pMenu->GetItemId(rIdent)); -} - virtual void set_popover(weld::Widget* pPopover) override { SalInstanceWidget* pPopoverWidget = dynamic_cast(pPopover); diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index d80e1a78fbd0..3a48fa2e3c02 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -4916,16 +4916,6 @@ public: return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); } -void set_item_help_id(const OString& rIdent, const OString& rHelpId) -{ -set_help_id(GTK_WIDGET(m_aMap[rIdent]), rHelpId); -} - -OString get_item_help_id(const OString& rIdent) const -{ -return get_help_id(GTK_WIDGET(m_aMap.find(rIdent)->second)); -} - void set_item_visible(const OString& rIdent, bool bShow) { GtkWidget* pWidget = GTK_WIDGET(m_aMap[rIdent]); @@ -9809,27 +9799,6 @@ public: #endif } -virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override -{ -#if !GTK_CHECK_VERSION(4, 0, 0) -MenuHelper::set_item_help_id(rIdent, rHelpId); -#else -(void)rIdent; (void)rHelpId; -std::abort(); -#endif -} - -virtual OString get_item_help_id(const OString& rIdent) const override -{ -#if !GTK_CHECK_VERSION(4, 0, 0) -return MenuHelper::get_item_help_id(rIdent); -#else -(void)rIdent; -std::abort(); -return OString(); -#endif -} - #if GTK_CHECK_VERSION(4, 0, 0) static void action_activated(GSimpleAction*, GVariant* pParameter, gpointer widget) { @@ -10208,16 +10177,6 @@ public: MenuHelper::set_item_visible(rIdent, bVisible); } -virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override -{ -MenuHelper::set_item_help_id(rIdent, rHelpId); -} - -virtual OString get_item_help_id(const OString& rIdent) const override -{ -return MenuHelper::get_item_help_id(rIdent); -} -
[Libreoffice-commits] core.git: include/vcl sw/source vcl/source
include/vcl/weldutils.hxx |2 ++ sw/source/uibase/utlui/content.cxx | 16 ++-- vcl/source/window/builder.cxx | 19 +++ 3 files changed, 23 insertions(+), 14 deletions(-) New commits: commit dbaac810a59a391e6ba5c52c6b6b38088cc1ace7 Author: Caolán McNamara AuthorDate: Wed Mar 25 16:44:46 2020 + Commit: Caolán McNamara CommitDate: Thu Mar 26 09:45:03 2020 +0100 extract GetAbsPos for reuse Change-Id: Ida6b70f4166f8b1e19990300a5856ee54556a9f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91065 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/include/vcl/weldutils.hxx b/include/vcl/weldutils.hxx index fdc9e8cf30d6..077dab0fa414 100644 --- a/include/vcl/weldutils.hxx +++ b/include/vcl/weldutils.hxx @@ -152,6 +152,8 @@ public: m_aPaintListeners.removeInterface(rListener); } }; + +VCL_DLLPUBLIC size_t GetAbsPos(const weld::TreeView& rTreeView, const weld::TreeIter& rIter); } #endif diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index cfa216925470..49f936959429 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -1755,20 +1756,7 @@ namespace size_t SwContentTree::GetAbsPos(const weld::TreeIter& rIter) { -size_t nAbsPos = 0; - -std::unique_ptr xEntry(m_xTreeView->make_iterator(&rIter)); -if (!m_xTreeView->get_iter_first(*xEntry)) -xEntry.reset(); - -while (xEntry && m_xTreeView->iter_compare(*xEntry, rIter) != 0) -{ -if (!m_xTreeView->iter_next(*xEntry)) -xEntry.reset(); -nAbsPos++; -} - -return nAbsPos; +return weld::GetAbsPos(*m_xTreeView, rIter); } size_t SwContentTree::GetEntryCount() const diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index f9329cbecc52..f3ed31051d94 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -422,6 +423,24 @@ namespace weld int nHeight = nRows == -1 ? -1 : m_xTreeView->get_height_rows(nRows); m_xTreeView->set_size_request(m_xTreeView->get_size_request().Width(), nHeight); } + +size_t GetAbsPos(const weld::TreeView& rTreeView, const weld::TreeIter& rIter) +{ +size_t nAbsPos = 0; + +std::unique_ptr xEntry(rTreeView.make_iterator(&rIter)); +if (!rTreeView.get_iter_first(*xEntry)) +xEntry.reset(); + +while (xEntry && rTreeView.iter_compare(*xEntry, rIter) != 0) +{ +if (!rTreeView.iter_next(*xEntry)) +xEntry.reset(); +nAbsPos++; +} + +return nAbsPos; +} } VclBuilder::VclBuilder(vcl::Window* pParent, const OUString& sUIDir, const OUString& sUIFile, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl sw/source vcl/source vcl/unx
include/vcl/weld.hxx |2 - sw/source/ui/dialog/uiregionsw.cxx |2 - vcl/source/app/salvtables.cxx |8 ++-- vcl/unx/gtk3/gtk3gtkinst.cxx | 70 ++--- 4 files changed, 63 insertions(+), 19 deletions(-) New commits: commit bbf9b65f91e8136fa1a2e17960944b8720f5d58e Author: Caolán McNamara AuthorDate: Thu Mar 14 21:27:40 2019 + Commit: Caolán McNamara CommitDate: Fri Mar 15 10:00:02 2019 +0100 support case sensitive entry completion Change-Id: Ibaf0962e3d150c67f951e1b20c0e72aacfc7ea78 Reviewed-on: https://gerrit.libreoffice.org/69284 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 75b33607d1dd..0856e4748929 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -478,7 +478,7 @@ public: virtual void set_entry_max_length(int nChars) = 0; virtual void select_entry_region(int nStartPos, int nEndPos) = 0; virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) = 0; -virtual void set_entry_completion(bool bEnable) = 0; +virtual void set_entry_completion(bool bEnable, bool bCaseSensitive = false) = 0; virtual bool get_popup_shown() const = 0; diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 1d3eca06ec2d..b0e896c4a022 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -1618,7 +1618,7 @@ SwInsertSectionTabPage::SwInsertSectionTabPage(TabPageParent pParent, const SfxI m_xCurName->connect_changed( LINK( this, SwInsertSectionTabPage, NameEditHdl)); m_xDDECB->connect_toggled( LINK( this, SwInsertSectionTabPage, DDEHdl )); ChangeProtectHdl(*m_xProtectCB); -//TODOm_xSubRegionED->EnableAutocomplete( true, true ); +m_xSubRegionED->set_entry_completion(true, true); } SwInsertSectionTabPage::~SwInsertSectionTabPage() diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index de75da50d37b..c2c5ea026936 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -4016,7 +4016,7 @@ public: assert(false); } -virtual void set_entry_completion(bool) override +virtual void set_entry_completion(bool, bool) override { assert(false); } @@ -4109,9 +4109,9 @@ public: m_xComboBox->SetMaxTextLen(nChars); } -virtual void set_entry_completion(bool bEnable) override +virtual void set_entry_completion(bool bEnable, bool bCaseSensitive) override { -m_xComboBox->EnableAutocomplete(bEnable); +m_xComboBox->EnableAutocomplete(bEnable, bCaseSensitive); } virtual void select_entry_region(int nStartPos, int nEndPos) override @@ -4178,7 +4178,7 @@ public: pTreeView->SetStyle(pTreeView->GetStyle() | WB_SORT); } -virtual void set_entry_completion(bool bEnable) override +virtual void set_entry_completion(bool bEnable, bool /*bCaseSensitive*/) override { assert(!bEnable && "not implemented yet"); (void) bEnable; Edit& rEntry = m_pEntry->getEntry(); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index d15928180331..488db5a24fb6 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -5428,7 +5428,7 @@ namespace return ret; } -int starts_with(GtkTreeModel* pTreeModel, const OUString& rStr, int col, int nStartRow) +int starts_with(GtkTreeModel* pTreeModel, const OUString& rStr, int col, int nStartRow, bool bCaseSensitive) { GtkTreeIter iter; if (!gtk_tree_model_iter_nth_child(pTreeModel, &iter, nullptr, nStartRow)) @@ -5442,7 +5442,7 @@ namespace gtk_tree_model_get(pTreeModel, &iter, col, &pStr, -1); OUString aStr(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); g_free(pStr); -const bool bMatch = rI18nHelper.MatchString(rStr, aStr); +const bool bMatch = !bCaseSensitive ? rI18nHelper.MatchString(rStr, aStr) : aStr.startsWith(rStr); if (bMatch) return nRet; ++nRet; @@ -6644,9 +6644,9 @@ public: return gtk_tree_selection_count_selected_rows(gtk_tree_view_get_selection(m_pTreeView)); } -int starts_with(const OUString& rStr, int col, int nStartRow) +int starts_with(const OUString& rStr, int col, int nStartRow, bool bCaseSensitive) { -return ::starts_with(GTK_TREE_MODEL(m_pTreeStore), rStr, get_model_col(col), nStartRow); +return ::starts_with(GTK_TREE_MODEL(m_pTreeStore), rStr, get_model_col(col), nStartRow, bCaseSensitive); } virtual void disable_notify_events() override @@ -7444,6 +7444,7 @@ private: std::vector m_aSeparatorRows; gboolean m_bPopupActive; bool m_bAutoComplete; +bool m_bAutoCompleteCaseSensitive; gu
[Libreoffice-commits] core.git: include/vcl sw/source vcl/source
include/vcl/outdev.hxx |3 ++- sw/source/core/inc/fntcache.hxx |1 + sw/source/core/txtnode/fntcache.cxx |9 - vcl/source/outdev/text.cxx |5 +++-- 4 files changed, 14 insertions(+), 4 deletions(-) New commits: commit 2a73c9e04ba9379c0561a7e8d531b5633c46ec52 Author: Miklos Vajna AuthorDate: Fri Sep 7 10:43:10 2018 +0200 Commit: Miklos Vajna CommitDate: Fri Sep 7 16:02:49 2018 +0200 sw: less vcl text layout calls in SwFont::GetTextBreak() Number of GenericSalLayout::LayoutText() calls during "dt" in Writer: 105 -> 89. Change-Id: I0f2bb241536209cfccc1d78bed6f54bf5c31e627 Reviewed-on: https://gerrit.libreoffice.org/60133 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 1aa842b46cd5..f015f52488d8 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1174,7 +1174,8 @@ public: sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth, sal_Int32 nIndex, sal_Int32 nLen = -1, long nCharExtra = 0, - vcl::TextLayoutCache const* = nullptr) const; + vcl::TextLayoutCache const* = nullptr, + const SalLayoutGlyphs* pGlyphs = nullptr) const; sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth, sal_Unicode nExtraChar, sal_Int32& rExtraCharPos, sal_Int32 nIndex, sal_Int32 nLen, diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx index ee8a1d2971f7..a7400f03d0d1 100644 --- a/sw/source/core/inc/fntcache.hxx +++ b/sw/source/core/inc/fntcache.hxx @@ -122,6 +122,7 @@ public: sal_uInt16 GetZoom() const { return m_nZoom; } sal_uInt16 GetPropWidth() const { return m_nPropWidth; } bool IsSymbol() const { return m_bSymbol; } +std::map& GetTextGlyphs() { return m_aTextGlyphs; } void DrawText( SwDrawTextInfo &rInf ); /// determine the TextSize (of the printer) diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index e893e43d1f8e..5f294fe6c7ca 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -2483,10 +2483,17 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth *rInf.GetHyphPos() = TextFrameIndex((nHyphPos == -1) ? COMPLETE_STRING : nHyphPos); } else +{ +SwFntAccess aFntAccess(m_aSub[m_nActual].m_nFontCacheId, m_aSub[m_nActual].m_nFontIndex, + &m_aSub[m_nActual], rInf.GetShell()); +SwTextGlyphsKey aGlyphsKey{ &rInf.GetOut(), *pTmpText, nTmpIdx, nTmpLen }; +SalLayoutGlyphs* pGlyphs += lcl_CreateLayout(aGlyphsKey, aFntAccess.Get()->GetTextGlyphs()[aGlyphsKey]); nTextBreak = TextFrameIndex(rInf.GetOut().GetTextBreak( *pTmpText, nTextWidth, sal_Int32(nTmpIdx), sal_Int32(nTmpLen), - nKern, rInf.GetVclCache())); + nKern, rInf.GetVclCache(), pGlyphs)); +} if (bTextReplaced && sal_Int32(nTextBreak) != -1) { diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 820df543bc5d..b0243b3395a6 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1394,10 +1394,11 @@ bool OutputDevice::GetTextIsRTL( const OUString& rString, sal_Int32 nIndex, sal_ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth, sal_Int32 nIndex, sal_Int32 nLen, long nCharExtra, - vcl::TextLayoutCache const*const pLayoutCache) const + vcl::TextLayoutCache const*const pLayoutCache, + const SalLayoutGlyphs* pGlyphs) const { std::unique_ptr pSalLayout = ImplLayout( rStr, nIndex, nLen, -Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache); +Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache, pGlyphs); sal_Int32 nRetVal = -1; if( pSalLayout ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl sw/source vcl/source
include/vcl/scheduler.hxx | 12 sw/source/core/doc/DocumentTimerManager.cxx | 25 + vcl/source/app/scheduler.cxx|5 + 3 files changed, 30 insertions(+), 12 deletions(-) New commits: commit 3bd8316718fdfed454c01a9c4ae6af6beb34437d Author: Jan-Marek Glogowski AuthorDate: Tue Aug 28 15:24:26 2018 + Commit: Jan-Marek Glogowski CommitDate: Wed Aug 29 10:10:14 2018 +0200 tdf#119458 just wakeup Scheduler on active Idle So this almost returns the code to the original state, before I started fixing tdf#116370... a long way. This introduces the new Scheduler::Wakeup() function, which will just queue a Scheduler event in the System event queue unconditionally. This should prevent fdo#73165, which I couldn't reproduce, but just to be sure. More importantly this patch resets the m_bStartOnUnblock when the Idle job actually runs. This run should already determinates if more Idle work needs to be done, and others can still call BeginIdling() to ensure further processing. This also drops the IsBusyDoc() test from UnblockIdling(). We can't really know, if the document is still busy when the Scheduler is finally running, be it by the system timer or Application::Reschedule(). Change-Id: I6cc4a3c48dcaf62b6985c7bc1c95c96697443f3b Reviewed-on: https://gerrit.libreoffice.org/59730 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx index ac429ed33b09..6233d134a8ed 100644 --- a/include/vcl/scheduler.hxx +++ b/include/vcl/scheduler.hxx @@ -65,6 +65,18 @@ public: */ static void ProcessEventsToIdle(); +/** + * Wakes up the scheduler + * + * This doesn't handle any events! It just ensures the Scheduler is run as + * soon as possible by forcing the Scheduler timer to fire. + * + * Can be used for complex UpdateMinPeriod function, where the task is + * actually active but not ready and we want to skip the Task::Start() + * queue append for faster reaction. + */ +static void Wakeup(); + /// Control the deterministic mode. In this mode, two subsequent runs of /// LibreOffice fire about the same amount idles. static void SetDeterministicMode(bool bDeterministic); diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index 81c46b125840..7bd2e505a3a4 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -33,6 +33,7 @@ #include #include #include +#include namespace sw { @@ -49,10 +50,14 @@ DocumentTimerManager::DocumentTimerManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc void DocumentTimerManager::StartIdling() { -if (m_nIdleBlockCount > 0) -m_bStartOnUnblock = true; -else if (!m_aDocIdle.IsActive()) -m_aDocIdle.Start(); +m_bStartOnUnblock = true; +if (0 == m_nIdleBlockCount) +{ +if (!m_aDocIdle.IsActive()) +m_aDocIdle.Start(); +else +Scheduler::Wakeup(); +} } void DocumentTimerManager::StopIdling() @@ -64,11 +69,6 @@ void DocumentTimerManager::StopIdling() void DocumentTimerManager::BlockIdling() { assert(SAL_MAX_UINT32 != m_nIdleBlockCount); -if (0 == m_nIdleBlockCount) -{ -assert(!m_bStartOnUnblock); -m_bStartOnUnblock = false; -} ++m_nIdleBlockCount; } @@ -79,10 +79,10 @@ void DocumentTimerManager::UnblockIdling() if ((0 == m_nIdleBlockCount) && m_bStartOnUnblock) { -m_bStartOnUnblock = false; -// kick the active idle, if it's not anymore blocked by IsDocIdle() -if (IsDocIdle()) +if (!m_aDocIdle.IsActive()) m_aDocIdle.Start(); +else +Scheduler::Wakeup(); } } @@ -137,6 +137,7 @@ IMPL_LINK_NOARG( DocumentTimerManager, DoIdleJobs, Timer*, void ) pModLogFile = new ::rtl::Logfile( "First DoIdleJobs" ); #endif BlockIdling(); +StopIdling(); IdleJob eJob = GetNextIdleJob(); diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index 4a35115f2db3..93fcfeca7df9 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -506,6 +506,11 @@ next_entry: return !!pMostUrgent; } +void Scheduler::Wakeup() +{ +Scheduler::ImplStartTimer( 0, false, tools::Time::GetSystemTicks() ); +} + void Task::StartTimer( sal_uInt64 nMS ) { Scheduler::ImplStartTimer( nMS, false, tools::Time::GetSystemTicks() ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: include/vcl sw/source vcl/source
include/vcl/EnumContext.hxx|2 +- include/vcl/notebookbar.hxx|3 +++ sw/source/uibase/uiview/pview.cxx | 11 ++- vcl/source/control/notebookbar.cxx | 21 +++-- vcl/source/window/EnumContext.cxx |1 + 5 files changed, 34 insertions(+), 4 deletions(-) New commits: commit d05b7b32d9ecb6fcb4a268eb68cdcee09bafa6dd Author: Kshitij Pathania Date: Mon Jul 2 18:48:19 2018 +0530 Notebookbar:Context for printpreview is now working Also the context stuff is now working well even after print preview is set Change-Id: Ia43f512394cf4d162b4019257c039aecb664df22 Reviewed-on: https://gerrit.libreoffice.org/56740 Tested-by: Jenkins Reviewed-by: Szymon Kłos diff --git a/include/vcl/EnumContext.hxx b/include/vcl/EnumContext.hxx index fb64302ccf4d..d5f1e91aa1f4 100644 --- a/include/vcl/EnumContext.hxx +++ b/include/vcl/EnumContext.hxx @@ -96,7 +96,7 @@ public: Text, TextObject, Trendline, - +Printpreview, // Default context of an application. Do we need this? Default, diff --git a/include/vcl/notebookbar.hxx b/include/vcl/notebookbar.hxx index f3490bfeea89..535f157e7810 100644 --- a/include/vcl/notebookbar.hxx +++ b/include/vcl/notebookbar.hxx @@ -41,10 +41,13 @@ public: void DataChanged(const DataChangedEvent& rDCEvt) override; +void ControlListener(bool bListen); + private: VclPtr m_pSystemWindow; css::uno::Reference m_pEventListener; std::vector m_pContextContainers; +css::uno::Reference mxFrame; AllSettings DefaultSettings; AllSettings PersonaSettings; diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 1138834932a1..2a83ada829e0 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -78,6 +78,8 @@ #include #include +#include +#include using namespace ::com::sun::star; SFX_IMPL_NAMED_VIEWFACTORY(SwPagePreview, "PrintPreview") @@ -1157,6 +1159,13 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): CreateScrollbar( true ); CreateScrollbar( false ); +//notify notebookbar change in context +SfxShell::SetContextBroadcasterEnabled(true); + SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview)); +SfxShell::BroadcastContextForActivation(true); +//removelisteners for notebookbar + SfxViewFrame::Current()->GetWindow().GetSystemWindow()->GetNotebookBar()->ControlListener(true); + SfxObjectShell* pObjShell = pViewFrame->GetObjectShell(); if ( !pOldSh ) { @@ -1221,7 +1230,7 @@ SwPagePreview::~SwPagePreview() delete pVShell; m_pViewWin.disposeAndClear(); - + SfxViewFrame::Current()->GetWindow().GetSystemWindow()->GetNotebookBar()->ControlListener(false); m_pScrollFill.disposeAndClear(); m_pHScrollbar.disposeAndClear(); m_pVScrollbar.disposeAndClear(); diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx index 6c04bcaf7423..9b2381e2cc95 100644 --- a/vcl/source/control/notebookbar.cxx +++ b/vcl/source/control/notebookbar.cxx @@ -14,7 +14,7 @@ #include #include #include - +#include /** * split from the main class since it needs different ref-counting mana */ @@ -37,7 +37,7 @@ NotebookBar::NotebookBar(Window* pParent, const OString& rID, const OUString& rU { SetStyle(GetStyle() | WB_DIALOGCONTROL); m_pUIBuilder.reset( new VclBuilder(this, getUIRootDir(), rUIXMLDescription, rID, rFrame) ); - +mxFrame = rFrame; // In the Notebookbar's .ui file must exist control handling context // - implementing NotebookbarContextControl interface with id "ContextContainer" // or "ContextContainerX" where X is a number >= 1 @@ -154,6 +154,23 @@ void SAL_CALL NotebookBarContextChangeEventListener::notifyContextChangeEvent(co } } +void NotebookBar::ControlListener(bool bListen) +{ +if(bListen) +{ +// remove listeners +css::uno::Reference xMultiplexer (css::ui::ContextChangeEventMultiplexer::get( +::comphelper::getProcessComponentContext())); + xMultiplexer->removeContextChangeEventListener(getContextChangeEventListener(),mxFrame->getController()); +} +else +{ +// add listeners +css::uno::Reference xMultiplexer (css::ui::ContextChangeEventMultiplexer::get( +::comphelper::getProcessComponentContext())); + xMultiplexer->addContextChangeEventListener(getContextChangeEventListener(),mxFrame->getController()); +} +} void SAL_CALL NotebookBarContextChangeEventListener::disposing(const ::css::lang::EventObject&) { diff --git a/vcl/source/window/EnumContext.cxx b/vcl/source/window/EnumContext.cxx index e6a1543ad6d9..895333e16e43 100644 --- a/vcl/source/window/EnumContext.cxx +++ b/vcl/source/window/EnumContext.cxx @@ -194,6 +194,7 @@ vo
[Libreoffice-commits] core.git: include/vcl sw/source vcl/source vcl/unx
include/vcl/abstdlg.hxx |3 + include/vcl/dialog.hxx|2 - include/vcl/weld.hxx | 34 + sw/source/uibase/docvw/edtwin.cxx |5 +- vcl/source/app/salvtables.cxx | 23 vcl/source/window/dialog.cxx |3 + vcl/unx/gtk3/gtk3gtkinst.cxx | 72 +++--- 7 files changed, 125 insertions(+), 17 deletions(-) New commits: commit 0b573eac85b3100eb8d40dcaf25c510f50cfd62f Author: Pranav Kant Date: Thu Mar 1 20:15:58 2018 +0530 lokdialog: run async for weld dialogs Change-Id: Ieb06beada435bc47a39295acb5ea2dcef10ca454 Reviewed-on: https://gerrit.libreoffice.org/50874 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara Reviewed-by: pranavk Tested-by: pranavk diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx index 542930084e37..af676785b295 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -26,10 +26,12 @@ #include #include #include +#include namespace vcl { class Window; } class Dialog; class Bitmap; +namespace weld { class DialogController; } /** * Some things multiple-inherit from VclAbstractDialog and OutputDevice, @@ -45,6 +47,7 @@ public: struct AsyncContext { VclPtr mxOwner; +std::shared_ptr mxOwnerDialog; std::function maEndDialogFn; bool isSet() { return !!maEndDialogFn; } }; diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index 243d071b101f..0b98901e32bb 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -149,7 +149,7 @@ private: public: // FIXME: Need to remove old StartExecuteModal in favour of this one. -/// Returns true of the dialog successfully starts +/// Returns true if the dialog successfully starts bool StartExecuteAsync(const std::function &rEndDialogFn) { VclAbstractDialog::AsyncContext aCtx; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index b861b848e84c..ff3a1e8c346e 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -20,6 +20,7 @@ namespace weld { class Container; +class DialogController; class VCL_DLLPUBLIC Widget { @@ -120,6 +121,12 @@ public: class VCL_DLLPUBLIC Dialog : virtual public Window { +private: +friend DialogController; +virtual bool runAsync(std::shared_ptr, + const std::function& func) += 0; + public: virtual int run() = 0; virtual void response(int response) = 0; @@ -534,8 +541,33 @@ public: virtual DrawingArea* weld_drawing_area(const OString& id, bool bTakeOwnership = false) = 0; virtual ~Builder() {} }; -} +class VCL_DLLPUBLIC DialogController +{ +private: +virtual Dialog* getDialog() = 0; + +public: +short run() { return getDialog()->run(); } +static bool runAsync(const std::shared_ptr& rController, + const std::function&); +virtual ~DialogController() {} +}; + +class VCL_DLLPUBLIC GenericDialogController : public DialogController +{ +private: +virtual Dialog* getDialog() override { return m_xDialog.get(); } + +protected: +std::unique_ptr m_xBuilder; +std::unique_ptr m_xDialog; + +public: +GenericDialogController(weld::Widget* pParent, const OUString& rUIFile, +const OString& rDialogId); +}; +} #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 8c33ce4e5ba3..a6334cd57e60 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -2474,9 +2474,8 @@ KEYINPUT_CHECKTABLE_INSDEL: } else { -std::unique_ptr xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui")); -std::unique_ptr xInfo(xBuilder->weld_message_dialog("InfoReadonlyDialog")); -xInfo->run(); +auto xInfo(std::make_shared(GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui", "InfoReadonlyDialog")); +weld::DialogController::runAsync(xInfo, [](int) {}); eKeyState = SwKeyState::End; } break; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index bb304d2dc811..3f95a7589849 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include #include @@ -430,6 +431,14 @@ public: { } +virtual bool runAsync(std::shared_ptr aOwner, const std::function &rEndDialogFn) override +{ +VclAbstractDialog::AsyncContext aCtx; +aCtx.mxOwnerDialog = aOwner; +aCtx.maEndDialogFn = rEndDialogFn; +return m_xDialog->StartExecuteAsync(aCtx); +} + virtual int run(
[Libreoffice-commits] core.git: include/vcl sw/source vcl/source
include/vcl/window.hxx |2 ++ sw/source/uibase/uiview/view.cxx | 10 ++ vcl/source/window/window.cxx | 14 +- 3 files changed, 25 insertions(+), 1 deletion(-) New commits: commit 3c2b80066bf2fba4e7222fb7d30ac7d412539818 Author: Miklos Vajna Date: Mon Aug 17 17:10:30 2015 +0200 tdf#93482 vcl rendercontext: add Window::RequestDoubleBuffering() This allows applications to request enabling/disabling of double-buffering of their VCL frame and all its children. It works after-the-fact, too: so in case the start center creates the frame and later that frame is reused for Writer, then Writer can turn on double-buffering, still. From a user's point of view, this means that next to VCL_DOUBLEBUFFERING_FORCE_ENABLE, there is now also a VCL_DOUBLEBUFFERING_ENABLE environment variable that enables a safe subset that is not supposed to draw directly at all. Enable this for Writer only, for now. Change-Id: Ie2cbf7d467eae2cee37fb58a1efc0a8984204408 diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index a105bdd..57ac319 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -913,6 +913,8 @@ public: /// Can the widget derived from this Window do the double-buffering via RenderContext properly? boolSupportsDoubleBuffering() const; +/// Enable/disable double-buffering of the frame window and all its children. +voidRequestDoubleBuffering(bool bRequest); voidEnableAllResize( bool bEnable = true ); diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 4125a91..9fd8dd7 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -719,6 +719,10 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) m_bIsPreviewDoubleClick(false), m_bAnnotationMode(false) { +static bool bRequestDoubleBuffering = getenv("VCL_DOUBLEBUFFERING_ENABLE"); +if (bRequestDoubleBuffering) +m_pEditWin->RequestDoubleBuffering(true); + // According to discussion with MBA and further // investigations, no old SfxViewShell will be set as parameter , // if function "New Window" is performed to open an additional view beside @@ -1056,7 +1060,13 @@ SwView::~SwView() m_pTogglePageBtn.disposeAndClear(); delete m_pGlosHdl; delete m_pViewImpl; + +// If this was enabled in the ctor for the frame, then disable it here. +static bool bRequestDoubleBuffering = getenv("VCL_DOUBLEBUFFERING_ENABLE"); +if (bRequestDoubleBuffering) +m_pEditWin->RequestDoubleBuffering(false); m_pEditWin.disposeAndClear(); + delete m_pFormatClipboard; } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 35b4f06f..8a0d521 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1075,7 +1075,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p mpWindowImpl->mpFrameData->maResizeIdle.SetDebugName( "vcl::Window maResizeIdle" ); mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = false; if (!(nStyle & WB_DEFAULTWIN) && mpWindowImpl->mbDoubleBufferingRequested) -mpWindowImpl->mpFrameData->mpBuffer = VclPtrInstance(); +RequestDoubleBuffering(true); mpWindowImpl->mpFrameData->mbInBufferedPaint = false; if ( pRealParent && IsTopWindow() ) @@ -3908,6 +3908,18 @@ bool Window::SupportsDoubleBuffering() const return mpWindowImpl->mpFrameData->mpBuffer; } +void Window::RequestDoubleBuffering(bool bRequest) +{ +if (bRequest) +{ +mpWindowImpl->mpFrameData->mpBuffer = VclPtrInstance(); +// Make sure that the buffer size matches the frame size. + mpWindowImpl->mpFrameData->mpBuffer->SetOutputSizePixel(mpWindowImpl->mpFrameWindow->GetOutputSizePixel()); +} +else +mpWindowImpl->mpFrameData->mpBuffer.reset(); +} + /* * The rational here is that we moved destructors to * dispose and this altered a lot of code paths, that ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits