summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-10-13 16:29:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-10-14 08:17:50 +0200
commit94ea3a18829914aa76b5534f8a551ad37d59cf07 (patch)
tree2f5976083460a8b4a7a62fa1466667d13d907a73 /sw
parent0927bdaf6e9aa58fc443f1c011aa1cc53c8d7cad (diff)
loplugin:mergeclasses merge SwComboBox with CaptionComboBox
Change-Id: Ieef8f00cb1f6f8fb62ad385d1085e8a63161a710
Diffstat (limited to 'sw')
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/source/ui/config/optload.cxx69
-rw-r--r--sw/source/uibase/cctrl/swlbox.cxx101
-rw-r--r--sw/source/uibase/inc/bookmark.hxx1
-rw-r--r--sw/source/uibase/inc/cption.hxx12
-rw-r--r--sw/source/uibase/inc/optload.hxx21
-rw-r--r--sw/source/uibase/inc/swlbox.hxx72
7 files changed, 81 insertions, 196 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 403e29bf2320..59cadd91cb10 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -572,7 +572,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/uibase/app/swmodule \
sw/source/uibase/app/swwait \
sw/source/uibase/cctrl/actctrl \
- sw/source/uibase/cctrl/swlbox \
sw/source/uibase/chrdlg/ccoll \
sw/source/uibase/config/StoredChapterNumbering \
sw/source/uibase/config/barcfg \
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 4577c53cf567..81eebd4c1635 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -714,15 +714,15 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ShowEntryHdl, SvTreeListBox*, void)
SwFieldType *pType = pMgr->GetFieldType( USHRT_MAX, i );
if( pType->Which() == RES_SETEXPFLD &&
static_cast<SwSetExpFieldType *>( pType)->GetType() & nsSwGetSetExpType::GSE_SEQ )
- m_pCategoryBox->InsertSwEntry(SwBoxEntry(pType->GetName()));
+ m_pCategoryBox->InsertSwEntry(pType->GetName());
}
}
else
{
- m_pCategoryBox->InsertSwEntry(SwBoxEntry(m_sIllustration));
- m_pCategoryBox->InsertSwEntry(SwBoxEntry(m_sTable));
- m_pCategoryBox->InsertSwEntry(SwBoxEntry(m_sText));
- m_pCategoryBox->InsertSwEntry(SwBoxEntry(m_sDrawing));
+ m_pCategoryBox->InsertSwEntry(m_sIllustration);
+ m_pCategoryBox->InsertSwEntry(m_sTable);
+ m_pCategoryBox->InsertSwEntry(m_sText);
+ m_pCategoryBox->InsertSwEntry(m_sDrawing);
}
if(!pOpt->GetCategory().isEmpty())
@@ -742,7 +742,7 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ShowEntryHdl, SvTreeListBox*, void)
case TABLE_CAP: nPos = 2; break;
case FRAME_CAP: nPos = 3; break;
}
- m_pCategoryBox->SetText(m_pCategoryBox->GetSwEntry(nPos).GetName());
+ m_pCategoryBox->SetText(m_pCategoryBox->GetSwEntry(nPos));
}
for (sal_Int32 i = 0; i < m_pFormatBox->GetEntryCount(); i++)
@@ -930,11 +930,66 @@ void SwCaptionOptPage::InvalidatePreview()
m_pPreview->SetPreviewText(aStr);
}
+CaptionComboBox::CaptionComboBox(vcl::Window* pParent, WinBits nStyle)
+ : ComboBox(pParent, nStyle)
+{
+ // create administration for the resource's Stringlist
+ sal_Int32 nSize = GetEntryCount();
+ for( sal_Int32 i=0; i < nSize; ++i )
+ {
+ m_EntryList.push_back(ComboBox::GetEntry(i));
+ }
+}
+
+CaptionComboBox::~CaptionComboBox()
+{
+}
+
+sal_Int32 CaptionComboBox::InsertEntry(const OUString& rStr, sal_Int32)
+{
+ InsertSwEntry(rStr);
+ return 0;
+}
+
+void CaptionComboBox::InsertSwEntry(const OUString& rEntry)
+{
+ InsertSorted(rEntry);
+}
+
+void CaptionComboBox::InsertSorted(OUString const& rEntry)
+{
+ ComboBox::InsertEntry(rEntry);
+ sal_Int32 nPos = ComboBox::GetEntryPos(rEntry);
+ m_EntryList.insert(m_EntryList.begin() + nPos, rEntry);
+}
+
+void CaptionComboBox::RemoveEntryAt(sal_Int32 const nPos)
+{
+ if (nPos < 0 || static_cast<size_t>(nPos) >= m_EntryList.size())
+ return;
+
+ // Remove old element
+ ComboBox::RemoveEntryAt(nPos);
+
+ // Don't add new entries to the list
+ // add to DelEntryList
+ m_DelEntryList.push_back(m_EntryList[nPos]);
+ m_EntryList.erase(m_EntryList.begin() + nPos);
+}
+
+const OUString& CaptionComboBox::GetSwEntry(sal_Int32 const nPos) const
+{
+ if (0 <= nPos && static_cast<size_t>(nPos) < m_EntryList.size())
+ return m_EntryList[nPos];
+
+ return aDefault;
+}
+
// Description: ComboBox without Spaces
void CaptionComboBox::KeyInput(const KeyEvent& rEvt)
{
if (rEvt.GetKeyCode().GetCode() != KEY_SPACE)
- SwComboBox::KeyInput(rEvt);
+ ComboBox::KeyInput(rEvt);
}
VCL_BUILDER_DECL_FACTORY(CaptionComboBox)
diff --git a/sw/source/uibase/cctrl/swlbox.cxx b/sw/source/uibase/cctrl/swlbox.cxx
deleted file mode 100644
index 6db094e00d13..000000000000
--- a/sw/source/uibase/cctrl/swlbox.cxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- 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 .
- */
-
-#include <osl/diagnose.h>
-#include <unotools/charclass.hxx>
-#include <swtypes.hxx>
-#include <swlbox.hxx>
-
-// Description: ListboxElement
-SwBoxEntry::SwBoxEntry()
-{
-}
-
-SwBoxEntry::SwBoxEntry(const OUString& aNam) :
- aName(aNam)
-{
-}
-
-SwBoxEntry::SwBoxEntry(const SwBoxEntry& rOld) :
- aName(rOld.aName)
-{
-}
-
-SwComboBox::SwComboBox(vcl::Window* pParent, WinBits nStyle)
- : ComboBox(pParent, nStyle)
-{
- Init();
-}
-
-void SwComboBox::Init()
-{
- // create administration for the resource's Stringlist
- sal_Int32 nSize = GetEntryCount();
- for( sal_Int32 i=0; i < nSize; ++i )
- {
- m_EntryList.push_back(SwBoxEntry(ComboBox::GetEntry(i)));
- }
-}
-
-// Basic class Dtor
-SwComboBox::~SwComboBox()
-{
-}
-
-void SwComboBox::InsertSwEntry(const SwBoxEntry& rEntry)
-{
- InsertSorted(rEntry);
-}
-
-sal_Int32 SwComboBox::InsertEntry(const OUString& rStr, sal_Int32)
-{
- InsertSwEntry(SwBoxEntry(rStr));
- return 0;
-}
-
-void SwComboBox::RemoveEntryAt(sal_Int32 const nPos)
-{
- if (nPos < 0 || static_cast<size_t>(nPos) >= m_EntryList.size())
- return;
-
- // Remove old element
- ComboBox::RemoveEntryAt(nPos);
-
- // Don't add new entries to the list
- // add to DelEntryList
- m_DelEntryList.push_back(m_EntryList[nPos]);
- m_EntryList.erase(m_EntryList.begin() + nPos);
-}
-
-const SwBoxEntry& SwComboBox::GetSwEntry(sal_Int32 const nPos) const
-{
- if (0 <= nPos && static_cast<size_t>(nPos) < m_EntryList.size())
- return m_EntryList[nPos];
-
- return aDefault;
-}
-
-void SwComboBox::InsertSorted(SwBoxEntry const& rEntry)
-{
- ComboBox::InsertEntry(rEntry.aName);
- sal_Int32 nPos = ComboBox::GetEntryPos(rEntry.aName);
- m_EntryList.insert(m_EntryList.begin() + nPos, rEntry);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/bookmark.hxx b/sw/source/uibase/inc/bookmark.hxx
index 9d6d471222d9..d1ea987d474c 100644
--- a/sw/source/uibase/inc/bookmark.hxx
+++ b/sw/source/uibase/inc/bookmark.hxx
@@ -27,7 +27,6 @@
#include <svtools/simptabl.hxx>
#include <pam.hxx>
-#include "swlbox.hxx"
#include "IMark.hxx"
class SwWrtShell;
diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx
index 75d664c1a60d..0a7e3d322212 100644
--- a/sw/source/uibase/inc/cption.hxx
+++ b/sw/source/uibase/inc/cption.hxx
@@ -20,15 +20,10 @@
#define INCLUDED_SW_SOURCE_UIBASE_INC_CPTION_HXX
#include <svx/stddlg.hxx>
-
#include <vcl/fixed.hxx>
-
#include <vcl/lstbox.hxx>
-
#include <vcl/edit.hxx>
-
#include <vcl/group.hxx>
-
#include <vcl/button.hxx>
#include <actctrl.hxx>
@@ -41,12 +36,11 @@
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNamed.hpp>
-class SwFieldMgr;
-class SwView;
-
#include <wrtsh.hxx>
#include "optload.hxx"
-#include "swlbox.hxx"
+
+class SwFieldMgr;
+class SwView;
class TextFilterAutoConvert : public TextFilter
{
diff --git a/sw/source/uibase/inc/optload.hxx b/sw/source/uibase/inc/optload.hxx
index 829008b26a2a..ddf8f2a1461f 100644
--- a/sw/source/uibase/inc/optload.hxx
+++ b/sw/source/uibase/inc/optload.hxx
@@ -29,7 +29,6 @@
#include <svx/strarray.hxx>
#include <sfx2/basedlgs.hxx>
#include <svx/checklbx.hxx>
-#include <swlbox.hxx>
#include <caption.hxx>
class SwFieldMgr;
@@ -80,15 +79,27 @@ public:
SwCaptionOptDlg(vcl::Window* pParent, const SfxItemSet& rSet);
};
-class CaptionComboBox : public SwComboBox
+class CaptionComboBox : public ComboBox
{
+ std::vector<OUString> m_EntryList;
+ std::vector<OUString> m_DelEntryList;
+ OUString aDefault;
+
+ void InsertSorted(OUString const& rEntry);
+
protected:
virtual void KeyInput( const KeyEvent& ) override;
public:
- CaptionComboBox(vcl::Window* pParent, WinBits nStyle)
- : SwComboBox(pParent, nStyle)
- {}
+ CaptionComboBox(vcl::Window* pParent, WinBits nStyle);
+ virtual ~CaptionComboBox() override;
+
+ void InsertSwEntry(const OUString&);
+ virtual sal_Int32 InsertEntry(const OUString& rStr, sal_Int32 = COMBOBOX_APPEND) override;
+
+ virtual void RemoveEntryAt(sal_Int32 nPos) override;
+
+ const OUString& GetSwEntry(sal_Int32) const;
};
class SwCaptionPreview : public vcl::Window
diff --git a/sw/source/uibase/inc/swlbox.hxx b/sw/source/uibase/inc/swlbox.hxx
deleted file mode 100644
index a8984bbe1ecf..000000000000
--- a/sw/source/uibase/inc/swlbox.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- 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 .
- */
-#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWLBOX_HXX
-#define INCLUDED_SW_SOURCE_UIBASE_INC_SWLBOX_HXX
-
-#include <vcl/lstbox.hxx>
-#include <vcl/combobox.hxx>
-#include "swdllapi.h"
-
-#include <vector>
-
-class SwBoxEntry;
-namespace vcl { class Window; }
-
-typedef std::vector<SwBoxEntry> SwEntryList;
-
-class SW_DLLPUBLIC SwBoxEntry
-{
- friend class SwComboBox;
-
- OUString aName;
-
-public:
- SwBoxEntry(const OUString& aName);
- SwBoxEntry(const SwBoxEntry& rOrg);
- SwBoxEntry();
-
- const OUString& GetName() const { return aName;}
-};
-
-// for combo boxes
-class SW_DLLPUBLIC SwComboBox : public ComboBox
-{
- SwEntryList m_EntryList;
- SwEntryList m_DelEntryList;
- SwBoxEntry aDefault;
-
- SAL_DLLPRIVATE void InsertSorted(SwBoxEntry const& rEntry);
- SAL_DLLPRIVATE void Init();
-
-public:
-
- SwComboBox(vcl::Window* pParent, WinBits nStyle);
- virtual ~SwComboBox() override;
-
- void InsertSwEntry(const SwBoxEntry&);
- virtual sal_Int32 InsertEntry(const OUString& rStr, sal_Int32 = COMBOBOX_APPEND) override;
-
- virtual void RemoveEntryAt(sal_Int32 nPos) override;
-
- const SwBoxEntry& GetSwEntry(sal_Int32) const;
-};
-
-#endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWLBOX_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */