sfx2/inc/autoredactdialog.hxx        |    2 +-
 sfx2/source/doc/autoredactdialog.cxx |   32 ++++++++++++++++----------------
 xmloff/source/core/xmlimp.cxx        |    8 ++++----
 3 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 9b68315b5e76423e2206f3306596f8cf6e4c16a4
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Mar 2 09:10:22 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Mar 2 08:56:38 2023 +0000

    allocate DocumentInfo inline
    
    it is only one word big
    
    Change-Id: I8b5fec4f44fcdeb2c22c00db2323e7427b11d209
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148084
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 3b6d79934a99..fd2ace1c6bd2 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -312,7 +312,7 @@ public:
 
     std::unique_ptr< xmloff::RDFaImportHelper > mpRDFaHelper;
 
-    std::unique_ptr< DocumentInfo > mpDocumentInfo;
+    std::optional< DocumentInfo > moDocumentInfo;
 
     SvXMLImport_Impl( uno::Reference< uno::XComponentContext > xContext,
                       OUString theImplementationName,
@@ -337,12 +337,12 @@ public:
 
     sal_uInt16 getGeneratorVersion( const SvXMLImport& rImport )
     {
-        if (!mpDocumentInfo)
+        if (!moDocumentInfo)
         {
-            mpDocumentInfo.reset( new DocumentInfo( rImport ) );
+            moDocumentInfo.emplace( rImport );
         }
 
-        return mpDocumentInfo->getGeneratorVersion();
+        return moDocumentInfo->getGeneratorVersion();
     }
 
     ::comphelper::UnoInterfaceToUniqueIdentifierMapper 
maInterfaceToIdentifierMapper;
commit 4547cc9428649af54480d4471154bd44c8480f5c
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Mar 2 09:07:21 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Mar 2 08:56:31 2023 +0000

    no need to allocate TargetsTable separately
    
    Change-Id: Ifc16a5c7137776c8375d83afb031999023a7424a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148083
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sfx2/inc/autoredactdialog.hxx b/sfx2/inc/autoredactdialog.hxx
index 540494c932ea..52a03cfd8a8f 100644
--- a/sfx2/inc/autoredactdialog.hxx
+++ b/sfx2/inc/autoredactdialog.hxx
@@ -102,7 +102,7 @@ class SfxAutoRedactDialog final : public SfxDialogController
     bool m_bIsValidState;
     bool m_bTargetsCopied;
 
-    std::unique_ptr<TargetsTable> m_xTargetsBox;
+    TargetsTable m_aTargetsBox;
     std::unique_ptr<weld::Button> m_xLoadBtn;
     std::unique_ptr<weld::Button> m_xSaveBtn;
     std::unique_ptr<weld::Button> m_xAddBtn;
diff --git a/sfx2/source/doc/autoredactdialog.cxx 
b/sfx2/source/doc/autoredactdialog.cxx
index 4831ac46d74f..6e438a90bd1b 100644
--- a/sfx2/source/doc/autoredactdialog.cxx
+++ b/sfx2/source/doc/autoredactdialog.cxx
@@ -196,7 +196,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, Save, weld::Button&, 
void)
 IMPL_LINK_NOARG(SfxAutoRedactDialog, AddHdl, weld::Button&, void)
 {
     // Open the Add Target dialog, create a new target and insert into the 
targets vector and the listbox
-    SfxAddTargetDialog aAddTargetDialog(getDialog(), 
m_xTargetsBox->GetNameProposal());
+    SfxAddTargetDialog aAddTargetDialog(getDialog(), 
m_aTargetsBox.GetNameProposal());
 
     bool bIncomplete;
     do
@@ -216,7 +216,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, AddHdl, weld::Button&, 
void)
                 SfxResId(STR_REDACTION_FIELDS_REQUIRED)));
             xBox->run();
         }
-        else if (m_xTargetsBox->GetTargetByName(aAddTargetDialog.getName()))
+        else if (m_aTargetsBox.GetTargetByName(aAddTargetDialog.getName()))
         {
             bIncomplete = true;
             std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(
@@ -233,10 +233,10 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, AddHdl, 
weld::Button&, void)
           aAddTargetDialog.isCaseSensitive(), aAddTargetDialog.isWholeWords(), 
0 });
 
     // Only the visual/display part
-    m_xTargetsBox->InsertTarget(redactiontarget);
+    m_aTargetsBox.InsertTarget(redactiontarget);
 
     // Actually add to the targets vector
-    if (m_xTargetsBox->GetTargetByName(redactiontarget->sName))
+    if (m_aTargetsBox.GetTargetByName(redactiontarget->sName))
         m_aTableTargets.emplace_back(redactiontarget, redactiontarget->sName);
     else
     {
@@ -250,14 +250,14 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, AddHdl, 
weld::Button&, void)
 
 IMPL_LINK_NOARG(SfxAutoRedactDialog, EditHdl, weld::Button&, void)
 {
-    sal_Int32 nSelectedRow = m_xTargetsBox->get_selected_index();
+    sal_Int32 nSelectedRow = m_aTargetsBox.get_selected_index();
 
     // No selection, nothing to edit
     if (nSelectedRow < 0)
         return;
 
     // Only one entry should be selected for editing
-    if (m_xTargetsBox->get_selected_rows().size() > 1)
+    if (m_aTargetsBox.get_selected_rows().size() > 1)
     {
         //Warn the user about multiple selections
         std::unique_ptr<weld::MessageDialog> xBox(
@@ -268,7 +268,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, EditHdl, 
weld::Button&, void)
     }
 
     // Get the redaction target to be edited
-    RedactionTarget* pTarget = 
weld::fromId<RedactionTarget*>(m_xTargetsBox->get_id(nSelectedRow));
+    RedactionTarget* pTarget = 
weld::fromId<RedactionTarget*>(m_aTargetsBox.get_id(nSelectedRow));
 
     // Construct and run the edit target dialog
     SfxAddTargetDialog aEditTargetDialog(getDialog(), pTarget->sName, 
pTarget->sType,
@@ -294,7 +294,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, EditHdl, 
weld::Button&, void)
             xBox->run();
         }
         else if (aEditTargetDialog.getName() != pTarget->sName
-                 && 
m_xTargetsBox->GetTargetByName(aEditTargetDialog.getName()))
+                 && m_aTargetsBox.GetTargetByName(aEditTargetDialog.getName()))
         {
             bIncomplete = true;
             std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(
@@ -313,7 +313,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, EditHdl, 
weld::Button&, void)
     pTarget->bWholeWords = aEditTargetDialog.isWholeWords();
 
     // And sync the targets box row with the actual target data
-    m_xTargetsBox->setRowData(nSelectedRow, pTarget);
+    m_aTargetsBox.setRowData(nSelectedRow, pTarget);
 }
 IMPL_LINK_NOARG(SfxAutoRedactDialog, DoubleClickEditHdl, weld::TreeView&, bool)
 {
@@ -323,7 +323,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, DoubleClickEditHdl, 
weld::TreeView&, bool)
 }
 IMPL_LINK_NOARG(SfxAutoRedactDialog, DeleteHdl, weld::Button&, void)
 {
-    std::vector<int> aSelectedRows = m_xTargetsBox->get_selected_rows();
+    std::vector<int> aSelectedRows = m_aTargetsBox.get_selected_rows();
 
     //No selection, so nothing to delete
     if (aSelectedRows.empty())
@@ -345,7 +345,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, DeleteHdl, 
weld::Button&, void)
     for (const auto& i : aSelectedRows)
     {
         m_aTableTargets.erase(m_aTableTargets.begin() + (i - delta));
-        m_xTargetsBox->remove(i - delta++);
+        m_aTargetsBox.remove(i - delta++);
     }
 }
 
@@ -497,11 +497,11 @@ void 
SfxAutoRedactDialog::StartFileDialog(StartFileDialogType nType, const OUStr
 void SfxAutoRedactDialog::addTarget(std::unique_ptr<RedactionTarget> pTarget)
 {
     // Only the visual/display part
-    m_xTargetsBox->InsertTarget(pTarget.get());
+    m_aTargetsBox.InsertTarget(pTarget.get());
 
     // Actually add to the targets vector
     auto name = pTarget->sName;
-    if (m_xTargetsBox->GetTargetByName(name))
+    if (m_aTargetsBox.GetTargetByName(name))
         m_aTableTargets.emplace_back(std::move(pTarget), name);
     else
     {
@@ -515,7 +515,7 @@ void 
SfxAutoRedactDialog::addTarget(std::unique_ptr<RedactionTarget> pTarget)
 void SfxAutoRedactDialog::clearTargets()
 {
     // Clear the targets box
-    m_xTargetsBox->clear();
+    m_aTargetsBox.clear();
 
     // Clear the targets vector
     m_aTableTargets.clear();
@@ -525,7 +525,7 @@ SfxAutoRedactDialog::SfxAutoRedactDialog(weld::Window* 
pParent)
     : SfxDialogController(pParent, "sfx/ui/autoredactdialog.ui", 
"AutoRedactDialog")
     , m_bIsValidState(true)
     , m_bTargetsCopied(false)
-    , m_xTargetsBox(new TargetsTable(m_xBuilder->weld_tree_view("targets")))
+    , m_aTargetsBox(m_xBuilder->weld_tree_view("targets"))
     , m_xLoadBtn(m_xBuilder->weld_button("btnLoadTargets"))
     , m_xSaveBtn(m_xBuilder->weld_button("btnSaveTargets"))
     , m_xAddBtn(m_xBuilder->weld_button("add"))
@@ -578,7 +578,7 @@ SfxAutoRedactDialog::SfxAutoRedactDialog(weld::Window* 
pParent)
     m_xAddBtn->connect_clicked(LINK(this, SfxAutoRedactDialog, AddHdl));
     m_xEditBtn->connect_clicked(LINK(this, SfxAutoRedactDialog, EditHdl));
     m_xDeleteBtn->connect_clicked(LINK(this, SfxAutoRedactDialog, DeleteHdl));
-    m_xTargetsBox->connect_row_activated(LINK(this, SfxAutoRedactDialog, 
DoubleClickEditHdl));
+    m_aTargetsBox.connect_row_activated(LINK(this, SfxAutoRedactDialog, 
DoubleClickEditHdl));
 }
 
 SfxAutoRedactDialog::~SfxAutoRedactDialog()

Reply via email to