Files
Paolo Benvenuto 52010fde09 tdf#89826 Add interactive property chips to style Organizer tab
The Organizer tab of the style dialog now shows interactive "chips"
for each property that differs from the parent style. Each chip
displays the property name and value, and includes an X button to
reset that property back to parent inheritance. All properties
are shown full text, no ellipsis.

Properties are grouped by tab page (Font, Font effects, etc.)
and displayed in a scrollable area. A View/Edit toggle lets the
user switch between the traditional description text and the
interactive chip view.

Implementation summary:

- New PropertyChip and PropertyCategoryRow widgets (sfx2) with
  corresponding .ui files for the chip layout.

- SfxStyleSheetBase::GetItemPresentation() virtual method returns
  per-property presentation strings, overridden in SwDocStyleSheet
  and ScStyleSheet for module-specific attributes.

- SfxItemSet access tracker mechanism to automatically map WhichIds
  to their owning tab pages via BuildWhichToTabMap().

- SfxTabDialogController::InvalidateItem() propagates chip resets
  to the output set and affected tab pages.

- SwDocStyleSheet::ResetItems() uses SwDoc::ResetAttrAtFormat() to
  ensure proper undo support in Writer.

- SfxStyleDialogController::Ok() clears invalidated items from the
  style's item set on dialog confirmation.

- SvxAsianTabPage now calls SetExchangeSupport() and implements
  DeactivatePage() so its items are properly tracked.

- Access tracker ignore guards in SvxCharBasePage::SetPrevFontWidthScale
  and SvxTransparenceTabPage::InitPreview to avoid false positives
  from preview-only item access.

Includes a UITest for Writer (sw/qa/uitest/ui/fmtui/tdf89826.py)
that creates a child style, modifies a property, removes it via
chip, and verifies inheritance is restored including undo.

A Calc UITest is not included because the style edit dialog in Calc
is opened asynchronously (ScTabViewShell::ExecuteStyleEdit) and the
UITest framework's execute_dialog_through_command cannot capture it.
The Calc functionality has been verified manually. A Calc UITest can
be added once the framework supports async style dialogs.

Change-Id: Ia764405798c212fe5340bba254f2ff6ac62365f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199318
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
2026-02-28 15:52:40 +01:00

75 lines
2.6 KiB
C++

/* -*- 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 .
*/
#pragma once
#include <svl/style.hxx>
#include "scdllapi.h"
class ScStyleSheetPool;
class SAL_DLLPUBLIC_RTTI ScStyleSheet final : public SfxStyleSheet
{
friend class ScStyleSheetPool;
public:
enum class Usage
{
UNKNOWN,
USED,
NOTUSED
};
ScStyleSheet( const ScStyleSheet& rStyle );
virtual bool SetParent ( const OUString& rParentName ) override;
SC_DLLPUBLIC void ResetParent();
SC_DLLPUBLIC virtual SfxItemSet& GetItemSet() override;
virtual bool IsUsed () const override;
virtual bool HasFollowSupport () const override;
virtual bool HasParentSupport () const override;
virtual bool SetName(const OUString& rNewName, bool bReindexNow = true) override;
void SetUsage( ScStyleSheet::Usage eUse ) const { eUsage = eUse; }
ScStyleSheet::Usage GetUsage() const { return eUsage; }
/// Fix for expensive dynamic_cast
virtual bool isScStyleSheet() const override { return true; }
virtual std::vector<std::pair<sal_uInt16, OUString>> GetItemPresentation(
MapUnit eMetric, const SfxItemSet* pWorkingSet = nullptr) override;
private:
virtual ~ScStyleSheet() override;
ScStyleSheet( const OUString& rName,
const ScStyleSheetPool& rPool,
SfxStyleFamily eFamily,
SfxStyleSearchBits nMask,
const OUString& rParentStyleSheetName );
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
mutable ScStyleSheet::Usage eUsage;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */