sw/source/filter/ww8/docxattributeoutput.cxx |   47 +++++++++++++--------------
 sw/source/filter/ww8/docxattributeoutput.hxx |    2 -
 sw/source/filter/ww8/docxtableexport.cxx     |    2 -
 sw/source/filter/ww8/wrtww8.cxx              |    6 +--
 sw/source/filter/ww8/wrtww8.hxx              |    5 +-
 sw/source/filter/ww8/wrtww8gr.cxx            |    2 -
 sw/source/uibase/inc/navipi.hxx              |    5 +-
 sw/source/uibase/utlui/navipi.cxx            |   16 ++++-----
 8 files changed, 43 insertions(+), 42 deletions(-)

New commits:
commit b47ac2b1e828afe9bbe98650bc701b940ef5920a
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Mar 2 11:18:13 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Mar 2 11:05:53 2023 +0000

    flatten some classes in sw
    
    no need to allocate separately where the contained class is only one
    pointer big
    
    Change-Id: Iae64ad45ccd9b6f2cf3f463c4c17ae7f70db6a8e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148088
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index ff8ed2763cb9..6d2ac92d1a43 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -426,9 +426,9 @@ sal_Int32 
DocxAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t p
     if ( pTextNodeInfo )
     {
         // New cell/row?
-        if ( m_tableReference->m_nTableDepth > 0 && 
!m_tableReference->m_bTableCellOpen )
+        if ( m_tableReference.m_nTableDepth > 0 && 
!m_tableReference.m_bTableCellOpen )
         {
-            ww8::WW8TableNodeInfoInner::Pointer_t pDeepInner( 
pTextNodeInfo->getInnerForDepth( m_tableReference->m_nTableDepth ) );
+            ww8::WW8TableNodeInfoInner::Pointer_t pDeepInner( 
pTextNodeInfo->getInnerForDepth( m_tableReference.m_nTableDepth ) );
             if ( pDeepInner->getCell() == 0 )
                 StartTableRow( pDeepInner );
 
@@ -448,10 +448,10 @@ sal_Int32 
DocxAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t p
             // continue the table cell]
             sal_uInt32 nCurrentDepth = pTextNodeInfo->getDepth();
 
-            if ( nCurrentDepth > m_tableReference->m_nTableDepth )
+            if ( nCurrentDepth > m_tableReference.m_nTableDepth )
             {
                 // Start all the tables that begin here
-                for ( sal_uInt32 nDepth = m_tableReference->m_nTableDepth + 1; 
nDepth <= nCurrentDepth; ++nDepth )
+                for ( sal_uInt32 nDepth = m_tableReference.m_nTableDepth + 1; 
nDepth <= nCurrentDepth; ++nDepth )
                 {
                     ww8::WW8TableNodeInfoInner::Pointer_t pInner( 
pTextNodeInfo->getInnerForDepth( nDepth ) );
 
@@ -461,7 +461,7 @@ sal_Int32 
DocxAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t p
                     StartTableCell(pInner, 0, nDepth == nCurrentDepth ? nRow : 
0);
                 }
 
-                m_tableReference->m_nTableDepth = nCurrentDepth;
+                m_tableReference.m_nTableDepth = nCurrentDepth;
             }
         }
     }
@@ -1111,8 +1111,8 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 
         if (m_aParagraphSdt.m_bStartedSdt)
         {
-            if (m_tableReference->m_bTableCellOpen)
-                m_tableReference->m_bTableCellParaSdtOpen = true;
+            if (m_tableReference.m_bTableCellOpen)
+                m_tableReference.m_bTableCellParaSdtOpen = true;
             if (m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen())
                 m_rExport.SdrExporter().setParagraphSdtOpen(true);
         }
@@ -1201,7 +1201,7 @@ void DocxAttributeOutput::FinishTableRowCell( 
ww8::WW8TableNodeInfoInner::Pointe
 
     if (bEndCell)
     {
-        while (pInner->getDepth() < m_tableReference->m_nTableDepth)
+        while (pInner->getDepth() < m_tableReference.m_nTableDepth)
         {
             //we expect that the higher depth row was closed, and
             //we are just missing the table close
@@ -1270,7 +1270,7 @@ void DocxAttributeOutput::SectionBreaks(const SwNode& 
rNode)
         if (aNextIndex.GetNode().IsTextNode())
         {
             const SwTextNode* pTextNode = 
static_cast<SwTextNode*>(&aNextIndex.GetNode());
-            m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), 
*pTextNode, m_tableReference->m_bTableCellOpen);
+            m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), 
*pTextNode, m_tableReference.m_bTableCellOpen);
         }
         else if (aNextIndex.GetNode().IsTableNode())
         {
@@ -1287,7 +1287,7 @@ void DocxAttributeOutput::SectionBreaks(const SwNode& 
rNode)
             // Also handle section endings
             const SwTextNode* pTextNode = aNextIndex.GetNode().GetTextNode();
             if (rNode.StartOfSectionNode()->IsTableNode() || 
rNode.StartOfSectionNode()->IsSectionNode())
-                m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), 
*pTextNode, m_tableReference->m_bTableCellOpen);
+                m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), 
*pTextNode, m_tableReference.m_bTableCellOpen);
         }
         else if (aNextIndex.GetNode().IsTableNode())
         {
@@ -4424,8 +4424,8 @@ void DocxAttributeOutput::EndTable()
 {
     m_pSerializer->endElementNS( XML_w, XML_tbl );
 
-    if ( m_tableReference->m_nTableDepth > 0 )
-        --m_tableReference->m_nTableDepth;
+    if ( m_tableReference.m_nTableDepth > 0 )
+        --m_tableReference.m_nTableDepth;
 
     m_LastClosedCell.pop_back();
     m_LastOpenCell.pop_back();
@@ -4435,7 +4435,7 @@ void DocxAttributeOutput::EndTable()
     // still continues
     // set to true only if we were in a nested table, not otherwise.
     if( !m_TableFirstCells.empty() )
-        m_tableReference->m_bTableCellOpen = true;
+        m_tableReference.m_bTableCellOpen = true;
 
     // Cleans the table helper
     m_xTableWrt.reset();
@@ -4494,7 +4494,7 @@ void DocxAttributeOutput::StartTableCell( 
ww8::WW8TableNodeInfoInner::Pointer_t
     // Write the cell properties here
     TableCellProperties( pTableTextNodeInfoInner, nCell, nRow );
 
-    m_tableReference->m_bTableCellOpen = true;
+    m_tableReference.m_bTableCellOpen = true;
 }
 
 void DocxAttributeOutput::EndTableCell(sal_uInt32 nCell)
@@ -4502,13 +4502,13 @@ void DocxAttributeOutput::EndTableCell(sal_uInt32 nCell)
     m_LastClosedCell.back() = nCell;
     m_LastOpenCell.back() = -1;
 
-    if (m_tableReference->m_bTableCellParaSdtOpen)
+    if (m_tableReference.m_bTableCellParaSdtOpen)
         EndParaSdtBlock();
 
     m_pSerializer->endElementNS( XML_w, XML_tc );
 
-    m_tableReference->m_bTableCellOpen = false;
-    m_tableReference->m_bTableCellParaSdtOpen = false;
+    m_tableReference.m_bTableCellOpen = false;
+    m_tableReference.m_bTableCellParaSdtOpen = false;
 }
 
 void DocxAttributeOutput::StartStyles()
@@ -6254,11 +6254,11 @@ void 
DocxAttributeOutput::pushToTableExportContext(DocxTableExportContext& rCont
     rContext.m_pTableInfo = m_rExport.m_pTableInfo;
     m_rExport.m_pTableInfo = std::make_shared<ww8::WW8TableInfo>();
 
-    rContext.m_bTableCellOpen = m_tableReference->m_bTableCellOpen;
-    m_tableReference->m_bTableCellOpen = false;
+    rContext.m_bTableCellOpen = m_tableReference.m_bTableCellOpen;
+    m_tableReference.m_bTableCellOpen = false;
 
-    rContext.m_nTableDepth = m_tableReference->m_nTableDepth;
-    m_tableReference->m_nTableDepth = 0;
+    rContext.m_nTableDepth = m_tableReference.m_nTableDepth;
+    m_tableReference.m_nTableDepth = 0;
 
     rContext.m_bStartedParaSdt = m_aParagraphSdt.m_bStartedSdt;
     m_aParagraphSdt.m_bStartedSdt = false;
@@ -6272,8 +6272,8 @@ void 
DocxAttributeOutput::pushToTableExportContext(DocxTableExportContext& rCont
 void DocxAttributeOutput::popFromTableExportContext(DocxTableExportContext 
const & rContext)
 {
     m_rExport.m_pTableInfo = rContext.m_pTableInfo;
-    m_tableReference->m_bTableCellOpen = rContext.m_bTableCellOpen;
-    m_tableReference->m_nTableDepth = rContext.m_nTableDepth;
+    m_tableReference.m_bTableCellOpen = rContext.m_bTableCellOpen;
+    m_tableReference.m_nTableDepth = rContext.m_nTableDepth;
     m_aParagraphSdt.m_bStartedSdt = rContext.m_bStartedParaSdt;
     m_aRunSdt.m_bStartedSdt = rContext.m_bStartedRunSdt;
     m_nHyperLinkCount = rContext.m_nHyperLinkCount;
@@ -9959,7 +9959,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport 
&rExport, const FSHelperPtr
       m_postitFieldsMaxId( 0 ),
       m_anchorId( 1 ),
       m_nextFontId( 1 ),
-      m_tableReference(new TableReference()),
       m_bIgnoreNextFill(false),
       
m_pTableStyleExport(std::make_shared<DocxTableStyleExport>(rExport.m_rDoc, 
pSerializer)),
       m_bParaBeforeAutoSpacing(false),
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index 99f7c7c55803..fcb21083acfe 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -1015,7 +1015,7 @@ private:
         OString fontKey;
     };
 
-    std::unique_ptr<TableReference> m_tableReference;
+    TableReference m_tableReference;
 
     std::map< OUString, EmbeddedFontRef > m_FontFilesMap; // font file url to 
data
 
diff --git a/sw/source/filter/ww8/docxtableexport.cxx 
b/sw/source/filter/ww8/docxtableexport.cxx
index 45cd8f3fbb1c..36f45edf4e12 100644
--- a/sw/source/filter/ww8/docxtableexport.cxx
+++ b/sw/source/filter/ww8/docxtableexport.cxx
@@ -463,7 +463,7 @@ void DocxAttributeOutput::TableDefinition(
 
             const SwFrameFormat* pFrameFormat
                 = pTableTextNodeInfoInner->getTableBox()->GetFrameFormat();
-            if ((0 < nMode && nMode <= 14) && m_tableReference->m_nTableDepth 
== 0)
+            if ((0 < nMode && nMode <= 14) && m_tableReference.m_nTableDepth 
== 0)
                 nIndent += 
pFrameFormat->GetBox().GetDistance(SvxBoxItemLine::LEFT);
             else
             {
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 625583ee179f..ad5ec5e8bcf2 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3341,7 +3341,7 @@ ErrCode MSWordExportBase::ExportDocument( bool bWriteAll )
     m_pRedlAuthors = nullptr;
     m_aTOXArr.clear();
 
-    if ( !m_pOLEExp )
+    if ( !m_oOLEExp )
     {
         sal_uInt32 nSvxMSDffOLEConvFlags = 0;
         const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
@@ -3354,7 +3354,7 @@ ErrCode MSWordExportBase::ExportDocument( bool bWriteAll )
         if ( rOpt.IsImpress2PowerPoint() )
             nSvxMSDffOLEConvFlags |= OLE_STARIMPRESS_2_POWERPOINT;
 
-        m_pOLEExp.reset(new SvxMSExportOLEObjects( nSvxMSDffOLEConvFlags ));
+        m_oOLEExp.emplace( nSvxMSDffOLEConvFlags );
     }
 
     if ( !m_pOCXExp && m_rDoc.GetDocShell() )
@@ -3912,7 +3912,7 @@ MSWordExportBase::~MSWordExportBase()
         m_pUsedNumTable->erase(m_pUsedNumTable->begin(), 
m_pUsedNumTable->begin() + m_pUsedNumTable->size() - m_nUniqueList);
         m_pUsedNumTable.reset();
     }
-    m_pOLEExp.reset();
+    m_oOLEExp.reset();
     m_pOCXExp.reset();
 }
 
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index f7bcce6d8d72..cc1438e9d056 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -26,6 +26,7 @@
 #include <tools/gen.hxx>
 #include <editeng/editdata.hxx>
 #include <filter/msfilter/ww8fields.hxx>
+#include <filter/msfilter/msoleexp.hxx>
 
 #include <shellio.hxx>
 
@@ -48,6 +49,7 @@
 #include <cstddef>
 #include <memory>
 #include <map>
+#include <optional>
 #include <string_view>
 #include <vector>
 
@@ -121,7 +123,6 @@ class WW8_WrPlcTextBoxes;
 class WW8_WrPct;            // administration
 class WW8_WrtBookmarks;
 class WW8_WrtRedlineAuthor;
-class SvxMSExportOLEObjects;
 class SwMSConvertControls;
 class WW8_WrPc;
 struct WW8_PdAttrDesc;
@@ -472,7 +473,7 @@ public:
     std::unique_ptr<WW8_WrtBookmarks> m_pBkmks;
     std::unique_ptr<WW8_WrtRedlineAuthor> m_pRedlAuthors;
     std::shared_ptr<NfKeywordTable> m_pKeyMap;
-    std::unique_ptr<SvxMSExportOLEObjects> m_pOLEExp;
+    std::optional<SvxMSExportOLEObjects> m_oOLEExp;
     std::unique_ptr<SwMSConvertControls> m_pOCXExp;
     WW8OleMap m_aOleMap;    // To remember all already exported ole objects
     ww8::WW8TableInfo::Pointer_t m_pTableInfo;
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx 
b/sw/source/filter/ww8/wrtww8gr.cxx
index 93560463a261..6ec9cc6e8f08 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -239,7 +239,7 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode )
     {
         sal_Int64 nAspect = rOLENode.GetAspect();
         svt::EmbeddedObjectRef aObjRef( xObj, nAspect );
-        m_pOLEExp->ExportOLEObject( aObjRef, *xOleStg );
+        m_oOLEExp->ExportOLEObject( aObjRef, *xOleStg );
         if ( nAspect == embed::Aspects::MSOLE_ICON )
         {
             OUString aObjInfo( "\3ObjInfo" );
diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx
index 32b82ab6954a..9e91e9f1d86f 100644
--- a/sw/source/uibase/inc/navipi.hxx
+++ b/sw/source/uibase/inc/navipi.hxx
@@ -23,6 +23,7 @@
 #include <svl/lstner.hxx>
 #include <vcl/transfer.hxx>
 #include <sfx2/childwin.hxx>
+#include <sfx2/objsh.hxx>
 #include <sfx2/sidebar/ControllerItem.hxx>
 #include <sfx2/navigat.hxx>
 #include <sfx2/weldutils.hxx>
@@ -30,12 +31,12 @@
 #include "conttree.hxx"
 #include <ndarr.hxx>
 #include <memory>
+#include <optional>
 
 class SwWrtShell;
 class SfxBindings;
 class SwNavigationConfig;
 class SwView;
-class SfxObjectShellLock;
 enum class RegionMode;
 class SpinField;
 
@@ -75,7 +76,7 @@ class SwNavigationPI final : public PanelLayout
 
     VclPtr<SfxNavigator> m_xNavigatorDlg;
 
-    std::unique_ptr<SfxObjectShellLock>  m_pxObjectShell;
+    std::optional<SfxObjectShellLock>  m_oObjectShell;
     SwView              *m_pContentView;
     SwWrtShell          *m_pContentWrtShell;
     SwView              *m_pActContView;
diff --git a/sw/source/uibase/utlui/navipi.cxx 
b/sw/source/uibase/utlui/navipi.cxx
index 32d1b6fb5dfa..a0a00fe073e0 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -703,11 +703,11 @@ SwNavigationPI::~SwNavigationPI()
 
     EndListening(*SfxGetpApp());
 
-    if (m_pxObjectShell)
+    if (m_oObjectShell)
     {
-        if (m_pxObjectShell->Is())
-            (*m_pxObjectShell)->DoClose();
-        m_pxObjectShell.reset();
+        if (m_oObjectShell->Is())
+            (*m_oObjectShell)->DoClose();
+        m_oObjectShell.reset();
     }
 
     m_xDocListBox.reset();
@@ -927,7 +927,7 @@ IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem const *, 
pItem, void)
             m_pContentWrtShell = m_pContentView->GetWrtShellPtr();
         else
             m_pContentWrtShell = nullptr;
-        m_pxObjectShell.reset( new 
SfxObjectShellLock(pFrame->GetObjectShell()) );
+        m_oObjectShell.emplace( pFrame->GetObjectShell() );
         FillBox();
     }
 }
@@ -1004,11 +1004,11 @@ sal_Int8 SwNavigationPI::ExecuteDrop( const 
ExecuteDropEvent& rEvt )
         nRet = rEvt.mnAction;
         sFileName = comphelper::string::stripEnd(sFileName, 0);
         m_sContentFileName = sFileName;
-        if(m_pxObjectShell)
+        if(m_oObjectShell)
         {
             m_xContentTree->SetHiddenShell( nullptr );
-            (*m_pxObjectShell)->DoClose();
-            m_pxObjectShell.reset();
+            (*m_oObjectShell)->DoClose();
+            m_oObjectShell.reset();
         }
         SfxStringItem aFileItem(SID_FILE_NAME, sFileName );
         SfxStringItem aOptionsItem( SID_OPTIONS, "HRC" );

Reply via email to