/* -*- 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/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_VCL_INC_SALLAYOUT_HXX #define INCLUDED_VCL_INC_SALLAYOUT_HXX #include #include #include #include #include #include #include #include #include #include #include // for typedef sal_UCS4 #include #include #include "impglyphitem.hxx" #define MAX_FALLBACK 16 class SalGraphics; class PhysicalFontFace; class GenericSalLayout; enum class SalLayoutFlags; namespace vcl { class TextLayoutCache; } // used for managing runs e.g. for BiDi, glyph and script fallback class VCL_PLUGIN_PUBLIC ImplLayoutRuns { private: int mnRunIndex; std::vector maRuns; public: ImplLayoutRuns() { mnRunIndex = 0; maRuns.reserve(8); } void Clear() { maRuns.clear(); } void AddPos( int nCharPos, bool bRTL ); void AddRun( int nMinRunPos, int nEndRunPos, bool bRTL ); bool IsEmpty() const { return maRuns.empty(); } void ResetPos() { mnRunIndex = 0; } void NextRun() { mnRunIndex += 2; } bool GetRun( int* nMinRunPos, int* nEndRunPos, bool* bRTL ) const; bool GetNextPos( int* nCharPos, bool* bRTL ); bool PosIsInRun( int nCharPos ) const; bool PosIsInAnyRun( int nCharPos ) const; }; class ImplLayoutArgs { public: // string related inputs LanguageTag const maLanguageTag; SalLayoutFlags mnFlags; const OUString& mrStr; int const mnMinCharPos; int const mnEndCharPos; // performance hack vcl::TextLayoutCache const* m_pTextLayoutCache; // positioning related inputs const DeviceCoordinate* mpDXArray; // in pixel units DeviceCoordinate mnLayoutWidth; // in pixel units int mnOrientation; // in 0-3600 system // data for bidi and glyph+script fallback ImplLayoutRuns maRuns; ImplLayoutRuns maFallbackRuns; ImplLayoutArgs( const OUString& rStr, int nMinCharPos, int nEndCharPos, SalLayoutFlags nFlags, const LanguageTag& rLanguageTag, vcl::TextLayoutCache const* pLayoutCache); void SetLayoutWidth( DeviceCoordinate nWidth ) { mnLayoutWidth = nWidth; } void SetDXArray( const DeviceCoordinate* pDXArray ) { mpDXArray = pDXArray; } void SetOrientation( int nOrientation ) { mnOrientation = nOrientation; } void ResetPos() { maRuns.ResetPos(); } bool GetNextPos( int* nCharPos, bool* bRTL ) { return maRuns.GetNextPos( nCharPos, bRTL ); } bool GetNextRun( int* nMinRunPos, int* nEndRunPos, bool* bRTL ); void NeedFallback( int nMinRunPos, int nEndRunPos, bool bRTL ) { maFallbackRuns.AddRun( nMinRunPos, nEndRunPos, bRTL ); } // methods used by BiDi and glyph fallback bool NeedFallback() const { return !maFallbackRuns.IsEmpty(); } bool PrepareFallback(); private: void AddRun( int nMinCharPos, int nEndCharPos, bool bRTL ); }; // For nice SAL_INFO logging of ImplLayoutArgs values std::ostream &operator <<(std::ostream& s, ImplLayoutArgs const &rArgs); class VCL_PLUGIN_PUBLIC MultiSalLayout final : public SalLayout { public: void DrawText(SalGraphics&) const override; sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override; DeviceCoordinate FillDXArray(DeviceCoordinate* pDXArray) const override; void GetCaretPositions(int nArraySize, long* pCaretXArray) const override; bool GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& nStart, const PhysicalFontFace** pFallbackFont = nullptr, int* const pFallbackLevel = nullptr) const override; bool GetOutline(basegfx::B2DPolyPolygonVector&) const override; bool IsKashidaPosValid(int nCharPos) const override; // used only by OutputDevice::ImplLayout, TODO: make friend explicit MultiSalLayout( std::unique_ptr pBaseLayout ); void AddFallback(std::unique_ptr pFallbackLayout, ImplLayoutRuns const &); bool LayoutText(ImplLayoutArgs&, const SalLayoutGlyphs*) override; void AdjustLayout(ImplLayoutArgs&) override; void InitFont() const override; void SetIncomplete(bool bIncomplete); public: virtual ~MultiSalLayout() override; private: MultiSalLayout( const MultiSalLayout& ) = delete; MultiSalLayout& operator=( const MultiSalLayout& ) = delete; std::unique_ptr mpLayouts[ MAX_FALLBACK ]; ImplLayoutRuns maFallbackRuns[ MAX_FALLBACK ]; int mnLevel; bool mbIncomplete; }; class VCL_PLUGIN_PUBLIC GenericSalLayout : public SalLayout { friend void MultiSalLayout::AdjustLayout(ImplLayoutArgs&); public: GenericSalLayout(LogicalFontInstance&); ~GenericSalLayout() override; void AdjustLayout(ImplLayoutArgs&) final override; bool LayoutText(ImplLayoutArgs&, const SalLayoutGlyphs*) final override; void DrawText(SalGraphics&) const final override; std::shared_ptr CreateTextLayoutCache(OUString const&) const final override; const SalLayoutGlyphs* GetGlyphs() const final override; bool IsKashidaPosValid(int nCharPos) const final override; // used by upper layers DeviceCoordinate GetTextWidth() const final override; DeviceCoordinate FillDXArray(DeviceCoordinate* pDXArray) const final override; sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const final override; void GetCaretPositions(int nArraySize, long* pCaretXArray) const final override; // used by display layers LogicalFontInstance& GetFont() const { return static_cast(m_GlyphItems.Impl())->GetFont(); } bool GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& nStart, const PhysicalFontFace** pFallbackFont = nullptr, int* const pFallbackLevel = nullptr) const override; private: // for glyph+font+script fallback void MoveGlyph(int nStart, long nNewXPos); void DropGlyph(int nStart); void Simplify(bool bIsBase); GenericSalLayout( const GenericSalLayout& ) = delete; GenericSalLayout& operator=( const GenericSalLayout& ) = delete; void ApplyDXArray(ImplLayoutArgs&); void Justify(DeviceCoordinate nNewWidth); void ApplyAsianKerning(const OUString& rStr); void GetCharWidths(DeviceCoordinate* pCharWidths) const; void SetNeedFallback(ImplLayoutArgs&, sal_Int32, bool); bool HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aNextChar); void ParseFeatures(const OUString& name); css::uno::Reference mxBreak; SalLayoutGlyphs m_GlyphItems; OString msLanguage; std::vector maFeatures; hb_set_t* mpVertGlyphs; const bool mbFuzzing; }; #undef SalGraphics #endif // INCLUDED_VCL_INC_SALLAYOUT_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ .4 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-09-03tdf#162764: make the two dialogs modalXisco Fauli
Change-Id: I4df5b44793487dbcb9f48c77d7f7835108cdc3fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172797 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2021-01-15replace stock button labelsCaolán McNamara
Change-Id: I726ba7846322863d9f38314b6c6ccc7f71124a0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109197 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-11-15add <!-- n-columns=1 n-rows=1 --> before every GtkGridCaolán McNamara
for a in `git ls-files '*.ui'`; do sed -i 's/^\( *\)\(<object class="GtkGrid".*\)/\1<!-- n-columns=1 n-rows=1 -->\n\1\2/' $a; done so we get the same behavior in glade as before 3.38 in that the grid preview don't show any unoccupied grid squares replace all existing n-columns=X n-rows=Y lines because they are all wrong, except for cui/uiconfig/ui/additionsfragment.ui sw/uiconfig/swriter/ui/pageheaderpanel.ui sw/uiconfig/swriter/ui/pagefooterpanel.ui which are correct. Change-Id: I401bbe8e098c26e7f57d6a872d3b70fc1ce85a00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105846 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-10-22set all .ui min require version of gtk to 3.20Caolán McNamara
and update the version mentioned in our min req in the readme.xrm follow up to commit 0c9ccc7dbf6deb4d012e0d1e6eb934e54e0f19bc Author: Caolán McNamara <caolanm@redhat.com> Date: Fri Oct 2 21:21:45 2020 +0100 raise min version of gtk to 3.20.0 Change-Id: Ibae55c97e1ee577f4b7435d124cda6a21005ad0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104692 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2019-05-18remove remaining '0' responsesCaolán McNamara
Change-Id: I3134c8dcc92b82ab2c6008b3e39443a360f576eb Reviewed-on: https://gerrit.libreoffice.org/72499 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-10-02make all notebooks scrollable and enable_popupCaolán McNamara
Change-Id: I16a6d556ca4c6b3f876dc0c8380d01fe3022209e Reviewed-on: https://gerrit.libreoffice.org/61195 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-09-18weld TextControlCharAttribDialog and TextControlParaAttribDialogCaolán McNamara
Change-Id: Id90967c9be1a56535aac3900a0cc2555ed8f9600 Reviewed-on: https://gerrit.libreoffice.org/60583 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-05Resolves: tdf#116188 set min version on all .ui files to 3.18Caolán McNamara
which is already the min for the runtime Change-Id: Ifebe099f1f94a36f65a31989689400327a823dcd Reviewed-on: https://gerrit.libreoffice.org/50776 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-02-25convert all help responses to gtk's -11Caolán McNamara
and ok responses to gtk's -5 and cancel responses to gtk's -6 and close responses to gtk's -7 and yes responses to gtk's -8 and no responses to gtk's -9 Change-Id: Ia1a261a3a711ed9f5d8c0b0c639897c3064bb08c Reviewed-on: https://gerrit.libreoffice.org/50206 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-10-17turn implicit container explicit in buildable notebooksCaolán McNamara
as in interim measure for SfxTabDialogs we throw away the TabPage if its not suitable for reuse Change-Id: Ic5776ca3d2a8cb6bf41f33df01b211f81c62a842 Reviewed-on: https://gerrit.libreoffice.org/43134 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-07-21migrate to boost::gettextCaolán McNamara
* all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl * all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string") * ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching MODULE .mo files * UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui goes from l10n target to normal one, so the res/lang.zips of UI files go away * translation via Translation::get(hrc-define-key, imbued-std::locale) * python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there to keep finding the .hrc file uniform) so magic numbers can go away there * java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation mechanism * en-US res files go away, their strings are now the .hrc keys in the source code * remaining .res files are replaced by .mo files * in .res/.ui-lang-zip files, the old scheme missing translations of strings results in inserting the english original so something can be found, now the standard fallback of using the english original from the source key is used, so partial translations shrink dramatically in size * extract .hrc strings with hrcex which backs onto xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap * extract .ui strings with uiex which backs onto xgettext --add-comments --no-wrap * qtz for gettext translations is generated at runtime as ascii-ified crc32 of content + "|" + msgid * [API CHANGE] remove deprecated binary .res resouce loader related uno apis com::sun::star::resource::OfficeResourceLoader com::sun::star::resource::XResourceBundleLoader com::sun::star::resource::XResourceBundle when translating strings via uno apis com.sun.star.resource.StringResourceWithLocation can continue to be used Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a
2014-11-05HIG fixes for svxAdolfo Jayme Barrientos
* Standardize spacing * Add missing colons to labels that precede controls (fdo#78826) * Disable manual resizing where it doesn’t make sense * Standardize Help button’s position (fdo#76486) * Remove unhelpful frames Change-Id: I53ffb47fbd4da62e92341ced3772c2d1ee83e0f8 Reviewed-on: https://gerrit.libreoffice.org/12260 Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com> Tested-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
2013-12-24convert text control character dialog to .uiCaolán McNamara
Change-Id: I4f8301578e01d3c7bf0ea912a5a9fc0beac70b4f