[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source
include/vcl/outdev.hxx|2 include/vcl/vcllayout.hxx |2 vcl/inc/sallayout.hxx |4 - vcl/inc/textlayout.hxx|6 -- vcl/source/control/edit.cxx | 74 +++--- vcl/source/gdi/sallayout.cxx | 90 -- vcl/source/gdi/textlayout.cxx | 17 --- vcl/source/outdev/text.cxx| 46 ++--- 8 files changed, 119 insertions(+), 122 deletions(-) New commits: commit 21013c4662a9ab32d293de263c54ebeceb66828c Author: Khaled Hosny AuthorDate: Wed Jul 19 19:07:34 2023 +0300 Commit: خالد حسني CommitDate: Sun Jul 23 06:05:02 2023 +0200 tdf#156377: Improve cursor traversal in UI widgets Re-implement GetCaretPositions() on top of GetCharWidths() so it can benefit from our code that handles cursor insertion in middle of ligatures. Change-Id: I2b76b3b0125f2454f78cb6779d88617dc29386fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154660 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 7e0a17fec545..f3d2e912d0a6 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1047,7 +1047,7 @@ public: vcl::text::TextLayoutCache const* = nullptr, SalLayoutGlyphs const*const pLayoutCache = nullptr) const; -voidGetCaretPositions( const OUString&, sal_Int32* pCaretXArray, +voidGetCaretPositions( const OUString&, KernArray& rCaretXArray, sal_Int32 nIndex, sal_Int32 nLen, const SalLayoutGlyphs* pGlyphs = nullptr ) const; voidDrawStretchText( const Point& rStartPt, sal_Int32 nWidth, diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx index dda07f1c710e..7c7a179b9b05 100644 --- a/include/vcl/vcllayout.hxx +++ b/include/vcl/vcllayout.hxx @@ -96,7 +96,7 @@ public: virtual sal_Int32 GetTextBreak(double nMaxWidth, double nCharExtra, int nFactor) const = 0; virtual double FillDXArray( std::vector* pDXArray, const OUString& rStr ) const = 0; virtual double GetTextWidth() const { return FillDXArray( nullptr, {} ); } -virtual voidGetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const = 0; +virtual voidGetCaretPositions( std::vector& rCaretPositions, const OUString& rStr ) const = 0; virtual boolIsKashidaPosValid ( int /*nCharPos*/, int /*nNextCharPos*/ ) const = 0; // i60594 // methods using glyph indexing diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index f96eb7df2977..dbe3000f8a83 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -64,7 +64,7 @@ public: sal_Int32 GetTextBreak(double nMaxWidth, double nCharExtra, int nFactor) const override; double GetTextWidth() const final override; double FillDXArray(std::vector* pDXArray, const OUString& rStr) const override; -voidGetCaretPositions(int nArraySize, sal_Int32* pCaretXArray) const override; +voidGetCaretPositions(std::vector& rCaretPositions, const OUString& rStr) const override; boolGetNextGlyph(const GlyphItem** pGlyph, basegfx::B2DPoint& rPos, int& nStart, const LogicalFontInstance** ppGlyphFont = nullptr) const override; boolGetOutline(basegfx::B2DPolyPolygonVector&) const override; @@ -120,7 +120,7 @@ public: double GetTextWidth() const final override; double FillDXArray(std::vector* pDXArray, const OUString& rStr) const final override; sal_Int32 GetTextBreak(double nMaxWidth, double nCharExtra, int nFactor) const final override; -voidGetCaretPositions(int nArraySize, sal_Int32* pCaretXArray) const final override; +voidGetCaretPositions(std::vector& rCaretPositions, const OUString& rStr) const override; // used by display layers LogicalFontInstance& GetFont() const diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 10c68412a627..0db27e8a315a 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -473,20 +473,9 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const tools::Rectangl const OUString aText = ImplGetText(); const sal_Int32 nLen = aText.getLength(); -sal_Int32 nDXBuffer[256]; -std::unique_ptr pDXBuffer; -sal_Int32* pDX = nDXBuffer; - +KernArray aDX; if (nLen) -{ -if (o3tl::make_unsigned(2 * nLen) > SAL_N_ELEMENTS(nDXBuffer)) -{ -pDXBuffer.reset(new sal_Int32[2 * (nLen + 1)]); -pDX = pDXBuffer.get(); -} - -GetOutDev()->GetCaretPositions(aText, pDX, 0, nLen);
[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source
include/vcl/GestureEventRotate.hxx | 46 include/vcl/GestureEventZoom.hxx | 46 include/vcl/commandevent.hxx | 41 + vcl/inc/salwtype.hxx | 20 ++ vcl/source/window/commandevent.cxx | 15 +++ vcl/source/window/winproc.cxx | 70 + 6 files changed, 238 insertions(+) New commits: commit 85b65b90ac10d39190097af87a2de609e87eea9c Author: Povilas Kanapickas AuthorDate: Thu Aug 25 00:18:29 2022 +0300 Commit: Tomaž Vajngerl CommitDate: Fri Aug 26 09:12:54 2022 +0200 vcl: implement rotate gesture infrastructure This change implements internal infrastructure to pass rotate gestures from low-level sources to the consuming GUI widgets. The API follows the established begin-update-update-...-end event convention that is used on various platforms. The API should be enough to support bouth touchpad and touchscreen gestures, as long as the underlying low-level source exposes enough information. The hardware drivers usually expose touchpad gestures already recognized whereas touchscreen gestures come as a set of moving touchpoints and application needs to figure out their meaning itself. Many toolkits recognize both and offer a unified higher-level interface that can be used by us. Change-Id: Iae667b3248d6f78bfb1eef755af6bc996432b6a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138788 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/include/vcl/GestureEventRotate.hxx b/include/vcl/GestureEventRotate.hxx new file mode 100644 index ..39f4b310f973 --- /dev/null +++ b/include/vcl/GestureEventRotate.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include + +enum class GestureEventRotateType +{ +Begin, +Update, +End +}; + +class VCL_DLLPUBLIC GestureEventRotate +{ +public: +sal_Int32 mnX = 0; +sal_Int32 mnY = 0; + +GestureEventRotateType meEventType = GestureEventRotateType::Begin; + +// The difference of between the current gesture scale and the scale at the beginning of the +// gesture. +double mfAngleDelta = 0; + +GestureEventRotate() = default; + +GestureEventRotate(sal_Int32 nInitialX, sal_Int32 nInitialY, GestureEventRotateType eEventType, + double fAngleDelta) +: mnX(nInitialX) +, mnY(nInitialY) +, meEventType(eEventType) +, mfAngleDelta(fAngleDelta) +{ +} +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx index 71694cc6f087..7b3199b18ccd 100644 --- a/include/vcl/commandevent.hxx +++ b/include/vcl/commandevent.hxx @@ -29,6 +29,7 @@ #include #include #include +#include class CommandExtTextInputData; class CommandWheelData; @@ -41,6 +42,7 @@ class CommandSwipeData; class CommandLongPressData; class CommandGestureData; class CommandGestureZoomData; +class CommandGestureRotateData; enum class CommandEventId; @@ -93,6 +95,7 @@ public: const CommandLongPressData* GetLongPressData() const; const CommandGestureData* GetGestureData() const; const CommandGestureZoomData* GetGestureZoomData() const; +const CommandGestureRotateData* GetGestureRotateData() const; }; class VCL_DLLPUBLIC CommandExtTextInputData @@ -341,6 +344,23 @@ public: {} }; +class VCL_DLLPUBLIC CommandGestureRotateData +{ +public: +const double mfX = 0; +const double mfY = 0; +const GestureEventRotateType meEventType = GestureEventRotateType::Begin; +const double mfAngleDelta = 0; + +CommandGestureRotateData(double fX, double fY, GestureEventRotateType eEventType, + double fAngleDelta) +: mfX(fX) +, mfY(fY) +, meEventType(eEventType) +, mfAngleDelta(fAngleDelta) +{} +}; + enum class CommandEventId { NONE= 0, @@ -366,6 +386,7 @@ enum class CommandEventId LongPress = 22, Gesture = 23, GestureZoom = 24, +GestureRotate = 25, }; #endif // INCLUDED_VCL_COMMANDEVENT_HXX diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index d920a16dc5d4..7b66ef5a2d45 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -27,6 +27,7 @@ #include #include #include +#include class LogicalFontInstance; class SalGraphics; @@ -93,6 +94,7 @@ enum class SalEvent { ExternalGesture, Gesture,
[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source
include/vcl/outdev.hxx|2 ++ vcl/inc/pdf/Matrix3.hxx |2 ++ vcl/inc/pdf/pdfwriter_impl.hxx|4 ++-- vcl/source/gdi/pdfwriter_impl.cxx | 31 ++- vcl/source/outdev/map.cxx | 19 +++ vcl/source/pdf/Matrix3.cxx|6 ++ 6 files changed, 45 insertions(+), 19 deletions(-) New commits: commit 38a29acd7e305ec99c4eb1871b9f31f75a3ab80c Author: Caolán McNamara AuthorDate: Wed Aug 24 11:32:30 2022 +0100 Commit: Caolán McNamara CommitDate: Thu Aug 25 09:51:12 2022 +0200 use DevicePoint and SubPixelToLogic to return to source coord system Change-Id: I1aeae6270feb6cb0a44b7850e1b3143e68ae780f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138770 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/vcl/inc/pdf/Matrix3.hxx b/vcl/inc/pdf/Matrix3.hxx index 795b2af4be52..da88cc31399b 100644 --- a/vcl/inc/pdf/Matrix3.hxx +++ b/vcl/inc/pdf/Matrix3.hxx @@ -11,6 +11,7 @@ #pragma once #include +#include #include namespace vcl::pdf @@ -45,6 +46,7 @@ public: double get(size_t i) const { return f[i]; } Point transform(const Point& rPoint) const; +DevicePoint transform(const DevicePoint& rPoint) const; }; } diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index 4ebddbe5edaf..9af21e81baee 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -579,14 +579,14 @@ struct PDFAddStream // helper structure for drawLayout and friends struct PDFGlyph { -Point const m_aPos; +DevicePoint const m_aPos; const GlyphItem* m_pGlyph; sal_Int32 const m_nNativeWidth; sal_Int32 const m_nMappedFontId; sal_uInt8 const m_nMappedGlyphId; int const m_nCharPos; -PDFGlyph( const Point& rPos, +PDFGlyph( const DevicePoint& rPos, const GlyphItem* pGlyph, sal_Int32 nNativeWidth, sal_Int32 nFontId, diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 48a8b472df03..74b7ccdbcf7d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5944,8 +5944,7 @@ void PDFWriterImpl::drawVerticalGlyphs( sal_Int32 nFontHeight ) { tools::Long nXOffset = 0; -Point aCurPos( rGlyphs[0].m_aPos ); -aCurPos = PixelToLogic( aCurPos ); +Point aCurPos(SubPixelToLogic(rGlyphs[0].m_aPos)); aCurPos += rAlignOffset; for( size_t i = 0; i < rGlyphs.size(); i++ ) { @@ -5969,9 +5968,9 @@ void PDFWriterImpl::drawVerticalGlyphs( if( i < rGlyphs.size()-1 ) // #i120627# the text on the Y axis is reversed when export ppt file to PDF format { -tools::Long nOffsetX = rGlyphs[i+1].m_aPos.X() - rGlyphs[i].m_aPos.X(); -tools::Long nOffsetY = rGlyphs[i+1].m_aPos.Y() - rGlyphs[i].m_aPos.Y(); -nXOffset += static_cast(sqrt(double(nOffsetX*nOffsetX + nOffsetY*nOffsetY))); +double nOffsetX = rGlyphs[i+1].m_aPos.getX() - rGlyphs[i].m_aPos.getX(); +double nOffsetY = rGlyphs[i+1].m_aPos.getY() - rGlyphs[i].m_aPos.getY(); +nXOffset += static_cast(sqrt(nOffsetX*nOffsetX + nOffsetY*nOffsetY)); } if (!rGlyphs[i].m_pGlyph->glyphId()) continue; @@ -6022,7 +6021,7 @@ void PDFWriterImpl::drawHorizontalGlyphs( for( size_t i = 1; i < rGlyphs.size(); i++ ) { if( rGlyphs[i].m_nMappedFontId != rGlyphs[i-1].m_nMappedFontId || -rGlyphs[i].m_aPos.Y() != rGlyphs[i-1].m_aPos.Y() ) +rGlyphs[i].m_aPos.getY() != rGlyphs[i-1].m_aPos.getY() ) { aRunEnds.push_back(i); } @@ -6034,10 +6033,8 @@ void PDFWriterImpl::drawHorizontalGlyphs( sal_uInt32 nBeginRun = 0; for( size_t nRun = 0; nRun < aRunEnds.size(); nRun++ ) { -// setup text matrix -Point aCurPos = rGlyphs[nBeginRun].m_aPos; -// back transformation to current coordinate system -aCurPos = PixelToLogic( aCurPos ); +// setup text matrix back transformed to current coordinate system +Point aCurPos(SubPixelToLogic(rGlyphs[nBeginRun].m_aPos)); aCurPos += rAlignOffset; // the first run can be set with "Td" operator // subsequent use of that operator would move @@ -6079,9 +6076,9 @@ void PDFWriterImpl::drawHorizontalGlyphs( { appendHex( rGlyphs[nPos].m_nMappedGlyphId, aUnkernedLine ); // check if default glyph positioning is sufficient -const Point aThisPos = aMat.transform( rGlyphs[nPos].m_aPos ); -const Point aPrevPos = aMat.transform( rGlyphs[nPos-1].m_aPos ); -double fAdvance = aThisPos.X() - aPrevPos.X(); +const DevicePoint aThisPos = aMat.transform( rGlyphs[nPos].m_aPos ); +const DevicePoint aPrevPos = aMat.transform(
[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source vcl/unx
include/vcl/weld.hxx | 10 + vcl/inc/salvtables.hxx|6 + vcl/source/app/salvtables.cxx | 29 ++ vcl/unx/gtk3/gtkinst.cxx | 46 ++ 4 files changed, 91 insertions(+) New commits: commit a130f0f406e67cda098adc3086e937317f737583 Author: Mike Kaganski AuthorDate: Tue May 24 18:43:45 2022 +0200 Commit: Mike Kaganski CommitDate: Wed Jun 1 16:29:42 2022 +0200 Implement weld::IconView::[gs]et_item_width Change-Id: I211e3c21b4e0148c4ff6fc9931838e37ccd0cc41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134897 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index aacbc7c310c4..dba513870818 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1350,6 +1350,9 @@ protected: OUString signal_query_tooltip(const TreeIter& rIter) { return m_aQueryTooltipHdl.Call(rIter); } public: +virtual int get_item_width() const = 0; +virtual void set_item_width(int width) = 0; + virtual void insert(int pos, const OUString* pStr, const OUString* pId, const OUString* pIconName, TreeIter* pRet) = 0; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 7752b5243c11..45e9700ad2c8 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -1761,6 +1761,9 @@ private: public: SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder, bool bTakeOwnership); +virtual int get_item_width() const override; +virtual void set_item_width(int width) override; + virtual void freeze() override; virtual void thaw() override; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 4755c94e51cb..4432b4c5afe6 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5308,6 +5308,9 @@ SalInstanceIconView::SalInstanceIconView(::IconView* pIconView, SalInstanceBuild m_xIconView->SetPopupMenuHdl(LINK(this, SalInstanceIconView, CommandHdl)); } +int SalInstanceIconView::get_item_width() const { return m_xIconView->GetEntryWidth(); } +void SalInstanceIconView::set_item_width(int width) { m_xIconView->SetEntryWidth(width); } + void SalInstanceIconView::freeze() { bool bIsFirstFreeze = IsFirstFreeze(); diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 1f61fc49db3d..0575aa8c3c7a 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -16252,6 +16252,16 @@ public: m_nIdCol = m_nTextCol + 1; } +virtual int get_item_width() const override +{ +return gtk_icon_view_get_item_width(m_pIconView); +} + +virtual void set_item_width(int width) override +{ +gtk_icon_view_set_item_width(m_pIconView, width); +} + virtual void insert(int pos, const OUString* pText, const OUString* pId, const OUString* pIconName, weld::TreeIter* pRet) override { disable_notify_events(); commit 1c2d3b069859f466f59f35e50819fadc0ab61af7 Author: Mike Kaganski AuthorDate: Mon May 23 12:48:15 2022 +0300 Commit: Mike Kaganski CommitDate: Wed Jun 1 16:29:28 2022 +0200 Implement weld::IconView::connect_query_tooltip Change-Id: I8a8540e240d6a7046f564404c7c3b6bff8c2f04d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134806 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 06cb4d037b3b..aacbc7c310c4 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1343,9 +1343,11 @@ protected: Link m_aSelectionChangeHdl; Link m_aItemActivatedHdl; Link m_aCommandHdl; +Link m_aQueryTooltipHdl; void signal_selection_changed() { m_aSelectionChangeHdl.Call(*this); } bool signal_item_activated() { return m_aItemActivatedHdl.Call(*this); } +OUString signal_query_tooltip(const TreeIter& rIter) { return m_aQueryTooltipHdl.Call(rIter); } public: virtual void insert(int pos, const OUString* pStr, const OUString* pId, @@ -1381,6 +1383,11 @@ public: void connect_command(const Link& rLink) { m_aCommandHdl = rLink; } +virtual void connect_query_tooltip(const Link& rLink) +{ +m_aQueryTooltipHdl = rLink; +} + virtual OUString get_selected_id() const = 0; virtual void clear() = 0; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 3f574237444b..7752b5243c11 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -1756,6 +1756,7 @@ private: DECL_LINK(DeSelectHdl, SvTreeListBox*, void); DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool); DECL_LINK(CommandHdl, const CommandEvent&, bool); +DECL_LINK(TooltipHdl, const HelpEvent&, bool); public: SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder, bool bTakeOwnership); @@ -1770,6 +1771,8 @@ public: virtual void
[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source
include/vcl/glyphitemcache.hxx|6 +- vcl/inc/pdf/pdfwriter_impl.hxx|3 +++ vcl/source/gdi/impglyphitem.cxx | 35 +-- vcl/source/gdi/pdfwriter_impl.cxx | 12 ++-- 4 files changed, 39 insertions(+), 17 deletions(-) New commits: commit 9ed2912d4ecfd9573b3ca9d2390a0f1b0e3060a2 Author: Luboš Luňák AuthorDate: Thu Apr 7 12:07:02 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Apr 8 21:28:44 2022 +0200 check better for unchanged OutputDevice in SalLayoutGlyphsCache Some things like font could change, so it needs to be saved and compared. If would be even better to avoid comparing OutputDevice pointers and instead compare only what actually matters, in order to reuse the same glyphs used for different output devices, but I can't find all the relevant data in OutputDevice. Change-Id: Ib8634165b5b312d1db2c9fc28f8d7fdf7b552d25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132671 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx index 83c77309a632..64a1a64186ee 100644 --- a/include/vcl/glyphitemcache.hxx +++ b/include/vcl/glyphitemcache.hxx @@ -61,12 +61,16 @@ public: private: struct CachedGlyphsKey { -VclPtr outputDevice; OUString text; sal_Int32 index; sal_Int32 len; Point logicPos; tools::Long logicWidth; +VclPtr outputDevice; +vcl::Font font; +bool rtl; +vcl::text::ComplexTextLayoutFlags layoutMode; +LanguageType digitLanguage; size_t hashValue; CachedGlyphsKey(const VclPtr& dev, const OUString& t, sal_Int32 i, sal_Int32 l, const Point& p, tools::Long w); diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx index d320d27dad88..ea3c490b0ba2 100644 --- a/vcl/source/gdi/impglyphitem.cxx +++ b/vcl/source/gdi/impglyphitem.cxx @@ -135,32 +135,47 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr& d, const OUString& t, sal_Int32 i, sal_Int32 l, const Point& p, tools::Long w) -: outputDevice(d) -, text(t) +: text(t) , index(i) , len(l) , logicPos(p) , logicWidth(w) +, outputDevice(d) +// we also need to save things used in OutputDevice::ImplPrepareLayoutArgs(), in case they +// change in the output device +// TODO there is still something missing, otherwise it wouldn't be necessary to compare +// also the OutputDevice pointers +, font(outputDevice->GetFont()) +, rtl(outputDevice->IsRTLEnabled()) +, layoutMode(outputDevice->GetLayoutMode()) +, digitLanguage(outputDevice->GetDigitLanguage()) { hashValue = 0; -o3tl::hash_combine(hashValue, outputDevice.get()); -SvMemoryStream stream; -WriteFont(stream, outputDevice->GetFont()); -o3tl::hash_combine(hashValue, static_cast(stream.GetData()), stream.GetSize()); o3tl::hash_combine(hashValue, vcl::text::FirstCharsStringHash()(text)); o3tl::hash_combine(hashValue, index); o3tl::hash_combine(hashValue, len); o3tl::hash_combine(hashValue, logicPos.X()); o3tl::hash_combine(hashValue, logicPos.Y()); o3tl::hash_combine(hashValue, logicWidth); + +o3tl::hash_combine(hashValue, outputDevice.get()); +SvMemoryStream stream; +WriteFont(stream, font); +o3tl::hash_combine(hashValue, static_cast(stream.GetData()), stream.GetSize()); +o3tl::hash_combine(hashValue, rtl); +o3tl::hash_combine(hashValue, layoutMode); +o3tl::hash_combine(hashValue, digitLanguage.get()); } inline bool SalLayoutGlyphsCache::CachedGlyphsKey::operator==(const CachedGlyphsKey& other) const { -return hashValue == other.hashValue && outputDevice == other.outputDevice - && index == other.index && len == other.len && logicPos == other.logicPos - && logicWidth == other.logicWidth - && vcl::text::FastStringCompareEqual()(text, other.text); +return hashValue == other.hashValue && index == other.index && len == other.len + && logicPos == other.logicPos && logicWidth == other.logicWidth + && outputDevice == other.outputDevice && rtl == other.rtl + && layoutMode == other.layoutMode + && digitLanguage == other.digitLanguage + // slower things here + && font == other.font && vcl::text::FastStringCompareEqual()(text, other.text); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 376a9792c32a51c91079a54a0cf190acd58485af Author: Luboš Luňák AuthorDate: Wed Apr 6 19:29:06 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Apr 8 21:28:29 2022 +0200 use SalLayoutGlyphsCache in PDFWriterImpl
[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source
include/vcl/glyphitemcache.hxx | 17 ++--- vcl/inc/TextLayoutCache.hxx| 32 vcl/source/gdi/CommonSalLayout.cxx | 30 +- vcl/source/gdi/impglyphitem.cxx| 20 +++- 4 files changed, 58 insertions(+), 41 deletions(-) New commits: commit 94c2fb28d76c9c37849412a66b31d6861bce3155 Author: Luboš Luňák AuthorDate: Wed Apr 6 19:28:07 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Apr 8 21:28:15 2022 +0200 faster hashing of very long strings in SalLayoutGlyphsCache tdf#147284 being a (pathological) testcase. Change-Id: I08d8dffb40193b461555bed818c040761e8d575b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132669 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/vcl/inc/TextLayoutCache.hxx b/vcl/inc/TextLayoutCache.hxx index 0ce0c19d8278..ecb85ea7043d 100644 --- a/vcl/inc/TextLayoutCache.hxx +++ b/vcl/inc/TextLayoutCache.hxx @@ -20,6 +20,8 @@ #pragma once #include +#include +#include #include @@ -48,6 +50,36 @@ public: std::vector runs; TextLayoutCache(sal_Unicode const* pStr, sal_Int32 const nEnd); }; + +struct FirstCharsStringHash +{ +size_t operator()(const OUString& str) const +{ +// Strings passed to GenericSalLayout::CreateTextLayoutCache() may be very long, +// and computing an entire hash could almost negate the gain of hashing. Hash just first +// characters, that should be good enough. +size_t hash += rtl_ustr_hashCode_WithLength(str.getStr(), std::min(100, str.getLength())); +o3tl::hash_combine(hash, str.getLength()); +return hash; +} +}; + +struct FastStringCompareEqual +{ +bool operator()(const OUString& str1, const OUString& str2) const +{ +// Strings passed to GenericSalLayout::CreateTextLayoutCache() may be very long, +// and OUString operator == compares backwards and using hard-written code, while +// memcmp() compares much faster. +if (str1.getLength() != str2.getLength()) +return false; +if (str1.getStr() == str2.getStr()) +return true; +return memcmp(str1.getStr(), str2.getStr(), str1.getLength() * sizeof(str1.getStr()[0])) + == 0; +} +}; } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 8dee28727997..2c8a4db8398f 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -154,40 +154,12 @@ namespace { return VerticalOrientation(nRet); } -struct FirstCharsStringHash -{ -size_t operator()( const OUString& str ) const -{ -// Strings passed to GenericSalLayout::CreateTextLayoutCache() may be very long, -// and computing an entire hash could almost negate the gain of hashing. Hash just first -// characters, that should be good enough. -size_t hash = rtl_ustr_hashCode_WithLength( str.getStr(), std::min( 100, str.getLength())); -o3tl::hash_combine(hash, str.getLength()); -return hash; -} -}; - -struct ForwardStringCompareEqual -{ -bool operator()( const OUString& str1, const OUString& str2 ) const -{ -// Strings passed to GenericSalLayout::CreateTextLayoutCache() may be very long, -// and OUString operator == compares backwards, which is inefficient for very long -// strings (bad memory prefetch). -if( str1.getLength() != str2.getLength()) -return false; -if( str1.getStr() == str2.getStr()) -return true; -return memcmp( str1.getStr(), str2.getStr(), str1.getLength() * sizeof( str1.getStr()[ 0 ] )) == 0; -} -}; - } // namespace std::shared_ptr GenericSalLayout::CreateTextLayoutCache(OUString const& rString) { typedef o3tl::lru_map, -FirstCharsStringHash, ForwardStringCompareEqual> Cache; +vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual> Cache; static vcl::DeleteOnDeinit< Cache > cache( 1000 ); if( Cache* map = cache.get()) { diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx index eaf8cf5c8453..d320d27dad88 100644 --- a/vcl/source/gdi/impglyphitem.cxx +++ b/vcl/source/gdi/impglyphitem.cxx @@ -21,6 +21,7 @@ #include #include #include +#include SalLayoutGlyphs::SalLayoutGlyphs() {} @@ -146,7 +147,7 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtrGetFont()); o3tl::hash_combine(hashValue, static_cast(stream.GetData()), stream.GetSize()); -o3tl::hash_combine(hashValue, text); +o3tl::hash_combine(hashValue, vcl::text::FirstCharsStringHash()(text)); o3tl::hash_combine(hashValue, index); o3tl::hash_combine(hashValue, len); o3tl::hash_combine(hashValue,
[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source
include/vcl/toolkit/svtabbx.hxx |2 vcl/inc/salvtables.hxx | 358 + vcl/source/app/salvtables.cxx | 2446 +++- vcl/source/treelist/svtabbx.cxx | 49 4 files changed, 1608 insertions(+), 1247 deletions(-) New commits: commit 01e54822635b965c068094493294c579af4c4161 Author: Szymon Kłos AuthorDate: Tue Nov 24 16:31:40 2020 +0100 Commit: Szymon Kłos CommitDate: Wed Nov 25 09:03:43 2020 +0100 Move SalInstanceTreeView decl to header file Change-Id: Ie49f4113332de5c4fa825f93dde46bb408187fe4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106536 Tested-by: Jenkins Reviewed-by: Szymon Kłos diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 4fca8ff49cc5..cb7ccc7b12e3 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -24,6 +24,9 @@ #include #include #include "messagedialog.hxx" +#include +#include +#include class SalInstanceBuilder : public weld::Builder { @@ -1297,4 +1300,359 @@ public: virtual ~SalInstanceTextView() override; }; +class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::TreeView +{ +private: +// owner for UserData +std::vector> m_aUserData; +VclPtr m_xTreeView; +SvLBoxButtonData m_aCheckButtonData; +SvLBoxButtonData m_aRadioButtonData; +// currently expanding parent that logically, but not currently physically, +// contain placeholders +o3tl::sorted_vector m_aExpandingPlaceHolderParents; +// which columns should be custom rendered +o3tl::sorted_vector m_aCustomRenders; +bool m_bTogglesAsRadio; +int m_nSortColumn; + +DECL_LINK(SelectHdl, SvTreeListBox*, void); +DECL_LINK(DeSelectHdl, SvTreeListBox*, void); +DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool); +DECL_LINK(ExpandingHdl, SvTreeListBox*, bool); +DECL_LINK(EndDragHdl, HeaderBar*, void); +DECL_LINK(HeaderBarClickedHdl, HeaderBar*, void); +DECL_LINK(ToggleHdl, SvLBoxButtonData*, void); +DECL_LINK(ModelChangedHdl, SvTreeListBox*, void); +DECL_LINK(StartDragHdl, SvTreeListBox*, bool); +DECL_STATIC_LINK(SalInstanceTreeView, FinishDragHdl, SvTreeListBox*, void); +DECL_LINK(EditingEntryHdl, SvTreeListEntry*, bool); +typedef std::pair IterString; +DECL_LINK(EditedEntryHdl, IterString, bool); +DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void); +DECL_LINK(CompareHdl, const SvSortData&, sal_Int32); +DECL_LINK(PopupMenuHdl, const CommandEvent&, bool); +DECL_LINK(TooltipHdl, const HelpEvent&, bool); +DECL_LINK(CustomRenderHdl, svtree_render_args, void); +DECL_LINK(CustomMeasureHdl, svtree_measure_args, Size); + +// Each row has a cell for the expander image, (and an optional cell for a +// checkbutton if enable_toggle_buttons has been called) which precede +// index 0 +int to_internal_model(int col) const; + +int to_external_model(int col) const; + +bool IsDummyEntry(SvTreeListEntry* pEntry) const; + +SvTreeListEntry* GetPlaceHolderChild(SvTreeListEntry* pEntry) const; + +static void set_font_color(SvTreeListEntry* pEntry, const Color& rColor); + +void AddStringItem(SvTreeListEntry* pEntry, const OUString& rStr, int nCol); + +void do_insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, + const OUString* pId, const OUString* pIconName, + const VirtualDevice* pImageSurface, bool bChildrenOnDemand, weld::TreeIter* pRet, + bool bIsSeparator); + +void update_checkbutton_column_width(SvTreeListEntry* pEntry); + +void InvalidateModelEntry(SvTreeListEntry* pEntry); + +void do_set_toggle(SvTreeListEntry* pEntry, TriState eState, int col); + +static TriState do_get_toggle(SvTreeListEntry* pEntry, int col); + +TriState get_toggle(SvTreeListEntry* pEntry, int col) const; + +void set_toggle(SvTreeListEntry* pEntry, TriState eState, int col); + +bool get_text_emphasis(SvTreeListEntry* pEntry, int col) const; + +void set_header_item_width(const std::vector& rWidths); + +public: +SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + +virtual void connect_query_tooltip(const Link& rLink) override; + +virtual void columns_autosize() override; + +virtual void freeze() override; + +virtual void thaw() override; + +virtual void set_column_fixed_widths(const std::vector& rWidths) override; + +virtual void set_column_editables(const std::vector& rEditables) override; + +virtual void set_centered_column(int nCol) override; + +virtual int get_column_width(int nColumn) const override; + +virtual OUString get_column_title(int nColumn) const override; + +virtual void set_column_title(int nColumn, const OUString& rTitle) override; + +virtual void set_column_custom_renderer(int nColumn, bool bEnable) override; + +virtual void
[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source
include/vcl/metric.hxx |3 +- vcl/inc/impfontmetric.hxx | 22 +++-- vcl/source/gdi/metric.cxx | 29 +--- vcl/source/outdev/font.cxx | 46 ++--- 4 files changed, 51 insertions(+), 49 deletions(-) New commits: commit 27c4cf76a189b546daf14797773517655f24c81d Author: Chris SherlockDate: Thu Jan 14 13:54:55 2016 +1100 vcl: change from pFontAttributes to pFontMetric Change-Id: I777fd9ee93402c9af026f1ebef6fe960bd8c7c8c diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index a38af4a..f85fcc8 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -189,40 +189,40 @@ FontMetric OutputDevice::GetFontMetric() const return aMetric; LogicalFontInstance* pFontInstance = mpFontInstance; -ImplFontMetricData* pFontAttributes = &(pFontInstance->maFontMetric); +ImplFontMetricData* pFontMetric = &(pFontInstance->maFontMetric); // prepare metric aMetric.Font::operator=( maFont ); // set aMetric with info from font aMetric.SetName( maFont.GetName() ); -aMetric.SetStyleName( pFontAttributes->GetStyleName() ); -aMetric.SetSize( PixelToLogic( Size( pFontAttributes->GetWidth(), pFontAttributes->GetAscent() + pFontAttributes->GetDescent() - pFontAttributes->GetInternalLeading() ) ) ); -aMetric.SetCharSet( pFontAttributes->IsSymbolFont() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); -aMetric.SetFamily( pFontAttributes->GetFamilyType() ); -aMetric.SetPitch( pFontAttributes->GetPitch() ); -aMetric.SetWeight( pFontAttributes->GetWeight() ); -aMetric.SetItalic( pFontAttributes->GetSlantType() ); -aMetric.SetWidthType( pFontAttributes->GetWidthType() ); +aMetric.SetStyleName( pFontMetric->GetStyleName() ); +aMetric.SetSize( PixelToLogic( Size( pFontMetric->GetWidth(), pFontMetric->GetAscent() + pFontMetric->GetDescent() - pFontMetric->GetInternalLeading() ) ) ); +aMetric.SetCharSet( pFontMetric->IsSymbolFont() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); +aMetric.SetFamily( pFontMetric->GetFamilyType() ); +aMetric.SetPitch( pFontMetric->GetPitch() ); +aMetric.SetWeight( pFontMetric->GetWeight() ); +aMetric.SetItalic( pFontMetric->GetSlantType() ); +aMetric.SetWidthType( pFontMetric->GetWidthType() ); if ( pFontInstance->mnOwnOrientation ) aMetric.SetOrientation( pFontInstance->mnOwnOrientation ); else -aMetric.SetOrientation( pFontAttributes->GetOrientation() ); +aMetric.SetOrientation( pFontMetric->GetOrientation() ); if( !pFontInstance->maFontMetric.IsKernable() ) aMetric.SetKerning( maFont.GetKerning() & ~FontKerning::FontSpecific ); // set remaining metric fields -aMetric.SetBuiltInFontFlag( pFontAttributes->IsBuiltInFont() ); -aMetric.SetScalableFlag( pFontAttributes->IsScalable() ); -aMetric.SetFullstopCenteredFlag( pFontAttributes->IsFullstopCentered() ); -aMetric.SetBulletOffset( pFontAttributes->GetBulletOffset() ); -aMetric.SetAscent( ImplDevicePixelToLogicHeight( pFontAttributes->GetAscent() + mnEmphasisAscent ) ); -aMetric.SetDescent( ImplDevicePixelToLogicHeight( pFontAttributes->GetDescent() + mnEmphasisDescent ) ); -aMetric.SetInternalLeading( ImplDevicePixelToLogicHeight( pFontAttributes->GetInternalLeading() + mnEmphasisAscent ) ); +aMetric.SetBuiltInFontFlag( pFontMetric->IsBuiltInFont() ); +aMetric.SetScalableFlag( pFontMetric->IsScalable() ); +aMetric.SetFullstopCenteredFlag( pFontMetric->IsFullstopCentered() ); +aMetric.SetBulletOffset( pFontMetric->GetBulletOffset() ); +aMetric.SetAscent( ImplDevicePixelToLogicHeight( pFontMetric->GetAscent() + mnEmphasisAscent ) ); +aMetric.SetDescent( ImplDevicePixelToLogicHeight( pFontMetric->GetDescent() + mnEmphasisDescent ) ); +aMetric.SetInternalLeading( ImplDevicePixelToLogicHeight( pFontMetric->GetInternalLeading() + mnEmphasisAscent ) ); // OutputDevice has its own external leading function due to #i60945# aMetric.SetExternalLeading( ImplDevicePixelToLogicHeight( GetFontExtLeading() ) ); -aMetric.SetLineHeight( ImplDevicePixelToLogicHeight( pFontAttributes->GetAscent() + pFontAttributes->GetDescent() + mnEmphasisAscent + mnEmphasisDescent ) ); -aMetric.SetSlant( ImplDevicePixelToLogicHeight( pFontAttributes->GetSlant() ) ); +aMetric.SetLineHeight( ImplDevicePixelToLogicHeight( pFontMetric->GetAscent() + pFontMetric->GetDescent() + mnEmphasisAscent + mnEmphasisDescent ) ); +aMetric.SetSlant( ImplDevicePixelToLogicHeight( pFontMetric->GetSlant() ) ); SAL_INFO("vcl.gdi.fontmetric", "OutputDevice::GetFontMetric:" << aMetric); @@ -482,9 +482,9 @@ FontEmphasisMark OutputDevice::ImplGetEmphasisMarkStyle( const vcl::Font& rFont long OutputDevice::GetFontExtLeading() const { LogicalFontInstance*
[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source
include/vcl/outdev.hxx |6 -- vcl/inc/impbmp.hxx |6 ++ vcl/source/outdev/mask.cxx |6 -- vcl/source/outdev/pixel.cxx |6 -- 4 files changed, 6 insertions(+), 18 deletions(-) New commits: commit 9645435e3f408cf7877466c240522fb65acb8519 Author: Tor Lillqvist t...@collabora.com Date: Thu Jul 2 12:46:09 2015 +0300 No need for these declarations to be public Change-Id: I101269defce2cdbbb686c0ac0bb4bcb8c9a23846 diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 279cb1e..e357fcf 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -300,12 +300,6 @@ typedef boost::intrusive_ptr FontCharMap FontCharMapPtr; BmpMirrorFlags AdjustTwoRect( SalTwoRect rTwoRect, const Size rSizePix ); void AdjustTwoRect( SalTwoRect rTwoRect, const Rectangle rValidSrcRect ); -extern const sal_uLong nVCLRLut[ 6 ]; -extern const sal_uLong nVCLGLut[ 6 ]; -extern const sal_uLong nVCLBLut[ 6 ]; -extern const sal_uLong nVCLDitherLut[ 256 ]; -extern const sal_uLong nVCLLut[ 256 ]; - class OutputDevice; namespace vcl { diff --git a/vcl/inc/impbmp.hxx b/vcl/inc/impbmp.hxx index 0dc9ec8..1fa17f8 100644 --- a/vcl/inc/impbmp.hxx +++ b/vcl/inc/impbmp.hxx @@ -24,6 +24,12 @@ #include tools/gen.hxx #include tools/solar.h +extern const sal_uLong nVCLRLut[ 6 ]; +extern const sal_uLong nVCLGLut[ 6 ]; +extern const sal_uLong nVCLBLut[ 6 ]; +extern const sal_uLong nVCLDitherLut[ 256 ]; +extern const sal_uLong nVCLLut[ 256 ]; + struct BitmapBuffer; class SalBitmap; class BitmapPalette; commit feec4bfb9df7bc33a6093a397614d085e63cc708 Author: Tor Lillqvist t...@collabora.com Date: Thu Jul 2 12:42:25 2015 +0300 Bin unused declarations Change-Id: I0ebedfdefee4ba452b42eb695d949aeff24a5df0 diff --git a/vcl/source/outdev/mask.cxx b/vcl/source/outdev/mask.cxx index ed69b48..6223de1 100644 --- a/vcl/source/outdev/mask.cxx +++ b/vcl/source/outdev/mask.cxx @@ -27,12 +27,6 @@ #include impbmp.hxx #include outdata.hxx -extern const sal_uLong nVCLRLut[ 6 ]; -extern const sal_uLong nVCLGLut[ 6 ]; -extern const sal_uLong nVCLBLut[ 6 ]; -extern const sal_uLong nVCLDitherLut[ 256 ]; -extern const sal_uLong nVCLLut[ 256 ]; - void OutputDevice::DrawMask( const Point rDestPt, const Bitmap rBitmap, const Color rMaskColor ) { diff --git a/vcl/source/outdev/pixel.cxx b/vcl/source/outdev/pixel.cxx index b031ef4..bfa8384 100644 --- a/vcl/source/outdev/pixel.cxx +++ b/vcl/source/outdev/pixel.cxx @@ -29,12 +29,6 @@ #include outdata.hxx #include salgdi.hxx -extern const sal_uLong nVCLRLut[ 6 ]; -extern const sal_uLong nVCLGLut[ 6 ]; -extern const sal_uLong nVCLBLut[ 6 ]; -extern const sal_uLong nVCLDitherLut[ 256 ]; -extern const sal_uLong nVCLLut[ 256 ]; - Color OutputDevice::GetPixel( const Point rPt ) const { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source vcl/win
include/vcl/salgtype.hxx |7 +++ vcl/inc/win/salgdi.h | 44 ++- vcl/source/outdev/bitmap.cxx |6 +- vcl/win/source/gdi/salgdi.cxx| 55 +++ vcl/win/source/gdi/salnativewidgets-luna.cxx | 54 +++ vcl/win/source/gdi/salvd.cxx |6 +- vcl/win/source/gdi/winlayout.cxx | 62 +++ 7 files changed, 175 insertions(+), 59 deletions(-) New commits: commit 57d6b92b69a31260dea0d84fcd1fc5866ada7adb Author: Jan Holesovsky ke...@collabora.com Date: Thu Nov 20 18:49:03 2014 +0100 windows opengl: Implement the native theming with OpenGL. Change-Id: If8eb5cef228f4eb28e16de3e3135742282403cdc diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 831a703..8d88784 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -39,6 +39,7 @@ class FontSelectPattern; class ImplWinFontEntry; class ImplFontAttrCache; +class OpenGLTexture; class PhysicalFontCollection; class SalGraphicsImpl; class WinOpenGLSalGraphicsImpl; @@ -154,7 +155,7 @@ private: HBITMAP mhBitmap; /// DIBSection data. -sal_uInt8 *mpData; +sal_uInt32 *mpData; /// Mapping between the GDI position and OpenGL, to use for OpenGL drawing. SalTwoRect maRects; @@ -168,8 +169,13 @@ public: HDC getCompatibleHDC() { return mhCompatibleDC; } -/// Call the WinOpenGLSalGraphicsImpl's DrawMask(). -void DrawMask(SalColor color); +SalTwoRect getTwoRect() { return maRects; } + +/// Reset the DC with the defined color. +void fill(sal_uInt32 color); + +/// Obtain the texture; the caller must delete it after use. +OpenGLTexture* getTexture(); }; class WinSalGraphics : public SalGraphics @@ -177,9 +183,12 @@ class WinSalGraphics : public SalGraphics friend class WinSalGraphicsImpl; friend class ScopedFont; friend class OpenGLCompatibleDC; -private: +friend class WinLayout; + +protected: boost::scoped_ptrSalGraphicsImpl mpImpl; +private: HDC mhLocalDC; // HDC boolmbPrinter : 1; // is Printer boolmbVirDev : 1; // is VirDev diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index d011f31..678067d 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -601,18 +601,23 @@ OpenGLCompatibleDC::~OpenGLCompatibleDC() } } -void OpenGLCompatibleDC::DrawMask(SalColor color) +void OpenGLCompatibleDC::fill(sal_uInt32 color) { -if (!mpImpl) +if (!mpData) return; -// turn what's in the mpData into a texture -OpenGLTexture aTexture(maRects.mnSrcWidth, maRects.mnSrcHeight, GL_RGBA, GL_UNSIGNED_BYTE, mpData); -CHECK_GL_ERROR(); +sal_uInt32 *p = mpData; +for (int i = maRects.mnSrcWidth * maRects.mnSrcHeight; i 0; --i) +*p++ = color; +} -mpImpl-PreDraw(); -mpImpl-DrawMask(aTexture, color, maRects); -mpImpl-PostDraw(); +OpenGLTexture* OpenGLCompatibleDC::getTexture() +{ +if (!mpImpl) +return NULL; + +// turn what's in the mpData into a texture +return new OpenGLTexture(maRects.mnSrcWidth, maRects.mnSrcHeight, GL_RGBA, GL_UNSIGNED_BYTE, reinterpret_castsal_uInt8*(mpData)); } WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd): diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 8fcc16e..8c87710 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -35,6 +35,7 @@ #include osl/module.h +#include opengl/win/gdiimpl.hxx #include vcl/svapp.hxx #include vcl/settings.hxx @@ -1260,18 +1261,53 @@ bool WinSalGraphics::drawNativeControl( ControlType nType, rc.top= buttonRect.Top(); rc.bottom = buttonRect.Bottom()+1; -// set default text alignment -int ta = SetTextAlign( getHDC(), TA_LEFT|TA_TOP|TA_NOUPDATECP ); +OUString aCaptionStr(aCaption.replace('~', '')); // translate mnemonics -OUString aCaptionStr( aCaption.replace('~', '') ); // translate mnemonics -bOk = ImplDrawNativeControl(getHDC(), hTheme, rc, -nType, nPart, nState, aValue, -aCaptionStr ); +WinOpenGLSalGraphicsImpl *pImpl = dynamic_castWinOpenGLSalGraphicsImpl*(mpImpl.get()); +if (pImpl == NULL) +{ +// set default text alignment +int ta = SetTextAlign(getHDC(), TA_LEFT|TA_TOP|TA_NOUPDATECP); + +bOk = ImplDrawNativeControl(getHDC(), hTheme, rc, nType, nPart, nState, aValue, aCaptionStr); + +// restore alignment +SetTextAlign(getHDC(), ta); +} +else +{ +// We can do OpenGL +OpenGLCompatibleDC aBlackDC(*this, buttonRect.Left(), buttonRect.Top(),
[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source vcl/uiconfig vcl/UIConfig_vcl.mk
include/vcl/prgsbar.hxx|3 vcl/UIConfig_vcl.mk|3 vcl/inc/printdlg.hxx | 15 +--- vcl/inc/svids.hrc |4 - vcl/source/control/prgsbar.cxx |7 +- vcl/source/src/print.src | 25 --- vcl/source/window/printdlg.cxx | 108 +++-- vcl/uiconfig/ui/printprogressdialog.ui | 87 ++ 8 files changed, 127 insertions(+), 125 deletions(-) New commits: commit 3e978fc21f2d924dab3d714956944a27e70d606f Author: Caolán McNamara caol...@redhat.com Date: Mon Dec 23 19:25:30 2013 + convert print progress dialog to .ui use an actual ProgressBar rather than direct drawing into the dialog window Change-Id: I13a17970055980e0e248f60058cd4d5ef91f1d7d diff --git a/vcl/UIConfig_vcl.mk b/vcl/UIConfig_vcl.mk index d3e901e..d37c985 100644 --- a/vcl/UIConfig_vcl.mk +++ b/vcl/UIConfig_vcl.mk @@ -10,9 +10,10 @@ $(eval $(call gb_UIConfig_UIConfig,vcl)) $(eval $(call gb_UIConfig_add_uifiles,vcl,\ - vcl/uiconfig/ui/printdialog \ vcl/uiconfig/ui/errornocontentdialog \ vcl/uiconfig/ui/errornoprinterdialog \ + vcl/uiconfig/ui/printdialog \ + vcl/uiconfig/ui/printprogressdialog \ )) # vim: set noet sw=4 ts=4: diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx index 3b07b6b..e142f0a 100644 --- a/vcl/inc/printdlg.hxx +++ b/vcl/inc/printdlg.hxx @@ -30,6 +30,7 @@ #include vcl/button.hxx #include vcl/gdimtf.hxx #include vcl/lstbox.hxx +#include vcl/prgsbar.hxx #include vcl/field.hxx #include vcl/tabctrl.hxx #include vcl/tabpage.hxx @@ -271,29 +272,23 @@ namespace vcl class PrintProgressDialog : public ModelessDialog { OUStringmaStr; -FixedText maText; -CancelButtonmaButton; +FixedText* mpText; +ProgressBar*mpProgress; +CancelButton* mpButton; boolmbCanceled; sal_Int32 mnCur; sal_Int32 mnMax; -longmnProgressHeight; -Rectangle maProgressRect; -boolmbNativeProgress; DECL_LINK( ClickHdl, Button* ); -void implCalcProgressRect(); public: -PrintProgressDialog( Window* i_pParent, int i_nMax ); -~PrintProgressDialog(); +PrintProgressDialog(Window* i_pParent, int i_nMax); bool isCanceled() const { return mbCanceled; } void setProgress( int i_nCurrent, int i_nMax = -1 ); void tick(); void reset(); - -virtual void Paint( const Rectangle ); }; } diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc index eb16740..f3c3f4d 100644 --- a/vcl/inc/svids.hrc +++ b/vcl/inc/svids.hrc @@ -115,10 +115,6 @@ #define SV_PRINT_OPT_TOFILE 2 #define SV_PRINT_OPT_SINGLEJOBS 3 -#define SV_DLG_PRINT_PROGRESS 2049 -#define SV_PRINT_PROGRESS_CANCEL1 -#define SV_PRINT_PROGRESS_TEXT 2 - #define SV_PRINT_NATIVE_STRINGS 2050 #define SV_HELPTEXT_CLOSE 1 diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 0d2f9c1..4bfa750 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -19,31 +19,6 @@ #include svids.hrc -ModelessDialog SV_DLG_PRINT_PROGRESS -{ -HelpID = vcl:ModelessDialog:SV_DLG_PRINT_PROGRESS; -Text [en-US] = Printing; -Closeable = FALSE; -Sizeable = FALSE; -Moveable = TRUE; -SVLook = TRUE; - -Size = MAP_APPFONT( 120, 70 ); - -CancelButton SV_PRINT_PROGRESS_CANCEL -{ -Pos = MAP_APPFONT( 35, 50 ); -Size = MAP_APPFONT( 50, 15 ); -}; -FixedText SV_PRINT_PROGRESS_TEXT -{ -Pos = MAP_APPFONT( 5,10 ); -Size = MAP_APPFONT( 110, 10 ); -Text [ en-US ] = Page %p of %n; -Center = TRUE; -}; -}; - StringArray SV_PRINT_NATIVE_STRINGS { ItemList [en-US] = diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 21941ca..c44dee7 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -1842,63 +1842,46 @@ void PrintDialog::previewBackward() // // - -PrintProgressDialog::PrintProgressDialog( Window* i_pParent, int i_nMax ) : -ModelessDialog( i_pParent, VclResId( SV_DLG_PRINT_PROGRESS ) ), -maText( this, VclResId( SV_PRINT_PROGRESS_TEXT ) ), -maButton( this, VclResId( SV_PRINT_PROGRESS_CANCEL ) ), -mbCanceled( false ), -mnCur( 0 ), -mnMax( i_nMax ), -mnProgressHeight( 15 ), -mbNativeProgress( false ) -{ -FreeResource(); +PrintProgressDialog::PrintProgressDialog(Window* i_pParent, int i_nMax) +: ModelessDialog(i_pParent, PrintProgressDialog, +vcl/ui/printprogressdialog.ui)
[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/inc vcl/source
include/vcl/combobox.hxx|5 ++-- include/vcl/lstbox.hxx |4 ++- include/vcl/menu.hxx|9 +++ vcl/inc/ilstbox.hxx | 14 ++- vcl/source/control/combobox.cxx | 12 +- vcl/source/control/edit.cxx | 31 - vcl/source/control/ilstbox.cxx | 21 + vcl/source/control/lstbox.cxx | 33 +++ vcl/source/control/morebtn.cxx |5 +--- vcl/source/control/tabctrl.cxx |3 -- vcl/source/window/btndlg.cxx|7 + vcl/source/window/dlgctrl.cxx | 10 ++-- vcl/source/window/menu.cxx | 48 +++- vcl/source/window/toolbox.cxx |5 +++- vcl/source/window/toolbox2.cxx |3 +- 15 files changed, 177 insertions(+), 33 deletions(-) New commits: commit 79c0027c88fb64ffa7bbefcab2e291852733c223 Author: Steve Yin stev...@apache.org Date: Mon Nov 25 13:15:27 2013 + Integrate branch of IAccessible2 Change-Id: I8c2fea0367ebfa53ce5e109ef48fd661cbfb78b3 diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index 6f9c534..76533ab 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -74,6 +74,7 @@ private: DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, void* ); DECL_DLLPRIVATE_LINK( ImplUserDrawHdl, UserDrawEvent* ); DECL_DLLPRIVATE_LINK( ImplAutocompleteHdl, Edit* ); +DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* ); protected: using Window::ImplInit; @@ -178,8 +179,8 @@ public: voidSetMRUEntries( const OUString rEntries, sal_Unicode cSep = ';' ); OUStringGetMRUEntries( sal_Unicode cSep = ';' ) const; voidSetMaxMRUCount( sal_uInt16 n ); -sal_uInt16 GetMaxMRUCount() const; - +sal_uInt16 GetMaxMRUCount() const; +sal_uInt16 GetMRUCount() const; voidSetEntryData( sal_uInt16 nPos, void* pNewData ); void* GetEntryData( sal_uInt16 nPos ) const; diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx index 6b3ab8c..cc63c2f 100644 --- a/include/vcl/lstbox.hxx +++ b/include/vcl/lstbox.hxx @@ -63,7 +63,8 @@ private: DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, void* ); DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, void* ); DECL_DLLPRIVATE_LINK( ImplUserDrawHdl, UserDrawEvent* ); - +DECL_DLLPRIVATE_LINK( ImplFocusHdl, void* ); +DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl, void* ); protected: using Window::ImplInit; SAL_DLLPRIVATE voidImplInit( Window* pParent, WinBits nStyle ); @@ -198,6 +199,7 @@ public: SizeCalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const; voidGetMaxVisColumnsAndLines( sal_uInt16 rnCols, sal_uInt16 rnLines ) const; +sal_uInt16 GetMRUCount() const; sal_uInt16 GetDisplayLineCount() const; voidEnableMirroring(); diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 637c701..5131872 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -134,6 +134,8 @@ private: sal_uInt16 nDefaultItem; // Id of default item sal_uInt16 nSelectedId; +sal_uInt16 nHighlightedItem; + // for output: sal_uInt16 nImgOrChkPos; sal_uInt16 nTextPos; @@ -234,6 +236,13 @@ public: sal_uInt16 GetCurItemId() const; OString GetCurItemIdent() const; +voidSetHightlightItem(sal_uInt16 nHighlightedItem); +sal_uInt16 GetHighlightItem() const; + +OUStringGetItemAccKeyStrFromPos(sal_uInt16 nPos) const; + +sal_BoolIsTemporaryItemFromPos(sal_uInt16 nPos) const; + voidSetDefaultItem( sal_uInt16 nItemId ){ nDefaultItem = nItemId; } sal_uInt16 GetDefaultItem() const { return nDefaultItem; } diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx index 315f4ce..18dfee8 100644 --- a/vcl/inc/ilstbox.hxx +++ b/vcl/inc/ilstbox.hxx @@ -253,6 +253,8 @@ private: LinkmaDoubleClickHdl; LinkmaUserDrawHdl; LinkmaMRUChangedHdl; +LinkmaFocusHdl; +LinkmaListItemSelectHdl; ::vcl::QuickSelectionEngine maQuickSelectionEngine; @@ -266,7 +268,7 @@ protected: virtual voidGetFocus(); virtual voidLoseFocus(); -sal_BoolSelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False ); +sal_BoolSelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False, sal_Bool bSelectPosChange = sal_False ); voidImplPaint( sal_uInt16 nPos, sal_Bool bErase = sal_False, bool bLayout = false ); voidImplDoPaint( const Rectangle rRect,