/* -*- 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_SW_INC_FMTFLD_HXX #define INCLUDED_SW_INC_FMTFLD_HXX #include #include #include #include "swdllapi.h" #include "calbck.hxx" class SwField; class SwTextField; class SwView; class SwFieldType; namespace com { namespace sun { namespace star { namespace text { class XTextField; } } } } // ATT_FLD class SW_DLLPUBLIC SwFormatField final : public SfxPoolItem , public sw::BroadcastingModify , public SfxBroadcaster { friend void InitCore(); SwFormatField( sal_uInt16 nWhich ); // for default-Attribute css::uno::WeakReference m_wXTextField; std::unique_ptr mpField; SwTextField* mpTextField; // the TextAttribute virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; virtual void SwClientNotify( const SwModify& rModify, const SfxHint& rHint ) override; public: /// Single argument constructors shall be explicit. explicit SwFormatField( const SwField &rField ); SwFormatField( const SwFormatField& rAttr ); virtual ~SwFormatField() override; /// "Pure virtual methods" of SfxPoolItem. virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override; virtual bool GetInfo( SfxPoolItem& rInfo ) const override; void InvalidateField(); const SwField* GetField() const { return mpField.get(); } SwField* GetField() { return mpField.get(); } /** Sets current field. @param pField new field @attention The current field will be destroyed before setting the new field. */ void SetField( std::unique_ptr pField ); const SwTextField* GetTextField() const { return mpTextField; } SwTextField* GetTextField() { return mpTextField; } void SetTextField( SwTextField& rTextField ); void ClearTextField(); void RegisterToFieldType( SwFieldType& ); bool IsFieldInDoc() const; bool IsProtect() const; SAL_DLLPRIVATE css::uno::WeakReference const& GetXTextField() const { return m_wXTextField; } SAL_DLLPRIVATE void SetXTextField(css::uno::Reference const& xTextField) { m_wXTextField = xTextField; } void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; enum class SwFormatFieldHintWhich { INSERTED = 1, REMOVED = 2, FOCUS = 3, CHANGED = 4, LANGUAGE = 5, RESOLVED = 6 }; class SW_DLLPUBLIC SwFormatFieldHint final : public SfxHint { const SwFormatField* m_pField; SwFormatFieldHintWhich const m_nWhich; const SwView* m_pView; public: SwFormatFieldHint( const SwFormatField* pField, SwFormatFieldHintWhich nWhich, const SwView* pView = nullptr) : m_pField(pField) , m_nWhich(nWhich) , m_pView(pView) {} const SwFormatField* GetField() const { return m_pField; } SwFormatFieldHintWhich Which() const { return m_nWhich; } const SwView* GetView() const { return m_pView; } }; #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 6.0 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-10-17tdf#34804 sw: enable keyboard shortcut for CharColor and CharBackColorJustin Luth
The result of this patch is that a keyboard shortcut can now set the font fore-/back-ground color using the color shown in the toolbar/sidebar. This is now possible thanks to Maxim's work in 7.6.2 tdf#154270 Sync toolbar button recent colors and Andreas Heinisch's 24.8 commit 8c822b764b35a0116a0865e991a87c8315e0 tdf#72991 - Remember last used color depending in cui This patch does 3 things: 1. SetRecentColor when the app initializes 2. Uses SID_ATTR_CHAR_COLOR's recentColor for .uno:FontColor if no pItem was provided (i.e. a keyboard shortcut called it) 3. Uses SID_ATTR_CHAR_BACK_COLOR's recentColor for .uno:CharBackColor if no pItem was provided (Note that without a selection, CharBackColor isn't so useful for a keyboard shortcut, since it turns the drag-and-drop template on.) Setting the recent color right away is critical for user acceptance. Otherwise, it would only function after they first modified the color in the toolbar/sidebar. make CppunitTest_sw_uiwriter9 CPPUNIT_TEST_NAME=testTdf34804 Unfortunately, I can't reliably know if this request came from an awt::KeyEvent or not, because in that case we could just avoid CharBackColor's template altogether. [While there is rReq.GetModifiers() as a good hint, it is not a guarantee (in case assigned to a function key, or CTRL held while clicking the toolbar, etc.)] Change-Id: I7377f087dcdf7011205af005cd0d172100bade2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174804 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2023-12-30tdf#146619 Recheck svx/ with IWYUGabor Kelemen
Change-Id: I99650b50587294c20b1e92270e541140d9ec9cae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161240 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-07-04tdf#154270 Sync toolbar button recent colorsMaxim Monastirsky
As the last used color is stored per button instance, these will go out of sync with several buttons being visible (e.g. a toolbar and a sidebar, or a toolbar overflow popup), and will reset whenever the toolbar resets (e.g. change in selection, switch from print preview, or customization). Fix that by storing the last colors per-document, and notifying other buttons on changes. Keep the last color also stored per-button for now, as a fallback for reportdesign (which isn't sfx2 based). Change-Id: I866f1de5c8ff6f56c47dc4b6b5acf52957d4e6c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153943 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
2023-04-02Avoid conversions between OUString and OString in VCLMike Kaganski
Standardize on OUString, which is the main internal string class. Convert from/to OUString only when communicating with respective external APIs. Removes about 200 conversions from the code. Change-Id: I96ecee7c6fd271bb76639220e96d69d2964bed26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149930 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-11-11Resolves: tdf#151898 get hidpi font/highlight color iconsCaolán McNamara
Most of this wouldn't be necessary if we could solve the split alpha problem. In the meantime, let Image take a MetaFile as an arg, record what we want to do in the metafile, and play it back when we need to generate the bitmap for to render the image. That way we don't have alpha to worry about during the recording, and we only have one alpha in the final rendering, as opposed to having two alphas in a source and in destination VirtualDevice, which is problematic in most backends. Change-Id: I5b0d7c498473271f4ab2743f75614b1b93a0e9c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142593 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-07-21clang-tidy modernize-pass-by-value in svxNoel Grandin
Change-Id: Iedd87d321f4d161574df87629fdd6c7714ff31c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137248 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-03Recheck modules sv* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I25779cbfb1aa93c31d6e12ac95e136b3bdbbc058 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130403 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-26move ToolBoxItemId into its own headerCaolán McNamara
Change-Id: I34838bee7ad27bfd60d92c26af7eb2de508686b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128974 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-25loplugin:finalclasses in svxNoel Grandin
Change-Id: I7dd8d1a900694687fbed3f3f29b0ea4bb11b7d72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117790 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-03-11use strong_int for item ids in vcl::ToolBoxNoel
(*) fix bug in SfxToolBoxControl::StateChanged where it was using the slot id instead of the toolbox item id (*) I left the logic in SbaTableQueryBrowser alone, but it looks suspicious, casting slot ids to toolbox ids Change-Id: Ied229164c27fb4456b0515c6fdcbd1682766a1a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112186 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-06loplugin:const* make some params and methods constNoel
Change-Id: Idec482c21c270912f9bcaeb980077c1616f67c8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104022 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-03tdf#42949 Fix IWYU warnings in include/[t-x]*/*hxxGabor Kelemen
Recheck after 7-0 branchoff Also drop the now unused file include/vcl/field.hxx Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I9e54c82f50d1e02a0f99858939cac999fc66f7de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99261 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-07-28tdf#135121 ImageType::Size26 isn't always 26x26pxCaolán McNamara
so use ImageType just to detect the user has selected a new size, and use the size of the returned image for the icon pixel size Change-Id: If101c586bd2f0d83f668637b48ce3d25a0873358 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99561 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-06move headers inside modulesNoel Grandin
Change-Id: I002f42d83820c86737ddceab805aa53ccb388e06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98203 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>