chart2/source/inc/chartview/DrawModelWrapper.hxx | 2 chart2/source/view/main/ChartItemPool.cxx | 43 ---------------- chart2/source/view/main/ChartItemPool.hxx | 8 +-- chart2/source/view/main/DrawModelWrapper.cxx | 29 ++++++++++ sw/inc/undobj.hxx | 3 - sw/inc/unoframe.hxx | 5 + sw/inc/unotbl.hxx | 2 sw/source/core/access/acctable.hxx | 10 ++- sw/source/core/inc/SwXMLTextBlocks.hxx | 4 - sw/source/core/inc/unocontentcontrol.hxx | 4 - sw/source/filter/html/parcss1.hxx | 1 sw/source/filter/ww8/docxattributeoutput.hxx | 18 +++--- sw/source/filter/ww8/ww8attributeoutput.hxx | 61 +++++++++++------------ sw/source/filter/ww8/ww8par.hxx | 2 sw/source/filter/xml/xmlexpit.hxx | 2 sw/source/filter/xml/xmlimpit.hxx | 1 sw/source/uibase/inc/numfmtlb.hxx | 1 17 files changed, 90 insertions(+), 106 deletions(-)
New commits: commit 8e33793d72a0561ebcf19ca22df814bb347813b7 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Dec 1 15:37:26 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Dec 1 21:28:36 2022 +0100 loplugin:unusedfields make some fields private Change-Id: I7eea4baf65c0b49d0edf2516d84914f94c5194d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143528 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx index ab3fb876302e..f95a3aa78bfc 100644 --- a/sw/inc/undobj.hxx +++ b/sw/inc/undobj.hxx @@ -257,13 +257,12 @@ class SwUndoInserts : public SwUndo, public SwUndRng, private SwUndoSaveContent std::vector< std::shared_ptr<SwUndoInsLayFormat> > m_FlyUndos; std::unique_ptr<SwRedlineData> m_pRedlineData; SwNodeOffset m_nDeleteTextNodes; - -protected: SwNodeOffset m_nNodeDiff; /// start of Content in UndoNodes for Redo std::optional<SwNodeIndex> m_oUndoNodeIndex; sal_uInt16 m_nSetPos; // Start in the history list. +protected: SwUndoInserts( SwUndoId nUndoId, const SwPaM& ); public: virtual ~SwUndoInserts() override; diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index e1b1425f103c..e87cb87e0675 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -76,11 +76,12 @@ private: sal_Int64 m_nVisibleAreaWidth; sal_Int64 m_nVisibleAreaHeight; css::uno::Reference<css::text::XText> m_xParentText; + css::uno::Reference< css::beans::XPropertySet > mxStyleData; + css::uno::Reference< css::container::XNameAccess > mxStyleFamily; + void DisposeInternal(); protected: - css::uno::Reference< css::beans::XPropertySet > mxStyleData; - css::uno::Reference< css::container::XNameAccess > mxStyleFamily; virtual void Notify(const SfxHint&) override; virtual ~SwXFrame() override; diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx index 178989fbaefc..fb02bfb9f9d1 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -194,6 +194,7 @@ class SW_DLLPUBLIC SwXTextTableCursor final { SwFrameFormat* m_pFrameFormat; const SfxItemPropertySet* m_pPropSet; + sw::UnoCursorPointer m_pUnoCursor; public: SwXTextTableCursor(SwFrameFormat* pFormat, SwTableBox const* pBox); @@ -237,7 +238,6 @@ public: const SwUnoCursor& GetCursor() const; SwUnoCursor& GetCursor(); - sw::UnoCursorPointer m_pUnoCursor; SwFrameFormat* GetFrameFormat() const { return m_pFrameFormat; } }; diff --git a/sw/source/core/access/acctable.hxx b/sw/source/core/access/acctable.hxx index 4b3dd87938e0..ce3f12b64093 100644 --- a/sw/source/core/access/acctable.hxx +++ b/sw/source/core/access/acctable.hxx @@ -46,6 +46,11 @@ class SwAccessibleTable : { std::unique_ptr<SwAccessibleTableData_Impl> mpTableData; // the table's data, protected by SolarMutex OUString m_sDesc; + typedef std::vector< std::pair<SwAccessibleContext*, + css::uno::WeakReference<css::accessibility::XAccessible> > > Cells_t; + Cells_t m_vecCellAdd; + Cells_t m_vecCellRemove; + const SwSelBoxes *GetSelBoxes() const; void FireTableChangeEvent( const SwAccessibleTableData_Impl& rTableData ); @@ -213,10 +218,7 @@ public: // XAccessibleComponent sal_Int32 SAL_CALL getBackground() override; - typedef std::vector< std::pair<SwAccessibleContext*, - css::uno::WeakReference<css::accessibility::XAccessible> > > Cells_t; - Cells_t m_vecCellAdd; - Cells_t m_vecCellRemove; + void FireSelectionEvent( ); void AddSelectionCell(SwAccessibleContext*, bool bAddOrRemove); }; diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx b/sw/source/core/inc/SwXMLTextBlocks.hxx index 9132b5993e8f..05a97ded5942 100644 --- a/sw/source/core/inc/SwXMLTextBlocks.hxx +++ b/sw/source/core/inc/SwXMLTextBlocks.hxx @@ -44,6 +44,8 @@ class SwXMLTextBlocks final : public SwImpBlocks SwXmlFlags m_nFlags; OUString m_aPackageName; tools::SvRef<SfxMedium> m_xMedium; + css::uno::Reference < css::embed::XStorage > m_xBlkRoot; + css::uno::Reference < css::embed::XStorage > m_xRoot; void ReadInfo(); void WriteInfo(); @@ -51,8 +53,6 @@ class SwXMLTextBlocks final : public SwImpBlocks void ResetBlockMode(); public: - css::uno::Reference < css::embed::XStorage > m_xBlkRoot; - css::uno::Reference < css::embed::XStorage > m_xRoot; SwXMLTextBlocks( const OUString& rFile ); SwXMLTextBlocks( const css::uno::Reference < css::embed::XStorage >&, const OUString& rFile ); void AddName( const OUString&, const OUString&, const OUString&, bool bOnlyText ); diff --git a/sw/source/core/inc/unocontentcontrol.hxx b/sw/source/core/inc/unocontentcontrol.hxx index a541313c6e55..409564d5bb0e 100644 --- a/sw/source/core/inc/unocontentcontrol.hxx +++ b/sw/source/core/inc/unocontentcontrol.hxx @@ -52,12 +52,10 @@ class SwXContentControl css::container::XEnumerationAccess, css::text::XTextContent, css::text::XText, css::beans::XPropertySet> { -public: class Impl; - -protected: sw::UnoImplPtr<Impl> m_pImpl; +protected: void AttachImpl(const css::uno::Reference<css::text::XTextRange>& xTextRange, sal_uInt16 nWhich); diff --git a/sw/source/filter/html/parcss1.hxx b/sw/source/filter/html/parcss1.hxx index 3ab9638741e9..99f46af8e830 100644 --- a/sw/source/filter/html/parcss1.hxx +++ b/sw/source/filter/html/parcss1.hxx @@ -118,6 +118,7 @@ public: */ struct CSS1Expression { +private: sal_Unicode cOp; // type of the link with its predecessor CSS1Token eType; // type of the expression OUString aValue; // value as string diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 55794770ac4b..c5c74faa4e16 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -723,15 +723,6 @@ protected: /// Writes a clearing line break at the end of run properties, if there are any. void WriteLineBreak(); - /// Reference to the export, where to get the data from - DocxExport &m_rExport; - - /// Fast serializer to output the data - ::sax_fastparser::FSHelperPtr m_pSerializer; - - /// DrawingML access - oox::drawingml::DrawingML &m_rDrawingML; - private: void DoWriteBookmarkTagStart(std::u16string_view bookmarkName); @@ -775,6 +766,15 @@ private: void EndField_Impl( const SwTextNode* pNode, sal_Int32 nPos, FieldInfos& rInfos ); void DoWriteFieldRunProperties( const SwTextNode* pNode, sal_Int32 nPos, bool bWriteCombChars = false ); + /// Reference to the export, where to get the data from + DocxExport &m_rExport; + + /// Fast serializer to output the data + ::sax_fastparser::FSHelperPtr m_pSerializer; + + /// DrawingML access + oox::drawingml::DrawingML &m_rDrawingML; + rtl::Reference<sax_fastparser::FastAttributeList> m_pFontsAttrList; rtl::Reference<sax_fastparser::FastAttributeList> m_pEastAsianLayoutAttrList; rtl::Reference<sax_fastparser::FastAttributeList> m_pCharLangAttrList; diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index 32ad12cdadb3..efb317df9305 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -438,6 +438,36 @@ protected: void TextLineBreak(const SwFormatLineBreak& rLineBreak) override; +public: + explicit WW8AttributeOutput( WW8Export &rWW8Export ) + : AttributeOutputBase(rWW8Export.GetWriter().GetMedia()->GetURLObject().GetMainURL( + INetURLObject::DecodeMechanism::NONE)) + , m_rWW8Export(rWW8Export) + , m_nPOPosStdLen1(0) + , m_nPOPosStdLen2(0) + , m_nStyleStartSize(0) + , m_nStyleLenPos(0) + , m_nStyleCountPos(0) + , m_nFieldResults(0) + , mbOnTOXEnding(false) + { + } + + /// Return the right export class. + virtual WW8Export& GetExport() override { return m_rWW8Export; } + +protected: + /// Output the bold etc. attributes + void OutputWW8Attribute( sal_uInt8 nId, bool bVal ); + + /// Output the bold etc. attributes, the Complex Text Layout version + void OutputWW8AttributeCTL( sal_uInt8 nId, bool bVal ); + + void TableCellBorders( + ww8::WW8TableNodeInfoInner::Pointer_t const & pTableTextNodeInfoInner ); + +private: + /// Reference to the export, where to get the data from WW8Export &m_rWW8Export; @@ -470,39 +500,8 @@ protected: std::multimap<sal_Int32, OUString> m_aBookmarksOfParagraphStart; std::multimap<sal_Int32, OUString> m_aBookmarksOfParagraphEnd; -public: - explicit WW8AttributeOutput( WW8Export &rWW8Export ) - : AttributeOutputBase(rWW8Export.GetWriter().GetMedia()->GetURLObject().GetMainURL( - INetURLObject::DecodeMechanism::NONE)) - , m_rWW8Export(rWW8Export) - , m_nPOPosStdLen1(0) - , m_nPOPosStdLen2(0) - , m_nStyleStartSize(0) - , m_nStyleLenPos(0) - , m_nStyleCountPos(0) - , m_nFieldResults(0) - , mbOnTOXEnding(false) - { - } - - /// Return the right export class. - virtual WW8Export& GetExport() override { return m_rWW8Export; } - -protected: - /// Output the bold etc. attributes - void OutputWW8Attribute( sal_uInt8 nId, bool bVal ); - - /// Output the bold etc. attributes, the Complex Text Layout version - void OutputWW8AttributeCTL( sal_uInt8 nId, bool bVal ); - - void TableCellBorders( - ww8::WW8TableNodeInfoInner::Pointer_t const & pTableTextNodeInfoInner ); - -private: - editeng::WordPageMargins m_pageMargins; bool m_bFromEdge = false; - }; #endif // INCLUDED_SW_SOURCE_FILTER_WW8_WW8ATTRIBUTEOUTPUT_HXX diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index c84af0d29d00..f283182137ba 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -894,9 +894,9 @@ public: class TextNodeListener : public SwClient { -protected: SwTextNode *m_pTextNode; +protected: virtual void SwClientNotify(const SwModify&, const SfxHint&) override; public: diff --git a/sw/source/filter/xml/xmlexpit.hxx b/sw/source/filter/xml/xmlexpit.hxx index 7639dd063c65..0ca39f024466 100644 --- a/sw/source/filter/xml/xmlexpit.hxx +++ b/sw/source/filter/xml/xmlexpit.hxx @@ -33,9 +33,9 @@ class SvXMLExport; class SvXMLExportItemMapper { -protected: SvXMLItemMapEntriesRef mrMapEntries; +protected: /** fills the given attribute list with the items in the given set */ void exportXML( const SvXMLExport& rExport, SvXMLAttributeList& rAttrList, diff --git a/sw/source/filter/xml/xmlimpit.hxx b/sw/source/filter/xml/xmlimpit.hxx index c54b7b470591..8227546a6253 100644 --- a/sw/source/filter/xml/xmlimpit.hxx +++ b/sw/source/filter/xml/xmlimpit.hxx @@ -31,7 +31,6 @@ class SvXMLAttrContainerItem; class SvXMLImportItemMapper { -protected: SvXMLItemMapEntriesRef mrMapEntries; public: diff --git a/sw/source/uibase/inc/numfmtlb.hxx b/sw/source/uibase/inc/numfmtlb.hxx index 0bbca0a5debd..6cd4415969bc 100644 --- a/sw/source/uibase/inc/numfmtlb.hxx +++ b/sw/source/uibase/inc/numfmtlb.hxx @@ -27,7 +27,6 @@ class SwView; class SW_DLLPUBLIC SwNumFormatBase { -protected: sal_Int32 m_nStdEntry; sal_uInt32 m_nDefFormat; SvNumFormatType m_nCurrFormatType; commit c6aae3f4035f0a2dceba94b1956f5fc0ace3b3ee Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Dec 1 15:19:12 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Dec 1 21:28:21 2022 +0100 tdf#145599 Charts gets corrupted when you draw a line inside them This reverts commit 2ed8c34bca56c1a30d727b21d9096cb77e88197a use a single global item pool for chart2 draw model Change-Id: I640a981a2cbbed1cb9e6c0b0c239c78bb481e12e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/inc/chartview/DrawModelWrapper.hxx b/chart2/source/inc/chartview/DrawModelWrapper.hxx index 0b4da35435d4..fb977528e8f1 100644 --- a/chart2/source/inc/chartview/DrawModelWrapper.hxx +++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx @@ -40,7 +40,7 @@ class OOO_DLLPUBLIC_CHARTVIEW DrawModelWrapper final : private SdrModel private: rtl::Reference<SvxDrawPage> m_xMainDrawPage; rtl::Reference<SvxDrawPage> m_xHiddenDrawPage; - + rtl::Reference<SfxItemPool> m_xChartItemPool; VclPtr<OutputDevice> m_pRefDevice; public: diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 3cf5a99fc29d..9f4637b21e1f 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -221,48 +221,9 @@ MapUnit ChartItemPool::GetMetric(sal_uInt16 /* nWhich */) const return MapUnit::Map100thMM; } -static rtl::Reference<SfxItemPool> g_Pool1, g_Pool2, g_Pool3; - -/** If we let the libc runtime clean us up, we trigger a crash */ -namespace -{ -class TerminateListener : public ::cppu::WeakImplHelper< css::frame::XTerminateListener > -{ - void SAL_CALL queryTermination( const css::lang::EventObject& ) override - {} - void SAL_CALL notifyTermination( const css::lang::EventObject& ) override - { - g_Pool1.clear(); - g_Pool2.clear(); - g_Pool3.clear(); - } - virtual void SAL_CALL disposing( const ::css::lang::EventObject& ) override - {} -}; -}; - -SfxItemPool& ChartItemPool::GetGlobalChartItemPool() +rtl::Reference<SfxItemPool> ChartItemPool::CreateChartItemPool() { - if (!g_Pool1) - { - // similar logic to SdrModel's pool, but with our chart pool tagged on the end - g_Pool1 = new SdrItemPool(nullptr); - g_Pool2 = EditEngine::CreatePool(); - g_Pool3 = new ChartItemPool(); - g_Pool1->SetSecondaryPool(g_Pool2.get()); - - g_Pool1->SetDefaultMetric(MapUnit::Map100thMM); - g_Pool1->SetPoolDefaultItem(SfxBoolItem(EE_PARA_HYPHENATE, true) ); - g_Pool1->SetPoolDefaultItem(makeSvx3DPercentDiagonalItem (5)); - - g_Pool2->SetSecondaryPool(g_Pool3.get()); - g_Pool1->FreezeIdRanges(); - - css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(comphelper::getProcessComponentContext()); - css::uno::Reference< css::frame::XTerminateListener > xListener( new TerminateListener ); - xDesktop->addTerminateListener( xListener ); - } - return *g_Pool1; + return new ChartItemPool(); } } // namespace chart diff --git a/chart2/source/view/main/ChartItemPool.hxx b/chart2/source/view/main/ChartItemPool.hxx index 2ac440183740..74a7ab1ebb29 100644 --- a/chart2/source/view/main/ChartItemPool.hxx +++ b/chart2/source/view/main/ChartItemPool.hxx @@ -29,18 +29,16 @@ class ChartItemPool : public SfxItemPool private: std::unique_ptr<SfxItemInfo[]> pItemInfos; +public: ChartItemPool(); ChartItemPool(const ChartItemPool& rPool); - -protected: virtual ~ChartItemPool() override; -public: virtual rtl::Reference<SfxItemPool> Clone() const override; MapUnit GetMetric(sal_uInt16 nWhich) const override; - /// get the pure chart item pool - static SfxItemPool& GetGlobalChartItemPool(); + /// creates a pure chart item pool + static rtl::Reference<SfxItemPool> CreateChartItemPool(); }; } // namespace chart diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index aa7a002c967a..6a6488435f97 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -25,6 +25,7 @@ #include <svl/itempool.hxx> #include <svx/objfac3d.hxx> #include <svx/svdpage.hxx> +#include <svx/svx3ditems.hxx> #include <svx/xtable.hxx> #include <svx/svdoutl.hxx> #include <editeng/unolingu.hxx> @@ -43,12 +44,22 @@ namespace chart { DrawModelWrapper::DrawModelWrapper() -: SdrModel(&ChartItemPool::GetGlobalChartItemPool()) +: SdrModel() { + m_xChartItemPool = ChartItemPool::CreateChartItemPool(); + SetScaleUnit(MapUnit::Map100thMM); SetScaleFraction(Fraction(1, 1)); SetDefaultFontHeight(423); // 12pt + SfxItemPool* pMasterPool = &GetItemPool(); + pMasterPool->SetDefaultMetric(MapUnit::Map100thMM); + pMasterPool->SetPoolDefaultItem(SfxBoolItem(EE_PARA_HYPHENATE, true) ); + pMasterPool->SetPoolDefaultItem(makeSvx3DPercentDiagonalItem (5)); + + // append chart pool to end of pool chain + pMasterPool->GetLastPoolInChain()->SetSecondaryPool(m_xChartItemPool.get()); + pMasterPool->FreezeIdRanges(); SetTextDefaults(); //this factory needs to be created before first use of 3D scenes once upon an office runtime @@ -92,6 +103,22 @@ DrawModelWrapper::DrawModelWrapper() DrawModelWrapper::~DrawModelWrapper() { + //remove m_pChartItemPool from pool chain + if(m_xChartItemPool) + { + SfxItemPool* pPool = &GetItemPool(); + for (;;) + { + SfxItemPool* pSecondary = pPool->GetSecondaryPool(); + if(pSecondary == m_xChartItemPool.get()) + { + pPool->SetSecondaryPool (nullptr); + break; + } + pPool = pSecondary; + } + m_xChartItemPool.clear(); + } m_pRefDevice.disposeAndClear(); }