diff options
44 files changed, 153 insertions, 144 deletions
diff --git a/chart2/source/controller/inc/TabPageNotifiable.hxx b/chart2/source/controller/inc/TabPageNotifiable.hxx index c0b53972e546..16450f28f781 100644 --- a/chart2/source/controller/inc/TabPageNotifiable.hxx +++ b/chart2/source/controller/inc/TabPageNotifiable.hxx @@ -20,11 +20,6 @@ #include <sal/types.h> -// color to use as foreground for an invalid range -#define RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR COL_WHITE -// color to use as background for an invalid range -#define RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR Color(0xff6563) - class BuilderPage; namespace chart diff --git a/dbaccess/source/ui/app/DocumentInfoPreview.cxx b/dbaccess/source/ui/app/DocumentInfoPreview.cxx index ed7f9f862c97..f12de3fbe515 100644 --- a/dbaccess/source/ui/app/DocumentInfoPreview.cxx +++ b/dbaccess/source/ui/app/DocumentInfoPreview.cxx @@ -119,7 +119,7 @@ namespace void ODocumentInfoPreview::insertEntry( std::u16string_view title, OUString const & value) { - if (!m_xEditEngine->GetText().isEmpty()) { + if (m_xEditEngine->HasText()) { m_xEditEngine->QuickInsertText(u"\n\n"_ustr, InsertAtEnd(*m_xEditEngine)); } diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx index 985a586c7fe3..b416acfe2279 100644 --- a/editeng/inc/editattr.hxx +++ b/editeng/inc/editattr.hxx @@ -52,7 +52,6 @@ class OutputDevice; class SvxCaseMapItem; class SfxGrabBagItem; -#define CH_FEATURE_OLD (sal_uInt8) 0xFF #define CH_FEATURE u'\x0001' #define CH_SOFTHYPHEN u'\x00AD' @@ -61,8 +60,6 @@ class SfxGrabBagItem; // => To determine the DefMetric simply use GetMetric(0) #define DEF_METRIC 0 - - // bFeature: Attribute must not expand/shrink, length is always 1 // bEdge: Attribute will not expand, if you want to expand just on the edge class EditCharAttrib diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index a76d50855d9c..8f722c660c6a 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -88,9 +88,6 @@ namespace editeng { #define MAXCHARSINPARA 0x3FFF-CHARPOSGROW // Max 16K, because WYSIWYG array #define LINE_SEP '\x0A' -#define ATTRSPECIAL_WHOLEWORD 1 -#define ATTRSPECIAL_EDGE 2 - struct CursorFlags { bool bTextOnly : 1 = false; diff --git a/extensions/inc/strings.hrc b/extensions/inc/strings.hrc index a14f66ef78a2..17e2ad7caa76 100644 --- a/extensions/inc/strings.hrc +++ b/extensions/inc/strings.hrc @@ -253,7 +253,7 @@ #define RID_STR_HEADERBACKGROUNDCOLOR NC_("RID_STR_HEADERBACKGROUNDCOLOR", "Header background color") #define RID_STR_HEADERTEXTCOLOR NC_("RID_STR_HEADERTEXTCOLOR", "Header text color") #define RID_STR_ACTIVESELECTIONBACKGROUNDCOLOR NC_("RID_STR_ACTIVESELECTIONBACKGROUNDCOLOR", "Active selection background color") -#define RID_STR_ACTIVESELECTIONTEXTCOLOR NC_("ID_STR_ACTIVESELECTIONTEXTCOLOR", "Active selection text color") +#define RID_STR_ACTIVESELECTIONTEXTCOLOR NC_("RID_STR_ACTIVESELECTIONTEXTCOLOR", "Active selection text color") #define RID_STR_INACTIVESELECTIONBACKGROUNDCOLOR NC_("RID_STR_INACTIVESELECTIONBACKGROUNDCOLOR", "Inactive selection background color") #define RID_STR_INACTIVESELECTIONTEXTCOLOR NC_("RID_STR_INACTIVESELECTIONTEXTCOLOR", "Inactive selection text color") #define RID_STR_STANDARD NC_("RID_STR_STANDARD", "Default") diff --git a/filter/source/config/cache/constant.hxx b/filter/source/config/cache/constant.hxx index a371fccf406e..b2d53224a3be 100644 --- a/filter/source/config/cache/constant.hxx +++ b/filter/source/config/cache/constant.hxx @@ -86,7 +86,6 @@ inline constexpr OUString CFGSET_CONTENTHANDLERS = u"ContentHandlers"_ustr; */ inline constexpr OUString CFGDIRECTKEY_OFFICELOCALE = u"/org.openoffice.Setup/L10N/ooLocale"_ustr; inline constexpr OUString CFGDIRECTKEY_DEFAULTFRAMELOADER = u"/org.openoffice.TypeDetection.Misc/Defaults/DefaultFrameLoader"_ustr; -#define CFGDIRECTKEY_PRODUCTNAME "/org.openoffice.Setup/Product/ooName" // Note that these flag bits have parallel names in // comphelper/inc/comphelper/documentconstants.hxx . See that file for diff --git a/filter/source/graphicfilter/icgm/chart.hxx b/filter/source/graphicfilter/icgm/chart.hxx index ef77ace0e22f..3a8e8d946382 100644 --- a/filter/source/graphicfilter/icgm/chart.hxx +++ b/filter/source/graphicfilter/icgm/chart.hxx @@ -24,14 +24,6 @@ #include <memory> #include <vector> -/* FILE TYPE CONSTANTS: */ -#define BULCHART 32 /* Bullet chart file. */ -/* the following were added although SPC doesn't have a #define */ -/* for them... */ -#define AUTOTTLCHT 95 /* Autobuild TTL CHT */ -#define AUTOBULCHT 96 /* Autobuild BUL CHT */ -#define AUTOTABCHT 97 /* Autobuild TAB CHT */ - typedef struct TextEntry { sal_uInt16 nTypeOfText; diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 916bd9d263ad..29b0a7d29374 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -51,8 +51,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star; using namespace ::com::sun::star::xml::sax; -#define SVG_EXPORT_ALLPAGES ((sal_Int32)-1) - namespace com::sun::star::frame { class XController; } // Placeholder tag used into the ImplWriteActions method to filter text placeholder fields diff --git a/framework/inc/protocols.h b/framework/inc/protocols.h index bbadb7e71888..7ba3d41de394 100644 --- a/framework/inc/protocols.h +++ b/framework/inc/protocols.h @@ -35,8 +35,6 @@ namespace framework{ a real visible component. */ -// indicates a loadable content in general! -#define SPECIALPROTOCOL_PRIVATE "private:" // indicates loading of components using a model directly #define SPECIALPROTOCOL_PRIVATE_OBJECT u"private:object" // indicates loading of components using a stream only diff --git a/hwpfilter/source/hpara.h b/hwpfilter/source/hpara.h index 53c35a2ccb7f..b057edcb816b 100644 --- a/hwpfilter/source/hpara.h +++ b/hwpfilter/source/hpara.h @@ -53,7 +53,6 @@ enum }; class HWPPara; -#define FIXED_SPACING_BIT (0x8000) struct LineInfo { diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx index 90e252bffafe..cb1aa115e294 100644 --- a/include/avmedia/mediawindow.hxx +++ b/include/avmedia/mediawindow.hxx @@ -28,8 +28,6 @@ #include <vcl/vclptr.hxx> #include <avmedia/avmediadllapi.h> -#define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0 - namespace com::sun::star::frame { class XDispatchProvider; } namespace com::sun::star::graphic { class XGraphic; } namespace com::sun::star::media { diff --git a/include/comphelper/accessibleselectionhelper.hxx b/include/comphelper/accessibleselectionhelper.hxx index 12842bf4bcb2..78bdabcae611 100644 --- a/include/comphelper/accessibleselectionhelper.hxx +++ b/include/comphelper/accessibleselectionhelper.hxx @@ -27,8 +27,6 @@ #include <comphelper/comphelperdllapi.h> #define ACCESSIBLE_SELECTION_CHILD_ALL (sal_Int32(-1)) -#define ACCESSIBLE_SELECTION_CHILD_SELF ((sal_Int32)-2) - namespace comphelper { diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index f78aefc5cffa..ef1ec563d3b5 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -194,7 +194,6 @@ private: SAL_DLLPRIVATE void HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos); SAL_DLLPRIVATE void HandleEndPasteOrDrop(PasteOrDropInfos& rInfos); - SAL_DLLPRIVATE bool HasText() const; SAL_DLLPRIVATE const EditSelectionEngine& GetSelectionEngine() const; SAL_DLLPRIVATE void SetInSelectionMode(bool b); @@ -278,6 +277,7 @@ public: SAL_DLLPRIVATE void SetMinColumnWrapHeight(tools::Long nVal); + bool HasText() const; OUString GetText( LineEnd eEnd = LINEEND_LF ) const; OUString GetText( const ESelection& rSelection ) const; sal_Int32 GetTextLen() const; diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx index 59e92f4b691b..2658033614a4 100644 --- a/include/editeng/ulspitem.hxx +++ b/include/editeng/ulspitem.hxx @@ -30,8 +30,6 @@ This item describes the Upper- and Lower space of a page or paragraph. */ -#define ULSPACE_16_VERSION (sal_uInt16(0x0001)) - class EDITENG_DLLPUBLIC SvxULSpaceItem final : public SfxPoolItem { sal_uInt16 nUpper; // Upper space diff --git a/include/svx/cuicharmap.hxx b/include/svx/cuicharmap.hxx index 0d95eb198e04..006cdba0a402 100644 --- a/include/svx/cuicharmap.hxx +++ b/include/svx/cuicharmap.hxx @@ -35,8 +35,6 @@ using namespace ::com::sun::star; class SubsetMap; -#define CHARMAP_MAXLEN 32 - namespace svx { struct SvxShowCharSetItem; diff --git a/include/svx/gallery.hxx b/include/svx/gallery.hxx index d668bf9e668e..b03b31a5d322 100644 --- a/include/svx/gallery.hxx +++ b/include/svx/gallery.hxx @@ -89,9 +89,6 @@ #define RID_GALLERY_THEME_TRANSPORT (RID_GALLERY_THEME_START + 43) #define RID_GALLERY_THEME_TXTSHAPES (RID_GALLERY_THEME_START + 44) -#define RID_GALLERY_THEME_FIRST RID_GALLERY_THEME_3D -#define RID_GALLERY_THEME_LAST RID_GALLERY_THEME_TXTSHAPES - class SdrModel; class Graphic; class BitmapEx; diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx index 3403b4e32db6..be4e0330b0e3 100644 --- a/include/svx/galmisc.hxx +++ b/include/svx/galmisc.hxx @@ -73,9 +73,7 @@ enum class GalleryGraphicImportRet #define GALLERY_PROGRESS_RANGE 10000 -#define GALLERY_FG_COLOR Application::GetSettings().GetStyleSettings().GetWindowTextColor() #define GALLERY_BG_COLOR Application::GetSettings().GetStyleSettings().GetWindowColor() -#define GALLERY_DLG_COLOR Application::GetSettings().GetStyleSettings().GetDialogColor() class SvStream; class Graphic; diff --git a/include/svx/grfcrop.hxx b/include/svx/grfcrop.hxx index ff17e66e0c03..615a750a1c01 100644 --- a/include/svx/grfcrop.hxx +++ b/include/svx/grfcrop.hxx @@ -23,9 +23,6 @@ #include <svl/poolitem.hxx> #include <svx/svxdllapi.h> -#define GRFCROP_VERSION_SWDEFAULT 0 -#define GRFCROP_VERSION_MOVETOSVX 1 - class SVXCORE_DLLPUBLIC SvxGrfCrop : public SfxPoolItem { sal_Int32 m_nLeft, m_nRight, m_nTop, m_nBottom; diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index c528318dc33d..46071a987f5c 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -785,7 +785,8 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const sal_Int32 nHyphCount = 0; - for ( sal_Int32 i = 0; i < encWord.getLength(); i++) + // FIXME: shouldn't we iterate code points instead? + for (sal_Int32 i = 0; i < nWord.getLength(); i++) { if (hyphens[i]&1) nHyphCount++; diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx index 247f1cc783ae..0173b4aa7f26 100644 --- a/sc/inc/editutil.hxx +++ b/sc/inc/editutil.hxx @@ -130,8 +130,8 @@ public: ScEditEngineDefaulter( const ScEditEngineDefaulter& rOrg ); virtual ~ScEditEngineDefaulter() override; - /// Creates a copy of SfxItemSet if bRememberCopy set - void SetDefaults( const SfxItemSet& rDefaults, bool bRememberCopy = true ); + /// Creates a copy of SfxItemSet + void SetDefaults( const SfxItemSet& rDefaults ); /// Becomes the owner of the SfxItemSet void SetDefaults( std::unique_ptr<SfxItemSet> pDefaults ); @@ -148,13 +148,15 @@ public: void SetTextCurrentDefaults( const EditTextObject& rTextObject ); /// Current defaults are not applied, new defaults are applied void SetTextNewDefaults( const EditTextObject& rTextObject, - const SfxItemSet& rDefaults, bool bRememberCopy = true ); + std::unique_ptr<SfxItemSet> pDefaults ); + /// New defaults are applied, but not stored + void SetTextTempDefaults( const EditTextObject& rTextObject, + const SfxItemSet& rDefaults ); /// SetText and apply defaults already set void SetTextCurrentDefaults( const OUString& rText ); /// Current defaults are not applied, new defaults are applied - void SetTextNewDefaults( const OUString& rText, - const SfxItemSet& rDefaults ); + void SetTextNewDefaults( const OUString& rText, std::unique_ptr<SfxItemSet> pDefaults ); /// Paragraph attributes that are not defaults are copied to /// character attributes and all paragraph attributes reset @@ -163,6 +165,10 @@ public: /// Re-apply existing defaults if set, same as in SetText, /// but without EnableUndo/SetUpdateMode. void RepeatDefaults(); + +private: + /// Apply the passed defaults, without storing them + void ApplyDefaults(const SfxItemSet& rNewSet); }; // for field commands (or just fields?) in a table diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index e99933785860..e0e5505da9aa 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -415,22 +415,22 @@ tools::Long ScColumn::GetNeededSize( pDev->SetMapMode( aHMMMode ); pEngine->SetRefDevice( pDev ); rDocument.ApplyAsianEditSettings( *pEngine ); - SfxItemSet aSet( pEngine->GetEmptyItemSet() ); + auto pSet = std::make_unique<SfxItemSet>(pEngine->GetEmptyItemSet()); if ( ScStyleSheet* pPreviewStyle = rDocument.GetPreviewCellStyle( nCol, nRow, nTab ) ) { ScPatternAttr aPreviewPattern( *pPattern ); aPreviewPattern.SetStyleSheet(pPreviewStyle); - aPreviewPattern.FillEditItemSet( &aSet, pCondSet ); + aPreviewPattern.FillEditItemSet(pSet.get(), pCondSet); } else { SfxItemSet* pFontSet = rDocument.GetPreviewFont( nCol, nRow, nTab ); - pPattern->FillEditItemSet( &aSet, pFontSet ? pFontSet : pCondSet ); + pPattern->FillEditItemSet(pSet.get(), pFontSet ? pFontSet : pCondSet); } // no longer needed, are set with the text (is faster) // pEngine->SetDefaults( pSet ); - if ( aSet.Get(EE_PARA_HYPHENATE).GetValue() ) { + if ( pSet->Get(EE_PARA_HYPHENATE).GetValue() ) { css::uno::Reference<css::linguistic2::XHyphenator> xXHyphenator( LinguMgr::GetHyphenator() ); pEngine->SetHyphenator( xXHyphenator ); @@ -483,7 +483,7 @@ tools::Long ScColumn::GetNeededSize( if (aCell.getType() == CELLTYPE_EDIT) { - pEngine->SetTextNewDefaults(*aCell.getEditText(), std::move(aSet)); + pEngine->SetTextNewDefaults(*aCell.getEditText(), std::move(pSet)); } else { @@ -493,9 +493,9 @@ tools::Long ScColumn::GetNeededSize( rOptions.bFormula); if (!aString.isEmpty()) - pEngine->SetTextNewDefaults(aString, std::move(aSet)); + pEngine->SetTextNewDefaults(aString, std::move(pSet)); else - pEngine->SetDefaults(std::move(aSet)); + pEngine->SetDefaults(std::move(pSet)); } bool bEngineVertical = pEngine->IsEffectivelyVertical(); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index dc6441a3e29b..225eac4502c2 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -519,9 +519,9 @@ ScNoteEditEngine& ScDocument::GetNoteEngine() mpNoteEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM)); ApplyAsianEditSettings( *mpNoteEngine ); const SfxItemSet& rItemSet(getCellAttributeHelper().getDefaultCellAttribute().GetItemSet()); - SfxItemSet aEEItemSet( mpNoteEngine->GetEmptyItemSet() ); - ScPatternAttr::FillToEditItemSet( aEEItemSet, rItemSet ); - mpNoteEngine->SetDefaults( std::move(aEEItemSet) ); // edit engine takes ownership + auto pEEItemSet = std::make_unique<SfxItemSet>(mpNoteEngine->GetEmptyItemSet()); + ScPatternAttr::FillToEditItemSet(*pEEItemSet, rItemSet); + mpNoteEngine->SetDefaults(std::move(pEEItemSet)); // edit engine takes ownership } return *mpNoteEngine; } diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 5fb5eec14acc..75a3763f6fcc 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -1246,19 +1246,19 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, Transliteratio // defaults from cell attributes must be set so right language is used const ScPatternAttr* pPattern = GetPattern( nCol, nRow, nTab ); - SfxItemSet aDefaults( pEngine->GetEmptyItemSet() ); + auto pDefaults = std::make_unique<SfxItemSet>( pEngine->GetEmptyItemSet() ); if ( ScStyleSheet* pPreviewStyle = GetPreviewCellStyle( nCol, nRow, nTab ) ) { ScPatternAttr aPreviewPattern( *pPattern ); aPreviewPattern.SetStyleSheet(pPreviewStyle); - aPreviewPattern.FillEditItemSet( &aDefaults ); + aPreviewPattern.FillEditItemSet(pDefaults.get()); } else { SfxItemSet* pFontSet = GetPreviewFont( nCol, nRow, nTab ); - pPattern->FillEditItemSet( &aDefaults, pFontSet ); + pPattern->FillEditItemSet(pDefaults.get(), pFontSet); } - pEngine->SetDefaults( std::move(aDefaults) ); + pEngine->SetDefaults(std::move(pDefaults)); if (aCell.getType() == CELLTYPE_STRING) pEngine->SetTextCurrentDefaults(aCell.getSharedString()->getString()); else if (aCell.getEditText()) @@ -1280,7 +1280,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, Transliteratio if ( aTester.NeedsObject() ) { // remove defaults (paragraph attributes) before creating text object - pEngine->SetDefaults( std::make_unique<SfxItemSet>( pEngine->GetEmptyItemSet() ) ); + pEngine->SetDefaults(pEngine->GetEmptyItemSet()); // The cell will take ownership of the text object instance. SetEditText(ScAddress(nCol,nRow,nTab), pEngine->CreateTextObject()); diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index 3c3dac0ee4e9..69eb8a1a8181 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -562,13 +562,8 @@ ScEditEngineDefaulter::~ScEditEngineDefaulter() { } -void ScEditEngineDefaulter::SetDefaults( const SfxItemSet& rSet, bool bRememberCopy ) +void ScEditEngineDefaulter::ApplyDefaults(const SfxItemSet& rNewSet) { - if ( bRememberCopy ) - { - m_pDefaults = std::make_unique<SfxItemSet>( rSet ); - } - const SfxItemSet& rNewSet = bRememberCopy ? *m_pDefaults : rSet; bool bUndo = IsUndoEnabled(); EnableUndo( false ); bool bUpdateMode = SetUpdateLayout( false ); @@ -583,11 +578,16 @@ void ScEditEngineDefaulter::SetDefaults( const SfxItemSet& rSet, bool bRememberC EnableUndo( true ); } +void ScEditEngineDefaulter::SetDefaults(const SfxItemSet& rSet) +{ + SetDefaults(std::make_unique<SfxItemSet>(rSet)); +} + void ScEditEngineDefaulter::SetDefaults( std::unique_ptr<SfxItemSet> pSet ) { m_pDefaults = std::move(pSet); if ( m_pDefaults ) - SetDefaults( *m_pDefaults, false ); + ApplyDefaults(*m_pDefaults); } void ScEditEngineDefaulter::SetDefaultItem( const SfxPoolItem& rItem ) @@ -597,7 +597,7 @@ void ScEditEngineDefaulter::SetDefaultItem( const SfxPoolItem& rItem ) m_pDefaults = std::make_unique<SfxItemSet>( GetEmptyItemSet() ); } m_pDefaults->Put( rItem ); - SetDefaults( *m_pDefaults, false ); + ApplyDefaults(*m_pDefaults); } const SfxItemSet& ScEditEngineDefaulter::GetDefaults() @@ -614,17 +614,27 @@ void ScEditEngineDefaulter::SetTextCurrentDefaults( const EditTextObject& rTextO bool bUpdateMode = SetUpdateLayout( false ); SetText( rTextObject ); if ( m_pDefaults ) - SetDefaults( *m_pDefaults, false ); + ApplyDefaults(*m_pDefaults); + if ( bUpdateMode ) + SetUpdateLayout( true ); +} + +void ScEditEngineDefaulter::SetTextNewDefaults(const EditTextObject& rTextObject, + std::unique_ptr<SfxItemSet> pDefaults) +{ + bool bUpdateMode = SetUpdateLayout( false ); + SetText( rTextObject ); + SetDefaults(std::move(pDefaults)); if ( bUpdateMode ) SetUpdateLayout( true ); } -void ScEditEngineDefaulter::SetTextNewDefaults( const EditTextObject& rTextObject, - const SfxItemSet& rSet, bool bRememberCopy ) +void ScEditEngineDefaulter::SetTextTempDefaults(const EditTextObject& rTextObject, + const SfxItemSet& rSet) { bool bUpdateMode = SetUpdateLayout( false ); SetText( rTextObject ); - SetDefaults( rSet, bRememberCopy ); + ApplyDefaults(rSet); if ( bUpdateMode ) SetUpdateLayout( true ); } @@ -634,17 +644,17 @@ void ScEditEngineDefaulter::SetTextCurrentDefaults( const OUString& rText ) bool bUpdateMode = SetUpdateLayout( false ); SetText( rText ); if ( m_pDefaults ) - SetDefaults( *m_pDefaults, false ); + ApplyDefaults(*m_pDefaults); if ( bUpdateMode ) SetUpdateLayout( true ); } void ScEditEngineDefaulter::SetTextNewDefaults( const OUString& rText, - const SfxItemSet& rSet ) + std::unique_ptr<SfxItemSet> pDefaults ) { bool bUpdateMode = SetUpdateLayout( false ); SetText( rText ); - SetDefaults( rSet ); + SetDefaults(std::move(pDefaults)); if ( bUpdateMode ) SetUpdateLayout( true ); } diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 3413772e4707..98a69698f5fe 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -1143,15 +1143,15 @@ SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder() pCellAttributeDefault = &pTmp->getDefaultCellAttribute(); } - SfxItemSet aDefaults( pHdrEngine->GetEmptyItemSet() ); - pCellAttributeDefault->FillEditItemSet( &aDefaults ); + auto pDefaults = std::make_unique<SfxItemSet>(pHdrEngine->GetEmptyItemSet()); + pCellAttributeDefault->FillEditItemSet(pDefaults.get()); // FillEditItemSet adjusts font height to 1/100th mm, // but for header/footer twips is needed, as in the PatternAttr: - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) ); - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) ); - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) ); - aDefaults.Put( SvxAdjustItem( meAdjust, EE_PARA_JUST ) ); - pHdrEngine->SetDefaults( aDefaults ); + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) ); + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) ); + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) ); + pDefaults->Put( SvxAdjustItem( meAdjust, EE_PARA_JUST ) ); + pHdrEngine->SetDefaults(std::move(pDefaults)); ScHeaderFieldData aData; if (mpViewShell) diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index 869dde5ca95b..fde4197b9ac8 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -285,37 +285,37 @@ void ScCsvGrid::InitFonts() ::GetDefaultFonts( aLatinItem, aAsianItem, aComplexItem ); // create item set for defaults - SfxItemSet aDefSet( mpEditEngine->GetEmptyItemSet() ); - EditEngine::SetFontInfoInItemSet( aDefSet, maMonoFont ); - aDefSet.Put( aAsianItem ); - aDefSet.Put( aComplexItem ); + auto pDefSet = std::make_unique<SfxItemSet>(mpEditEngine->GetEmptyItemSet()); + EditEngine::SetFontInfoInItemSet(*pDefSet, maMonoFont); + pDefSet->Put(aAsianItem); + pDefSet->Put(aComplexItem); // set Asian/Complex font size to height of character in Latin font sal_uLong nFontHt = static_cast< sal_uLong >( maMonoFont.GetFontSize().Height() ); - aDefSet.Put( SvxFontHeightItem( nFontHt, 100, EE_CHAR_FONTHEIGHT_CJK ) ); - aDefSet.Put( SvxFontHeightItem( nFontHt, 100, EE_CHAR_FONTHEIGHT_CTL ) ); + pDefSet->Put(SvxFontHeightItem(nFontHt, 100, EE_CHAR_FONTHEIGHT_CJK)); + pDefSet->Put(SvxFontHeightItem(nFontHt, 100, EE_CHAR_FONTHEIGHT_CTL)); // copy other items from default font - const SfxPoolItem& rWeightItem = aDefSet.Get( EE_CHAR_WEIGHT ); + const SfxPoolItem& rWeightItem = pDefSet->Get(EE_CHAR_WEIGHT); std::unique_ptr<SfxPoolItem> pNewItem(rWeightItem.Clone()); pNewItem->SetWhich(EE_CHAR_WEIGHT_CJK); - aDefSet.Put( *pNewItem ); + pDefSet->Put(*pNewItem); pNewItem->SetWhich(EE_CHAR_WEIGHT_CTL); - aDefSet.Put( *pNewItem ); - const SfxPoolItem& rItalicItem = aDefSet.Get( EE_CHAR_ITALIC ); + pDefSet->Put(*pNewItem); + const SfxPoolItem& rItalicItem = pDefSet->Get(EE_CHAR_ITALIC); pNewItem.reset(rItalicItem.Clone()); pNewItem->SetWhich(EE_CHAR_ITALIC_CJK); - aDefSet.Put( *pNewItem ); + pDefSet->Put(*pNewItem); pNewItem->SetWhich(EE_CHAR_ITALIC_CTL); - aDefSet.Put( *pNewItem ); - const SfxPoolItem& rLangItem = aDefSet.Get( EE_CHAR_LANGUAGE ); + pDefSet->Put(*pNewItem); + const SfxPoolItem& rLangItem = pDefSet->Get(EE_CHAR_LANGUAGE); pNewItem.reset(rLangItem.Clone()); pNewItem->SetWhich(EE_CHAR_LANGUAGE_CJK); - aDefSet.Put( *pNewItem ); + pDefSet->Put(*pNewItem); pNewItem->SetWhich(EE_CHAR_LANGUAGE_CTL); - aDefSet.Put( *pNewItem ); + pDefSet->Put(*pNewItem); - mpEditEngine->SetDefaults( aDefSet ); + mpEditEngine->SetDefaults(std::move(pDefSet)); InvalidateGfx(); } diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 30b67d411f9f..89d2ffc11af3 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -190,14 +190,14 @@ SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder() pCellAttributeDefault = &pTmp->getDefaultCellAttribute(); } - SfxItemSet aDefaults( pHdrEngine->GetEmptyItemSet() ); - pCellAttributeDefault->FillEditItemSet( &aDefaults ); + auto pDefaults = std::make_unique<SfxItemSet>(pHdrEngine->GetEmptyItemSet()); + pCellAttributeDefault->FillEditItemSet(pDefaults.get()); // FillEditItemSet adjusts font height to 1/100th mm, // but for header/footer twips is needed, as in the PatternAttr: - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) ); - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) ) ; - aDefaults.Put( pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) ); - pHdrEngine->SetDefaults( aDefaults ); + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) ); + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) ) ; + pDefaults->Put( pCellAttributeDefault->GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) ); + pHdrEngine->SetDefaults(std::move(pDefaults)); ScHeaderFieldData aData; ScHeaderFooterTextObj::FillDummyFieldData( aData ); @@ -799,19 +799,19 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder() { ScDocument& rDoc = pDocShell->GetDocument(); - SfxItemSet aDefaults( pEditEngine->GetEmptyItemSet() ); + auto pDefaults = std::make_unique<SfxItemSet>(pEditEngine->GetEmptyItemSet()); if( const ScPatternAttr* pPattern = rDoc.GetPattern( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) ) { - pPattern->FillEditItemSet( &aDefaults ); - pPattern->FillEditParaItems( &aDefaults ); // including alignment etc. (for reading) + pPattern->FillEditItemSet(pDefaults.get()); + pPattern->FillEditParaItems(pDefaults.get()); // including alignment etc. (for reading) } ScRefCellValue aCell(rDoc, aCellPos); if (aCell.getType() == CELLTYPE_EDIT) { const EditTextObject* pObj = aCell.getEditText(); - pEditEngine->SetTextNewDefaults(*pObj, aDefaults); + pEditEngine->SetTextNewDefaults(*pObj, std::move(pDefaults)); } else { @@ -825,10 +825,10 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder() // Note: CppunitTest_sc_macros_test testTdf116127 will fail if // pEditEngine->SetTextNewDefaults() is passed an empty string // and pEditEngine->GetText() is empty string. - if (!aText.isEmpty() || !pEditEngine->GetText().isEmpty()) - pEditEngine->SetTextNewDefaults(aText, aDefaults); + if (!aText.isEmpty() || pEditEngine->HasText()) + pEditEngine->SetTextNewDefaults(aText, std::move(pDefaults)); else - pEditEngine->SetDefaults(aDefaults); + pEditEngine->SetDefaults(std::move(pDefaults)); } } diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index ce39cd33d9a9..3fa202c29a3f 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -347,10 +347,9 @@ void ScEditShell::Execute( SfxRequest& rReq ) EditView* pActiveView = pHdl->GetActiveView(); if( pActiveView ) { - OUString sInput = rEngine.GetText(); ESelection aSel( pActiveView->GetSelection() ); - if( aSel.HasRange() ) - sInput = pActiveView->GetSelected(); + OUString sInput(aSel.HasRange() ? pActiveView->GetSelected() + : rEngine.GetText()); if( aSel.nStartPos > aSel.nEndPos ) aSel.nEndPos = aSel.nStartPos; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 81c8a67e0ad6..5bb1f8f4c3fb 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5792,10 +5792,10 @@ std::shared_ptr<ScFieldEditEngine> createEditEngine( ScDocShell* pDocSh, const S ScSizeDeviceProvider aProv(pDocSh); pEngine->SetRefDevice(aProv.GetDevice()); pEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM)); - SfxItemSet aDefault = pEngine->GetEmptyItemSet(); - rPat.FillEditItemSet(&aDefault); - aDefault.Put( SvxAdjustItem(toSvxAdjust(rPat), EE_PARA_JUST) ); - pEngine->SetDefaults(aDefault); + auto pDefault = std::make_unique<SfxItemSet>(pEngine->GetEmptyItemSet()); + rPat.FillEditItemSet(pDefault.get()); + pDefault->Put(SvxAdjustItem(toSvxAdjust(rPat), EE_PARA_JUST)); + pEngine->SetDefaults(std::move(pDefault)); return pEngine; } diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index ec1458323e9c..898bf636ff14 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -782,7 +782,7 @@ tools::Long ScPrintFunc::TextHeight( const EditTextObject* pObject ) if (!pObject) return 0; - pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); + pEditEngine->SetTextTempDefaults(*pObject, *pEditDefaults); return static_cast<tools::Long>(pEditEngine->GetTextHeight()); } @@ -1877,7 +1877,7 @@ void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStart if (pObject) { pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) ); - pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); + pEditEngine->SetTextTempDefaults(*pObject, *pEditDefaults); Point aDraw = aStart; tools::Long nDif = aPaperSize.Height() - static_cast<tools::Long>(pEditEngine->GetTextHeight()); if (nDif > 0) @@ -1891,7 +1891,7 @@ void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStart if (pObject) { pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) ); - pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); + pEditEngine->SetTextTempDefaults(*pObject, *pEditDefaults); Point aDraw = aStart; tools::Long nDif = aPaperSize.Height() - static_cast<tools::Long>(pEditEngine->GetTextHeight()); if (nDif > 0) @@ -1905,7 +1905,7 @@ void ScPrintFunc::PrintHF( tools::Long nPageNo, bool bHeader, tools::Long nStart if (pObject) { pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) ); - pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); + pEditEngine->SetTextTempDefaults(*pObject, *pEditDefaults); Point aDraw = aStart; tools::Long nDif = aPaperSize.Height() - static_cast<tools::Long>(pEditEngine->GetTextHeight()); if (nDif > 0) diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 835c526f7f0b..0edb654f2249 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -362,12 +362,12 @@ void ScViewFunc::DoThesaurus() pThesaurusEngine->SetRefDevice(GetViewData().GetActiveWin()->GetOutDev()); pThesaurusEngine->SetSpeller(xSpeller); MakeEditView(pThesaurusEngine.get(), nCol, nRow ); - SfxItemSet aEditDefaults(pThesaurusEngine->GetEmptyItemSet()); const ScPatternAttr* pPattern = rDoc.GetPattern(nCol, nRow, nTab); if (pPattern) { - pPattern->FillEditItemSet( &aEditDefaults ); - pThesaurusEngine->SetDefaults( aEditDefaults ); + auto pEditDefaults = std::make_unique<SfxItemSet>(pThesaurusEngine->GetEmptyItemSet()); + pPattern->FillEditItemSet(pEditDefaults.get()); + pThesaurusEngine->SetDefaults(std::move(pEditDefaults)); } if (aOldText.getType() == CELLTYPE_EDIT) diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index 8b67b00424b1..46253dad1467 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -441,7 +441,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) ErrCode nErr = aOutliner.Read( *pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes() ); - if (nErr || aOutliner.GetEditEngine().GetText().isEmpty()) + if (nErr || !aOutliner.GetEditEngine().HasText()) { std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(mpWindow->GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR))); @@ -586,7 +586,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) ErrCode nErr = aOutliner.Read(*pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes()); - if (nErr || aOutliner.GetEditEngine().GetText().isEmpty()) + if (nErr || !aOutliner.GetEditEngine().HasText()) { std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(mpWindow->GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, SdResId(STR_READ_DATA_ERROR))); diff --git a/sd/source/ui/view/NotesPanelView.cxx b/sd/source/ui/view/NotesPanelView.cxx index 05ef63aeb3fd..037fb0809cf5 100644 --- a/sd/source/ui/view/NotesPanelView.cxx +++ b/sd/source/ui/view/NotesPanelView.cxx @@ -214,7 +214,7 @@ void NotesPanelView::onLoseFocus() SdrTextObj* pNotesTextObj = getNotesTextObj(); if (pNotesTextObj) { - if (maOutliner.GetEditEngine().GetText().getLength() == 0) + if (!maOutliner.GetEditEngine().HasText()) { // if the notes are empty restore the placeholder text and state. SdPage* pPage = dynamic_cast<SdPage*>(pNotesTextObj->getSdrPageFromSdrObject()); diff --git a/shell/source/win32/ooofilereader/metainforeader.cxx b/shell/source/win32/ooofilereader/metainforeader.cxx index 9eab4d5e01d2..e4295311df72 100644 --- a/shell/source/win32/ooofilereader/metainforeader.cxx +++ b/shell/source/win32/ooofilereader/metainforeader.cxx @@ -121,7 +121,7 @@ CMetaInfoReader::~CMetaInfoReader() */ bool CMetaInfoReader::hasTag(const std::wstring& TagName) const { - return ( m_AllMetaInfo.find(TagName) != m_AllMetaInfo.end()); + return ( m_AllMetaInfo.contains(TagName) ); } /** Get a specific tag content, compound tags will be returned as comma separated list. @@ -146,7 +146,7 @@ std::wstring CMetaInfoReader::getTagData( const std::wstring& TagName) */ bool CMetaInfoReader::hasTagAttribute(const std::wstring& TagName, const std::wstring& AttributeName) { - return ( m_AllMetaInfo[TagName].second.find( AttributeName) != m_AllMetaInfo[TagName].second.end() ); + return ( m_AllMetaInfo[TagName].second.contains( AttributeName) ); } /** Get a specific attribute content. diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index b3634148e7fe..4979045c48dd 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1026,7 +1026,7 @@ void SwAnnotationWin::DeactivatePostIt() if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) GetOutlinerView()->SetBackgroundColor(COL_TRANSPARENT); - if (!mnDeleteEventId && !IsReadOnlyOrProtected() && mpOutliner->GetEditEngine().GetText().isEmpty()) + if (!mnDeleteEventId && !IsReadOnlyOrProtected() && !mpOutliner->GetEditEngine().HasText()) { mnDeleteEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true ); } @@ -1059,7 +1059,7 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot) const bool bReply = nSlot == FN_REPLY; // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note // will be created - if (!mrMgr.IsAnswer() && !mpOutliner->GetEditEngine().GetText().isEmpty()) + if (!mrMgr.IsAnswer() && mpOutliner->GetEditEngine().HasText()) { OutlinerParaObject aPara(GetOutlinerView()->GetEditView().CreateTextObject()); mrMgr.RegisterAnswer(aPara); diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk index efa4fd9e16fd..a819d4008307 100644 --- a/vcl/CustomTarget_qt5_moc.mk +++ b/vcl/CustomTarget_qt5_moc.mk @@ -14,6 +14,7 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \ $(gb_CustomTarget_workdir)/vcl/qt5/QtFilePicker.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtFrame.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstance.moc \ + $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceCheckButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceComboBox.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceContainer.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceDialog.moc \ diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk index 69fc48db7ae5..cb53e819835e 100644 --- a/vcl/CustomTarget_qt6_moc.mk +++ b/vcl/CustomTarget_qt6_moc.mk @@ -14,6 +14,7 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \ $(gb_CustomTarget_workdir)/vcl/qt6/QtFilePicker.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtFrame.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstance.moc \ + $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceCheckButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceComboBox.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceContainer.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceDialog.moc \ diff --git a/vcl/inc/qt5/QtBuilder.hxx b/vcl/inc/qt5/QtBuilder.hxx index 6f0459d55b0d..dd31c9999c42 100644 --- a/vcl/inc/qt5/QtBuilder.hxx +++ b/vcl/inc/qt5/QtBuilder.hxx @@ -84,6 +84,7 @@ public: virtual void set_response(std::u16string_view sID, short nResponse) override; private: + static void deleteObject(QObject* pObject); void setProperties(QObject* obj, stringmap& rProps); static void setLabelProperties(QLabel& rLabel, stringmap& rProps); void setSpinButtonProperties(QDoubleSpinBox& rSpinBox, stringmap& rProps); diff --git a/vcl/inc/qt5/QtInstanceCheckButton.hxx b/vcl/inc/qt5/QtInstanceCheckButton.hxx index 43db65c96a72..a13c883ac310 100644 --- a/vcl/inc/qt5/QtInstanceCheckButton.hxx +++ b/vcl/inc/qt5/QtInstanceCheckButton.hxx @@ -14,8 +14,12 @@ #include <QtCore/QObject> #include <QtWidgets/QCheckBox> -class QtInstanceCheckButton : public QtInstanceWidget, public virtual weld::CheckButton +class QtInstanceCheckButton : public QObject, + public QtInstanceWidget, + public virtual weld::CheckButton { + Q_OBJECT + QCheckBox* m_pCheckBox; public: diff --git a/vcl/inc/qt5/QtInstanceDialog.hxx b/vcl/inc/qt5/QtInstanceDialog.hxx index e47849cc9bd7..5c8a6d0981ab 100644 --- a/vcl/inc/qt5/QtInstanceDialog.hxx +++ b/vcl/inc/qt5/QtInstanceDialog.hxx @@ -18,6 +18,7 @@ class QtInstanceDialog : public QtInstanceWindow, public virtual weld::Dialog Q_OBJECT std::unique_ptr<QDialog> m_pDialog; + QWidget* m_pContentArea; // the DialogController/Dialog/function passed to the runAsync variants std::shared_ptr<weld::DialogController> m_xRunAsyncDialogController; diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index 044e3ea9d421..d73800d02d0d 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -348,7 +348,7 @@ void QtBuilder::tweakInsertedChild(QObject* pParent, QObject* pCurrentChild, std // an editable GtkComboBox has an internal GtkEntry child, // but QComboBox doesn't need a separate widget for it, so // delete it - pCurrentChild->deleteLater(); + deleteObject(pCurrentChild); } if (sType == "label") @@ -362,8 +362,7 @@ void QtBuilder::tweakInsertedChild(QObject* pParent, QObject* pCurrentChild, std // For QGroupBox, the title can be set directly. Therefore, take over the // title from the label and delete the separate label widget again pGroupBox->setTitle(pLabel->text()); - pLabel->setParent(nullptr); - pLabel->deleteLater(); + deleteObject(pLabel); } } } @@ -526,6 +525,13 @@ void QtBuilder::set_response(std::u16string_view sID, short nResponse) pPushButton->setProperty(QtInstanceMessageDialog::PROPERTY_VCL_RESPONSE_CODE, int(nResponse)); } +void QtBuilder::deleteObject(QObject* pObject) +{ + if (pObject->isWidgetType()) + static_cast<QWidget*>(pObject)->hide(); + pObject->deleteLater(); +} + void QtBuilder::setProperties(QObject* pObject, stringmap& rProps) { if (QMessageBox* pMessageBox = qobject_cast<QMessageBox*>(pObject)) @@ -604,7 +610,7 @@ void QtBuilder::setProperties(QObject* pObject, stringmap& rProps) // parentless GtkImage in .ui file is only used for setting button // image, so the object is no longer needed after doing so if (!pImageLabel->parent()) - pImageLabel->deleteLater(); + deleteObject(pImageLabel); } else if (rKey == u"label") { diff --git a/vcl/qt5/QtInstanceCheckButton.cxx b/vcl/qt5/QtInstanceCheckButton.cxx index f4590d393444..835dcd356196 100644 --- a/vcl/qt5/QtInstanceCheckButton.cxx +++ b/vcl/qt5/QtInstanceCheckButton.cxx @@ -8,6 +8,7 @@ */ #include <QtInstanceCheckButton.hxx> +#include <QtInstanceCheckButton.moc> #include <vcl/qt/QtUtils.hxx> @@ -16,6 +17,7 @@ QtInstanceCheckButton::QtInstanceCheckButton(QCheckBox* pCheckBox) , m_pCheckBox(pCheckBox) { assert(m_pCheckBox); + connect(m_pCheckBox, &QCheckBox::toggled, this, [&] { signal_toggled(); }); } void QtInstanceCheckButton::set_active(bool bActive) diff --git a/vcl/qt5/QtInstanceDialog.cxx b/vcl/qt5/QtInstanceDialog.cxx index 7a4ca77ad70f..c1be1db313c0 100644 --- a/vcl/qt5/QtInstanceDialog.cxx +++ b/vcl/qt5/QtInstanceDialog.cxx @@ -19,6 +19,7 @@ const char* const QtInstanceDialog::PROPERTY_VCL_RESPONSE_CODE = "response-code" QtInstanceDialog::QtInstanceDialog(QDialog* pDialog) : QtInstanceWindow(pDialog) , m_pDialog(pDialog) + , m_pContentArea(nullptr) , m_aRunAsyncFunc(nullptr) { } @@ -148,8 +149,22 @@ void QtInstanceDialog::set_default_response(int) { assert(false && "Not implemen std::unique_ptr<weld::Container> QtInstanceDialog::weld_content_area() { - assert(false && "Not implemented yet"); - return nullptr; + if (!m_pContentArea) + { + if (QBoxLayout* pBoxLayout = qobject_cast<QBoxLayout*>(m_pDialog->layout())) + { + // insert an extra widget and layout at beginning of the dialog's layout + m_pContentArea = new QWidget; + m_pContentArea->setLayout(new QVBoxLayout); + pBoxLayout->insertWidget(0, m_pContentArea); + } + else + { + assert(false && "Dialog has layout that's not supported (yet)"); + } + } + + return std::make_unique<QtInstanceContainer>(m_pContentArea); } void QtInstanceDialog::dialogFinished(int nResult) diff --git a/vcl/qt5/QtInstanceNotebook.cxx b/vcl/qt5/QtInstanceNotebook.cxx index 6c28ce5c87e4..c8da18d5f5d6 100644 --- a/vcl/qt5/QtInstanceNotebook.cxx +++ b/vcl/qt5/QtInstanceNotebook.cxx @@ -155,6 +155,9 @@ weld::Container* QtInstanceNotebook::get_page(const OUString& rIdent) const pWidget = m_pTabWidget->widget(nIndex); }); + if (!pWidget) + return nullptr; + if (!m_aPageContainerInstances.contains(pWidget)) m_aPageContainerInstances.emplace(pWidget, std::make_unique<QtInstanceContainer>(pWidget)); |