[Libreoffice-commits] core.git: dbaccess/source framework/source include/unotools sfx2/source svtools/source unotools/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 27 06:44:05 UTC 2021
dbaccess/source/ui/app/AppController.cxx | 2
dbaccess/source/ui/control/opendoccontrols.cxx | 14
framework/source/uielement/recentfilesmenucontroller.cxx | 21
include/unotools/historyoptions.hxx | 48 -
include/unotools/itemholderbase.hxx | 2
sfx2/source/appl/newhelp.cxx | 29
sfx2/source/appl/sfxpicklist.cxx | 2
sfx2/source/appl/shutdowniconaqua.mm | 25
sfx2/source/control/recentdocsview.cxx | 44 -
sfx2/source/control/recentdocsviewitem.cxx | 2
sfx2/source/dialog/backingwindow.cxx | 2
sfx2/source/inet/inettbc.cxx | 15
svtools/source/control/inettbc.cxx | 76 --
unotools/source/config/historyoptions.cxx | 436 +++++----------
unotools/source/config/itemholder1.cxx | 4
15 files changed, 245 insertions(+), 477 deletions(-)
New commits:
commit ae34c3fe49267be34f9fb055ea1cb92240796a26
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Jul 26 17:05:26 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 27 08:43:31 2021 +0200
use officecfg for SvtHistoryOptions
Change-Id: I5cfd3a51bc4026ccb66ee23eb6f49a5dff5fe042
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119525
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index b704fdca97a9..a8fd1cec3c94 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -357,7 +357,7 @@ void SAL_CALL OApplicationController::disposing()
aFilter = pFilter->GetFilterName();
// add to svtool history options
- SvtHistoryOptions().AppendItem( EHistoryType::PickList,
+ SvtHistoryOptions::AppendItem( EHistoryType::PickList,
aURL.GetURLNoPass( INetURLObject::DecodeMechanism::NONE ),
aFilter,
getStrippedDatabaseName(),
diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx
index 99be8a42763d..bf958d4a30b7 100644
--- a/dbaccess/source/ui/control/opendoccontrols.cxx
+++ b/dbaccess/source/ui/control/opendoccontrols.cxx
@@ -130,22 +130,20 @@ namespace dbaui
{
OSL_ENSURE( _pAsciiModuleName, "OpenDocumentListBox::impl_init: invalid module name!" );
- Sequence< Sequence< PropertyValue> > aHistory = SvtHistoryOptions().GetList( EHistoryType::PickList );
+ std::vector< SvtHistoryOptions::HistoryItem > aHistory = SvtHistoryOptions::GetList( EHistoryType::PickList );
Reference< XNameAccess > xFilterFactory;
xFilterFactory.set(::comphelper::getProcessServiceFactory()->createInstance(
"com.sun.star.document.FilterFactory" ), css::uno::UNO_QUERY);
- sal_uInt32 nCount = aHistory.getLength();
- for ( sal_uInt32 nItem = 0; nItem < nCount; ++nItem )
+ for ( const SvtHistoryOptions::HistoryItem& rHistoryItem : aHistory )
{
try
{
// Get the current history item's properties.
- ::comphelper::SequenceAsHashMap aItemProperties( aHistory[ nItem ] );
- OUString sURL = aItemProperties.getUnpackedValueOrDefault( HISTORY_PROPERTYNAME_URL, OUString() );
- OUString sFilter = aItemProperties.getUnpackedValueOrDefault( HISTORY_PROPERTYNAME_FILTER, OUString() );
- OUString sTitle = aItemProperties.getUnpackedValueOrDefault( HISTORY_PROPERTYNAME_TITLE, OUString() );
- OUString sPassword = aItemProperties.getUnpackedValueOrDefault( HISTORY_PROPERTYNAME_PASSWORD, OUString() );
+ OUString sURL = rHistoryItem.sURL;
+ OUString sFilter = rHistoryItem.sFilter;
+ OUString sTitle = rHistoryItem.sTitle;
+ OUString sPassword = rHistoryItem.sPassword;
// If the entry is an impress file then insert it into the
// history list and the list box.
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx
index b25c84256cc2..ef6b3f00e922 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -130,28 +130,17 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >
if ( !pVCLPopupMenu )
return;
- Sequence< Sequence< PropertyValue > > aHistoryList = SvtHistoryOptions().GetList( EHistoryType::PickList );
+ std::vector< SvtHistoryOptions::HistoryItem > aHistoryList = SvtHistoryOptions::GetList( EHistoryType::PickList );
- int nPickListMenuItems = std::min<sal_Int32>( aHistoryList.getLength(), MAX_MENU_ITEMS );
+ int nPickListMenuItems = std::min<sal_Int32>( aHistoryList.size(), MAX_MENU_ITEMS );
m_aRecentFilesItems.clear();
if (( nPickListMenuItems > 0 ) && !m_bDisabled )
{
for ( int i = 0; i < nPickListMenuItems; i++ )
{
- const Sequence< PropertyValue >& rPickListEntry = aHistoryList[i];
- OUString aURL;
-
- for ( PropertyValue const & prop : rPickListEntry )
- {
- if ( prop.Name == HISTORY_PROPERTYNAME_URL )
- {
- prop.Value >>= aURL;
- break;
- }
- }
-
- m_aRecentFilesItems.push_back( aURL );
+ const SvtHistoryOptions::HistoryItem& rPickListEntry = aHistoryList[i];
+ m_aRecentFilesItems.push_back( rPickListEntry.sURL );
}
}
@@ -308,7 +297,7 @@ void SAL_CALL RecentFilesMenuController::itemSelected( const css::awt::MenuEvent
if ( aCommand == CMD_CLEAR_LIST )
{
- SvtHistoryOptions().Clear( EHistoryType::PickList );
+ SvtHistoryOptions::Clear( EHistoryType::PickList );
dispatchCommand(
"vnd.org.libreoffice.recentdocs:ClearRecentFileList",
css::uno::Sequence< css::beans::PropertyValue >() );
diff --git a/include/unotools/historyoptions.hxx b/include/unotools/historyoptions.hxx
index 34e2c74ea4ec..088b2f51dc26 100644
--- a/include/unotools/historyoptions.hxx
+++ b/include/unotools/historyoptions.hxx
@@ -16,30 +16,14 @@
* 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_UNOTOOLS_HISTORYOPTIONS_HXX
-#define INCLUDED_UNOTOOLS_HISTORYOPTIONS_HXX
+#pragma once
#include <unotools/unotoolsdllapi.h>
#include <sal/types.h>
-#include <com/sun/star/uno/Sequence.h>
#include <rtl/ustring.hxx>
-#include <unotools/options.hxx>
-#include <memory>
-
+#include <vector>
#include <optional>
-namespace com::sun::star::beans { struct PropertyValue; }
-
-// The method GetList() returns a list of property values.
-// Use follow defines to separate values by names.
-
-#define HISTORY_PROPERTYNAME_URL "URL"
-#define HISTORY_PROPERTYNAME_FILTER "Filter"
-#define HISTORY_PROPERTYNAME_TITLE "Title"
-#define HISTORY_PROPERTYNAME_PASSWORD "Password"
-#define HISTORY_PROPERTYNAME_THUMBNAIL "Thumbnail"
-
/// You can use these enum values to specify right history if you call our interface methods.
enum class EHistoryType
{
@@ -47,8 +31,6 @@ enum class EHistoryType
HelpBookmarks
};
-class SvtHistoryOptions_Impl;
-
/** Collect information about history features.
Interface methods to get and set value of config key "org.openoffice.Office.Common/History/..."
@@ -56,24 +38,29 @@ class SvtHistoryOptions_Impl;
key "PickList": The last used documents displayed in the file menu.
key "History": The last opened documents general.
*/
-class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtHistoryOptions final : public utl::detail::Options
+namespace SvtHistoryOptions
{
-public:
- SvtHistoryOptions();
- virtual ~SvtHistoryOptions() override;
/** Clear complete specified list.
@param eHistory select right history.
*/
- void Clear(EHistoryType eHistory);
+ UNOTOOLS_DLLPUBLIC void Clear(EHistoryType eHistory);
/** Return the complete specified history list.
@param eHistory select right history.
@return A list of history items is returned.
*/
- css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > GetList(EHistoryType eHistory) const;
+ struct HistoryItem
+ {
+ OUString sURL;
+ OUString sFilter;
+ OUString sTitle;
+ OUString sPassword;
+ OUString sThumbnail;
+ };
+ UNOTOOLS_DLLPUBLIC std::vector< HistoryItem > GetList(EHistoryType eHistory);
/** Append a new item to the specified list.
@@ -84,18 +71,13 @@ public:
@param sFilter filter name to save in history
@param sTitle document title to save in history
*/
- void AppendItem(EHistoryType eHistory,
+ UNOTOOLS_DLLPUBLIC void AppendItem(EHistoryType eHistory,
const OUString& sURL, const OUString& sFilter, const OUString& sTitle,
const std::optional<OUString>& sThumbnail);
/** Delete item from the specified list.
*/
- void DeleteItem(EHistoryType eHistory, const OUString& sURL);
-
-private:
- std::shared_ptr<SvtHistoryOptions_Impl> m_pImpl;
+ UNOTOOLS_DLLPUBLIC void DeleteItem(EHistoryType eHistory, const OUString& sURL);
};
-#endif // INCLUDED_UNOTOOLS_HISTORYOPTIONS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/itemholderbase.hxx b/include/unotools/itemholderbase.hxx
index 6503e3285e3b..b7a8a7bbc825 100644
--- a/include/unotools/itemholderbase.hxx
+++ b/include/unotools/itemholderbase.hxx
@@ -41,8 +41,6 @@ enum class EItem
EventConfig ,
- HistoryOptions ,
-
LinguConfig ,
MiscOptions ,
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 1862684f8796..346699fbfa41 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1079,21 +1079,6 @@ bool SearchTabPage_Impl::OpenKeyword( const OUString& rKeyword )
}
// class BookmarksTabPage_Impl -------------------------------------------
-static void GetBookmarkEntry_Impl
-(
- const Sequence< PropertyValue >& aBookmarkEntry,
- OUString& rTitle,
- OUString& rURL
-)
-{
- for ( const PropertyValue& aValue : aBookmarkEntry )
- {
- if ( aValue.Name == HISTORY_PROPERTYNAME_URL )
- aValue.Value >>= rURL;
- else if ( aValue.Name == HISTORY_PROPERTYNAME_TITLE )
- aValue.Value >>= rTitle;
- }
-}
void BookmarksTabPage_Impl::DoAction(std::string_view rAction)
{
@@ -1174,26 +1159,20 @@ BookmarksTabPage_Impl::BookmarksTabPage_Impl(weld::Widget* pParent, SfxHelpIndex
m_xBookmarksBox->connect_key_press(LINK(this, BookmarksTabPage_Impl, KeyInputHdl));
// load bookmarks from configuration
- const Sequence< Sequence< PropertyValue > > aBookmarkSeq = SvtHistoryOptions().GetList( EHistoryType::HelpBookmarks );
-
- OUString aTitle;
- OUString aURL;
-
+ const std::vector< SvtHistoryOptions::HistoryItem > aBookmarkSeq = SvtHistoryOptions::GetList( EHistoryType::HelpBookmarks );
for ( const auto& rBookmark : aBookmarkSeq )
{
- GetBookmarkEntry_Impl( rBookmark, aTitle, aURL );
- AddBookmarks( aTitle, aURL );
+ AddBookmarks( rBookmark.sTitle, rBookmark.sURL );
}
}
BookmarksTabPage_Impl::~BookmarksTabPage_Impl()
{
// save bookmarks to configuration
- SvtHistoryOptions aHistOpt;
- aHistOpt.Clear( EHistoryType::HelpBookmarks );
+ SvtHistoryOptions::Clear( EHistoryType::HelpBookmarks );
const sal_Int32 nCount = m_xBookmarksBox->n_children();
for (sal_Int32 i = 0; i < nCount; ++i)
- aHistOpt.AppendItem(EHistoryType::HelpBookmarks, m_xBookmarksBox->get_id(i), "", m_xBookmarksBox->get_text(i), std::nullopt);
+ SvtHistoryOptions::AppendItem(EHistoryType::HelpBookmarks, m_xBookmarksBox->get_id(i), "", m_xBookmarksBox->get_text(i), std::nullopt);
m_xBookmarksBox.reset();
m_xBookmarksPB.reset();
diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index e25b90818768..ea7f460fc403 100644
--- a/sfx2/source/appl/sfxpicklist.cxx
+++ b/sfx2/source/appl/sfxpicklist.cxx
@@ -134,7 +134,7 @@ void SfxPickListImpl::AddDocumentToPickList( const SfxObjectShell* pDocSh )
}
// add to svtool history options
- SvtHistoryOptions().AppendItem( EHistoryType::PickList,
+ SvtHistoryOptions::AppendItem( EHistoryType::PickList,
aURL.GetURLNoPass( INetURLObject::DecodeMechanism::NONE ),
aFilter,
aTitle,
diff --git a/sfx2/source/appl/shutdowniconaqua.mm b/sfx2/source/appl/shutdowniconaqua.mm
index 5a92f38adda5..e36958ec3740 100644
--- a/sfx2/source/appl/shutdowniconaqua.mm
+++ b/sfx2/source/appl/shutdowniconaqua.mm
@@ -180,32 +180,21 @@ class RecentFilesStringLength : public ::cppu::WeakImplHelper< css::util::XStrin
[menu removeItemAtIndex: 0];
// update recent item list
- css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList( SvtHistoryOptions().GetList( EHistoryType::PickList ) );
+ std::vector< SvtHistoryOptions::HistoryItem > aHistoryList( SvtHistoryOptions::GetList( EHistoryType::PickList ) );
- int nPickListMenuItems = ( aHistoryList.getLength() > 99 ) ? 99 : aHistoryList.getLength();
+ int nPickListMenuItems = ( aHistoryList.size() > 99 ) ? 99 : aHistoryList.size();
m_pRecentFilesItems->clear();
if( nPickListMenuItems > 0 )
{
for ( int i = 0; i < nPickListMenuItems; i++ )
{
- css::uno::Sequence< css::beans::PropertyValue > const & rPickListEntry = aHistoryList[i];
+ const SvtHistoryOptions::HistoryItem & rPickListEntry = aHistoryList[i];
RecentMenuEntry aRecentFile;
-
- for ( const css::beans::PropertyValue& rProp : rPickListEntry )
- {
- const css::uno::Any& a = rProp.Value;
-
- if ( rProp.Name == HISTORY_PROPERTYNAME_URL )
- a >>= aRecentFile.aURL;
- else if ( rProp.Name == HISTORY_PROPERTYNAME_FILTER )
- a >>= aRecentFile.aFilter;
- else if ( rProp.Name == HISTORY_PROPERTYNAME_TITLE )
- a >>= aRecentFile.aTitle;
- else if ( rProp.Name == HISTORY_PROPERTYNAME_PASSWORD )
- a >>= aRecentFile.aPassword;
- }
-
+ aRecentFile.aURL = rPickListEntry.sURL;
+ aRecentFile.aFilter = rPickListEntry.sFilter;
+ aRecentFile.aTitle = rPickListEntry.sTitle;
+ aRecentFile.aPassword = rPickListEntry.sPassword;
m_pRecentFilesItems->push_back( aRecentFile );
}
}
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 0b01603d3914..3493df385120 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -240,42 +240,34 @@ void RecentDocsView::Reload()
{
Clear();
- Sequence< Sequence< PropertyValue > > aHistoryList = SvtHistoryOptions().GetList( EHistoryType::PickList );
- for ( int i = 0; i < aHistoryList.getLength(); i++ )
+ std::vector< SvtHistoryOptions::HistoryItem > aHistoryList = SvtHistoryOptions::GetList( EHistoryType::PickList );
+ for ( size_t i = 0; i < aHistoryList.size(); i++ )
{
- const Sequence< PropertyValue >& rRecentEntry = aHistoryList[i];
+ const SvtHistoryOptions::HistoryItem& rRecentEntry = aHistoryList[i];
- OUString aURL;
+ OUString aURL = rRecentEntry.sURL;
OUString aTitle;
BitmapEx aThumbnail;
BitmapEx aModule;
- for ( const auto& rProp : rRecentEntry )
+ //fdo#74834: only load thumbnail if the corresponding option is not disabled in the configuration
+ if (officecfg::Office::Common::History::RecentDocsThumbnail::get())
{
- Any a = rProp.Value;
-
- if (rProp.Name == "URL")
- a >>= aURL;
- //fdo#74834: only load thumbnail if the corresponding option is not disabled in the configuration
- else if (rProp.Name == "Thumbnail" && officecfg::Office::Common::History::RecentDocsThumbnail::get())
+ OUString aBase64 = rRecentEntry.sThumbnail;
+ if (!aBase64.isEmpty())
{
- OUString aBase64;
- a >>= aBase64;
- if (!aBase64.isEmpty())
- {
- Sequence<sal_Int8> aDecoded;
- comphelper::Base64::decode(aDecoded, aBase64);
+ Sequence<sal_Int8> aDecoded;
+ comphelper::Base64::decode(aDecoded, aBase64);
- SvMemoryStream aStream(aDecoded.getArray(), aDecoded.getLength(), StreamMode::READ);
- vcl::PngImageReader aReader(aStream);
- aThumbnail = aReader.read();
- } else
+ SvMemoryStream aStream(aDecoded.getArray(), aDecoded.getLength(), StreamMode::READ);
+ vcl::PngImageReader aReader(aStream);
+ aThumbnail = aReader.read();
+ } else
+ {
+ INetURLObject aUrl(aURL);
+ if (mnFileTypes & ApplicationType::TYPE_DATABASE && typeMatchesExtension(ApplicationType::TYPE_DATABASE, aUrl.getExtension()))
{
- INetURLObject aUrl(aURL);
- if (mnFileTypes & ApplicationType::TYPE_DATABASE && typeMatchesExtension(ApplicationType::TYPE_DATABASE, aUrl.getExtension()))
- {
- aThumbnail = BitmapEx(ThumbnailView::ItemHeight() > 192 ? SFX_THUMBNAIL_BASE_256 : SFX_THUMBNAIL_BASE_192);
- }
+ aThumbnail = BitmapEx(ThumbnailView::ItemHeight() > 192 ? SFX_THUMBNAIL_BASE_256 : SFX_THUMBNAIL_BASE_192);
}
}
}
diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx
index 95660738346a..e76c500ecbb0 100644
--- a/sfx2/source/control/recentdocsviewitem.cxx
+++ b/sfx2/source/control/recentdocsviewitem.cxx
@@ -163,7 +163,7 @@ void RecentDocsViewItem::MouseButtonUp(const MouseEvent& rMEvt)
{
if (getRemoveIconArea().IsInside(rMEvt.GetPosPixel()))
{
- SvtHistoryOptions().DeleteItem(EHistoryType::PickList, maURL);
+ SvtHistoryOptions::DeleteItem(EHistoryType::PickList, maURL);
mrParent.Reload();
return;
}
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index df7f52253a6d..f58bf46329b0 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -607,7 +607,7 @@ IMPL_LINK (BackingWindow, MenuSelectHdl, const OString&, rId, void)
{
if (rId == "clear_all")
{
- SvtHistoryOptions().Clear(EHistoryType::PickList);
+ SvtHistoryOptions::Clear(EHistoryType::PickList);
mxAllRecentThumbnails->Reload();
return;
}
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index 52b1d7ad1341..0db4f7729008 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -243,19 +243,12 @@ void SfxURLToolBoxControl_Impl::StateChangedAtToolBoxControl
SvtURLBox* pURLBox = GetURLBox();
pURLBox->clear();
- const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lList = SvtHistoryOptions().GetList(EHistoryType::PickList);
- for (const css::uno::Sequence< css::beans::PropertyValue >& lProps : lList)
+ const std::vector< SvtHistoryOptions::HistoryItem > lList = SvtHistoryOptions::GetList(EHistoryType::PickList);
+ for (const SvtHistoryOptions::HistoryItem& lProps : lList)
{
- for (const auto& rProp : lProps)
+ if (!lProps.sURL.isEmpty())
{
- if (rProp.Name != HISTORY_PROPERTYNAME_URL)
- continue;
-
- OUString sURL;
- if (!(rProp.Value>>=sURL) || sURL.isEmpty())
- continue;
-
- INetURLObject aURL ( sURL );
+ INetURLObject aURL ( lProps.sURL );
OUString sMainURL( aURL.GetMainURL( INetURLObject::DecodeMechanism::WithCharset ) );
OUString sFile;
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index fe61e4c28e25..5f8cf08eb72f 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -138,24 +138,14 @@ SvtMatchContext_Impl::~SvtMatchContext_Impl()
void SvtMatchContext_Impl::FillPicklist(std::vector<OUString>& rPickList)
{
// Read the history of picks
- Sequence< Sequence< PropertyValue > > seqPicklist = SvtHistoryOptions().GetList( EHistoryType::PickList );
- sal_uInt32 nCount = seqPicklist.getLength();
+ std::vector< SvtHistoryOptions::HistoryItem > seqPicklist = SvtHistoryOptions::GetList( EHistoryType::PickList );
+ sal_uInt32 nCount = seqPicklist.size();
for( sal_uInt32 nItem=0; nItem < nCount; nItem++ )
{
- Sequence< PropertyValue > seqPropertySet = seqPicklist[ nItem ];
-
- auto pProperty = std::find_if(seqPropertySet.begin(), seqPropertySet.end(),
- [](const PropertyValue& rProperty) { return rProperty.Name == HISTORY_PROPERTYNAME_TITLE; });
- if (pProperty != seqPropertySet.end())
- {
- OUString sTitle;
- INetURLObject aURL;
-
- pProperty->Value >>= sTitle;
- aURL.SetURL( sTitle );
- rPickList.insert(rPickList.begin() + nItem, aURL.GetMainURL(INetURLObject::DecodeMechanism::WithCharset));
- }
+ INetURLObject aURL;
+ aURL.SetURL( seqPicklist[nItem].sTitle );
+ rPickList.insert(rPickList.begin() + nItem, aURL.GetMainURL(INetURLObject::DecodeMechanism::WithCharset));
}
}
@@ -915,47 +905,39 @@ void SvtURLBox::UpdatePicklistForSmartProtocol_Impl()
return;
// read history pick list
- const Sequence< Sequence< PropertyValue > > seqPicklist = SvtHistoryOptions().GetList( EHistoryType::PickList );
+ const std::vector< SvtHistoryOptions::HistoryItem > seqPicklist = SvtHistoryOptions::GetList( EHistoryType::PickList );
INetURLObject aCurObj;
- for( const Sequence< PropertyValue >& rPropertySet : seqPicklist )
+ for( const SvtHistoryOptions::HistoryItem& rPropertySet : seqPicklist )
{
- auto pProperty = std::find_if(rPropertySet.begin(), rPropertySet.end(),
- [](const PropertyValue& rProperty) { return rProperty.Name == HISTORY_PROPERTYNAME_URL; });
- if (pProperty != rPropertySet.end())
+ aCurObj.SetURL( rPropertySet.sURL );
+
+ if ( !rPropertySet.sURL.isEmpty() && ( eSmartProtocol != INetProtocol::NotValid ) )
{
- OUString sURL;
+ if( aCurObj.GetProtocol() != eSmartProtocol )
+ continue;
+ }
- pProperty->Value >>= sURL;
- aCurObj.SetURL( sURL );
+ OUString aURL( aCurObj.GetMainURL( INetURLObject::DecodeMechanism::WithCharset ) );
- if ( !sURL.isEmpty() && ( eSmartProtocol != INetProtocol::NotValid ) )
+ if ( !aURL.isEmpty() )
+ {
+ bool bFound = aURL.endsWith("/");
+ if ( !bFound )
{
- if( aCurObj.GetProtocol() != eSmartProtocol )
- continue;
- }
+ OUString aUpperURL = aURL.toAsciiUpperCase();
- OUString aURL( aCurObj.GetMainURL( INetURLObject::DecodeMechanism::WithCharset ) );
-
- if ( !aURL.isEmpty() )
+ bFound = ::std::any_of(pImpl->m_aFilters.begin(),
+ pImpl->m_aFilters.end(),
+ FilterMatch( aUpperURL ) );
+ }
+ if ( bFound )
{
- bool bFound = aURL.endsWith("/");
- if ( !bFound )
- {
- OUString aUpperURL = aURL.toAsciiUpperCase();
-
- bFound = ::std::any_of(pImpl->m_aFilters.begin(),
- pImpl->m_aFilters.end(),
- FilterMatch( aUpperURL ) );
- }
- if ( bFound )
- {
- OUString aFile;
- if (osl::FileBase::getSystemPathFromFileURL(aURL, aFile) == osl::FileBase::E_None)
- m_xWidget->append_text(aFile);
- else
- m_xWidget->append_text(aURL);
- }
+ OUString aFile;
+ if (osl::FileBase::getSystemPathFromFileURL(aURL, aFile) == osl::FileBase::E_None)
+ m_xWidget->append_text(aFile);
+ else
+ m_xWidget->append_text(aURL);
}
}
}
diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx
index 2d95036d54c8..62de1e70d1c4 100644
--- a/unotools/source/config/historyoptions.cxx
+++ b/unotools/source/config/historyoptions.cxx
@@ -36,20 +36,12 @@
#include <tools/diagnose_ex.h>
#include <optional>
-using namespace ::std;
using namespace ::utl;
-using namespace ::osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
namespace {
- const ::sal_Int32 s_nOffsetURL = 0;
- const ::sal_Int32 s_nOffsetFilter = 1;
- const ::sal_Int32 s_nOffsetTitle = 2;
- const ::sal_Int32 s_nOffsetPassword = 3;
- const ::sal_Int32 s_nOffsetThumbnail = 4;
-
constexpr OUStringLiteral s_sItemList = u"ItemList";
constexpr OUStringLiteral s_sOrderList = u"OrderList";
constexpr OUStringLiteral s_sHistoryItemRef = u"HistoryItemRef";
@@ -57,177 +49,31 @@ namespace {
constexpr OUStringLiteral s_sTitle = u"Title";
constexpr OUStringLiteral s_sPassword = u"Password";
constexpr OUStringLiteral s_sThumbnail = u"Thumbnail";
-
- class theHistoryOptionsMutex : public rtl::Static<osl::Mutex, theHistoryOptionsMutex>{};
}
-/// Internal implementation of the SvtHistoryOptions.
-class SvtHistoryOptions_Impl
-{
-public:
- SvtHistoryOptions_Impl();
-
- /// Returns the maximum size of the internal lists, ie. the capacity not the size.
- sal_uInt32 GetCapacity(EHistoryType eHistory) const;
-
- /// Clear the specified history list.
- void Clear(EHistoryType eHistory);
-
- /// Get a sequence list from the items.
- Sequence< Sequence<PropertyValue> > GetList(EHistoryType eHistory);
-
- void AppendItem(EHistoryType eHistory,
- const OUString& sURL, const OUString& sFilter, const OUString& sTitle,
- const std::optional<OUString>& sThumbnail);
-
- void DeleteItem(EHistoryType eHistory, const OUString& sURL);
-
-private:
- /// Return the appropriate list of recent documents (based on eHistory).
- uno::Reference<container::XNameAccess> GetListAccess(EHistoryType eHistory) const;
-
- void impl_truncateList(EHistoryType eHistory, sal_uInt32 nSize);
-
-private:
- uno::Reference<container::XNameAccess> m_xCfg;
- uno::Reference<container::XNameAccess> m_xCommonXCU;
-};
-
-SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()
+static uno::Reference<container::XNameAccess> GetConfig();
+static uno::Reference<container::XNameAccess> GetCommonXCU();
+static uno::Reference<container::XNameAccess> GetListAccess(
+ uno::Reference<container::XNameAccess> const & xCfg,
+ EHistoryType eHistory);
+static void TruncateList(
+ const uno::Reference<container::XNameAccess>& xCfg,
+ const uno::Reference<container::XNameAccess>& xList,
+ sal_uInt32 nSize);
+static sal_uInt32 GetCapacity(const uno::Reference<container::XNameAccess>& xCommonXCU, EHistoryType eHistory);
+
+namespace SvtHistoryOptions
{
- try
- {
- m_xCfg.set(
- ::comphelper::ConfigurationHelper::openConfig(
- ::comphelper::getProcessComponentContext(),
- "org.openoffice.Office.Histories/Histories",
- ::comphelper::EConfigurationModes::Standard),
- uno::UNO_QUERY);
-
- m_xCommonXCU.set(
- ::comphelper::ConfigurationHelper::openConfig(
- ::comphelper::getProcessComponentContext(),
- "org.openoffice.Office.Common/History",
- ::comphelper::EConfigurationModes::Standard),
- uno::UNO_QUERY);
- }
- catch(const uno::Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("unotools.config");
- m_xCfg.clear();
- m_xCommonXCU.clear();
- }
-}
-sal_uInt32 SvtHistoryOptions_Impl::GetCapacity(EHistoryType eHistory) const
+void Clear( EHistoryType eHistory )
{
- uno::Reference<beans::XPropertySet> xListAccess(m_xCommonXCU, uno::UNO_QUERY);
-
- if (!xListAccess.is())
- return 0;
-
- sal_uInt32 nSize = 0;
-
try
{
- switch (eHistory)
- {
- case EHistoryType::PickList:
- xListAccess->getPropertyValue("PickListSize") >>= nSize;
- break;
-
- case EHistoryType::HelpBookmarks:
- xListAccess->getPropertyValue("HelpBookmarkSize") >>= nSize;
- break;
-
- default:
- break;
- }
- }
- catch (const uno::Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("unotools.config");
- }
-
- return nSize;
-}
-
-uno::Reference<container::XNameAccess> SvtHistoryOptions_Impl::GetListAccess(EHistoryType eHistory) const
-{
- uno::Reference<container::XNameAccess> xListAccess;
-
- try
- {
- switch (eHistory)
- {
- case EHistoryType::PickList:
- m_xCfg->getByName("PickList") >>= xListAccess;
- break;
-
- case EHistoryType::HelpBookmarks:
- m_xCfg->getByName("HelpBookmarks") >>= xListAccess;
- break;
-
- default:
- break;
- }
- }
- catch (const uno::Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("unotools.config");
- }
-
- return xListAccess;
-}
-
-void SvtHistoryOptions_Impl::impl_truncateList(EHistoryType eHistory, sal_uInt32 nSize)
-{
- uno::Reference<container::XNameAccess> xList(GetListAccess(eHistory));
- if (!xList.is())
- return;
-
- uno::Reference<container::XNameContainer> xItemList;
- uno::Reference<container::XNameContainer> xOrderList;
- uno::Reference<beans::XPropertySet> xSet;
-
- try
- {
- xList->getByName(s_sOrderList) >>= xOrderList;
- xList->getByName(s_sItemList) >>= xItemList;
-
- const sal_uInt32 nLength = xOrderList->getElementNames().getLength();
- if (nSize < nLength)
- {
- for (sal_uInt32 i=nLength-1; i>=nSize; --i)
- {
- OUString sTmp;
- const OUString sRemove = OUString::number(i);
- xOrderList->getByName(sRemove) >>= xSet;
- xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp;
- xItemList->removeByName(sTmp);
- xOrderList->removeByName(sRemove);
- }
-
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- }
- catch(const uno::Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("unotools.config");
- }
-}
+ uno::Reference<container::XNameAccess> xCfg = GetConfig();
+ uno::Reference<container::XNameAccess> xListAccess(GetListAccess(xCfg, eHistory));
-void SvtHistoryOptions_Impl::Clear( EHistoryType eHistory )
-{
- uno::Reference<container::XNameAccess> xListAccess(GetListAccess(eHistory));
- if (!xListAccess.is())
- return;
-
- uno::Reference<container::XNameContainer> xNode;
-
- try
- {
// clear ItemList
+ uno::Reference<container::XNameContainer> xNode;
xListAccess->getByName(s_sItemList) >>= xNode;
Sequence<OUString> aStrings(xNode->getElementNames());
@@ -241,7 +87,7 @@ void SvtHistoryOptions_Impl::Clear( EHistoryType eHistory )
for (const auto& rString : std::as_const(aStrings))
xNode->removeByName(rString);
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ ::comphelper::ConfigurationHelper::flush(xCfg);
}
catch(const uno::Exception&)
{
@@ -249,92 +95,81 @@ void SvtHistoryOptions_Impl::Clear( EHistoryType eHistory )
}
}
-Sequence< Sequence<PropertyValue> > SvtHistoryOptions_Impl::GetList(EHistoryType eHistory)
+std::vector< HistoryItem > GetList( EHistoryType eHistory )
{
- uno::Reference<container::XNameAccess> xListAccess(GetListAccess(eHistory));
- if (!xListAccess.is())
- return Sequence< Sequence<PropertyValue> >();
-
- impl_truncateList(eHistory, GetCapacity(eHistory));
-
- Sequence<PropertyValue> seqProperties(5);
- seqProperties[s_nOffsetURL ].Name = HISTORY_PROPERTYNAME_URL;
- seqProperties[s_nOffsetFilter ].Name = HISTORY_PROPERTYNAME_FILTER;
- seqProperties[s_nOffsetTitle ].Name = HISTORY_PROPERTYNAME_TITLE;
- seqProperties[s_nOffsetPassword ].Name = HISTORY_PROPERTYNAME_PASSWORD;
- seqProperties[s_nOffsetThumbnail ].Name = HISTORY_PROPERTYNAME_THUMBNAIL;
-
- uno::Reference<container::XNameAccess> xItemList;
- uno::Reference<container::XNameAccess> xOrderList;
+ std::vector< HistoryItem > aRet;
try
{
+ uno::Reference<container::XNameAccess> xCfg = GetConfig();
+ uno::Reference<container::XNameAccess> xCommonXCU = GetCommonXCU();
+ uno::Reference<container::XNameAccess> xListAccess(GetListAccess(xCfg, eHistory));
+
+ TruncateList(xCfg, xListAccess, GetCapacity(xCommonXCU, eHistory));
+
+ uno::Reference<container::XNameAccess> xItemList;
+ uno::Reference<container::XNameAccess> xOrderList;
xListAccess->getByName(s_sItemList) >>= xItemList;
xListAccess->getByName(s_sOrderList) >>= xOrderList;
- }
- catch(const uno::Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("unotools.config");
- }
- const sal_Int32 nLength = xOrderList->getElementNames().getLength();
- Sequence< Sequence<PropertyValue> > aRet(nLength);
- sal_Int32 nCount = 0;
+ const sal_Int32 nLength = xOrderList->getElementNames().getLength();
+ aRet.reserve(nLength);
- for (sal_Int32 nItem = 0; nItem < nLength; ++nItem)
- {
- try
- {
- OUString sUrl;
- uno::Reference<beans::XPropertySet> xSet;
- xOrderList->getByName(OUString::number(nItem)) >>= xSet;
- xSet->getPropertyValue(s_sHistoryItemRef) >>= sUrl;
-
- xItemList->getByName(sUrl) >>= xSet;
- seqProperties[s_nOffsetURL ].Value <<= sUrl;
-
- seqProperties[s_nOffsetFilter ].Value = xSet->getPropertyValue(s_sFilter);
- seqProperties[s_nOffsetTitle ].Value = xSet->getPropertyValue(s_sTitle);
- seqProperties[s_nOffsetPassword ].Value = xSet->getPropertyValue(s_sPassword);
- seqProperties[s_nOffsetThumbnail].Value = xSet->getPropertyValue(s_sThumbnail);
- aRet[nCount++] = seqProperties;
- }
- catch(const uno::Exception&)
+ for (sal_Int32 nItem = 0; nItem < nLength; ++nItem)
{
- // <https://bugs.libreoffice.org/show_bug.cgi?id=46074>
- // "FILEOPEN: No Recent Documents..." discusses a problem
- // with corrupted /org.openoffice.Office/Histories/Histories
- // configuration items; to work around that problem, simply
- // ignore such corrupted individual items here, so that at
- // least newly added items are successfully reported back
- // from this function:
- DBG_UNHANDLED_EXCEPTION("unotools.config");
+ try
+ {
+ OUString sUrl;
+ uno::Reference<beans::XPropertySet> xSet;
+ xOrderList->getByName(OUString::number(nItem)) >>= xSet;
+ xSet->getPropertyValue(s_sHistoryItemRef) >>= sUrl;
+
+ xItemList->getByName(sUrl) >>= xSet;
+ HistoryItem aItem;
+ aItem.sURL = sUrl;
+ xSet->getPropertyValue(s_sFilter) >>= aItem.sFilter;
+ xSet->getPropertyValue(s_sTitle) >>= aItem.sTitle;
+ xSet->getPropertyValue(s_sPassword) >>= aItem.sPassword;
+ xSet->getPropertyValue(s_sThumbnail) >>= aItem.sThumbnail;
+ aRet.push_back(aItem);
+ }
+ catch(const uno::Exception&)
+ {
+ // <https://bugs.libreoffice.org/show_bug.cgi?id=46074>
+ // "FILEOPEN: No Recent Documents..." discusses a problem
+ // with corrupted /org.openoffice.Office/Histories/Histories
+ // configuration items; to work around that problem, simply
+ // ignore such corrupted individual items here, so that at
+ // least newly added items are successfully reported back
+ // from this function:
+ DBG_UNHANDLED_EXCEPTION("unotools.config");
+ }
}
}
- assert(nCount <= nLength);
- aRet.realloc(nCount);
+ catch(const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("unotools.config");
+ }
return aRet;
}
-void SvtHistoryOptions_Impl::AppendItem(EHistoryType eHistory,
+void AppendItem(EHistoryType eHistory,
const OUString& sURL, const OUString& sFilter, const OUString& sTitle,
const std::optional<OUString>& sThumbnail)
{
- uno::Reference<container::XNameAccess> xListAccess(GetListAccess(eHistory));
- if (!xListAccess.is())
- return;
-
- impl_truncateList(eHistory, GetCapacity(eHistory));
+ try
+ {
+ uno::Reference<container::XNameAccess> xCfg = GetConfig();
+ uno::Reference<container::XNameAccess> xCommonXCU = GetCommonXCU();
+ uno::Reference<container::XNameAccess> xListAccess(GetListAccess(xCfg, eHistory));
- sal_Int32 nMaxSize = GetCapacity(eHistory);
- if (nMaxSize == 0)
- return;
+ TruncateList(xCfg, xListAccess, GetCapacity(xCommonXCU, eHistory));
- uno::Reference<container::XNameContainer> xItemList;
- uno::Reference<container::XNameContainer> xOrderList;
- uno::Reference<beans::XPropertySet> xSet;
+ sal_Int32 nMaxSize = GetCapacity(xCommonXCU, eHistory);
+ if (nMaxSize == 0)
+ return;
- try
- {
+ uno::Reference<container::XNameContainer> xItemList;
+ uno::Reference<container::XNameContainer> xOrderList;
xListAccess->getByName(s_sItemList) >>= xItemList;
xListAccess->getByName(s_sOrderList) >>= xOrderList;
sal_Int32 nLength = xOrderList->getElementNames().getLength();
@@ -342,6 +177,7 @@ void SvtHistoryOptions_Impl::AppendItem(EHistoryType eHistory,
// The item to be appended already exists
if (xItemList->hasByName(sURL))
{
+ uno::Reference<beans::XPropertySet> xSet;
if (sThumbnail)
{
// update the thumbnail
@@ -374,10 +210,11 @@ void SvtHistoryOptions_Impl::AppendItem(EHistoryType eHistory,
}
}
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ ::comphelper::ConfigurationHelper::flush(xCfg);
}
else // The item to be appended does not exist yet
{
+ uno::Reference<beans::XPropertySet> xSet;
uno::Reference<lang::XSingleServiceFactory> xFac;
uno::Reference<uno::XInterface> xInst;
uno::Reference<beans::XPropertySet> xPrevSet;
@@ -436,7 +273,7 @@ void SvtHistoryOptions_Impl::AppendItem(EHistoryType eHistory,
xSet->setPropertyValue(s_sPassword, uno::makeAny(OUString()));
xSet->setPropertyValue(s_sThumbnail, uno::makeAny(sThumbnail.value_or(OUString())));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ ::comphelper::ConfigurationHelper::flush(xCfg);
}
}
catch(const uno::Exception&)
@@ -445,18 +282,15 @@ void SvtHistoryOptions_Impl::AppendItem(EHistoryType eHistory,
}
}
-void SvtHistoryOptions_Impl::DeleteItem(EHistoryType eHistory, const OUString& sURL)
+void DeleteItem(EHistoryType eHistory, const OUString& sURL)
{
- uno::Reference<container::XNameAccess> xListAccess(GetListAccess(eHistory));
- if (!xListAccess.is())
- return;
-
- uno::Reference<container::XNameContainer> xItemList;
- uno::Reference<container::XNameContainer> xOrderList;
- uno::Reference<beans::XPropertySet> xSet;
-
try
{
+ uno::Reference<container::XNameAccess> xCfg = GetConfig();
+ uno::Reference<container::XNameAccess> xListAccess(GetListAccess(xCfg, eHistory));
+
+ uno::Reference<container::XNameContainer> xItemList;
+ uno::Reference<container::XNameContainer> xOrderList;
xListAccess->getByName(s_sItemList) >>= xItemList;
xListAccess->getByName(s_sOrderList) >>= xOrderList;
sal_Int32 nLength = xOrderList->getElementNames().getLength();
@@ -476,6 +310,7 @@ void SvtHistoryOptions_Impl::DeleteItem(EHistoryType eHistory, const OUString& s
sal_Int32 nFromWhere = 0;
for (; nFromWhere < nLength - 1; ++nFromWhere)
{
+ uno::Reference<beans::XPropertySet> xSet;
OUString aItem;
xOrderList->getByName(OUString::number(nFromWhere)) >>= xSet;
xSet->getPropertyValue(s_sHistoryItemRef) >>= aItem;
@@ -501,7 +336,7 @@ void SvtHistoryOptions_Impl::DeleteItem(EHistoryType eHistory, const OUString& s
// and finally remove it from the ItemList
xItemList->removeByName(sURL);
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ ::comphelper::ConfigurationHelper::flush(xCfg);
}
catch (const uno::Exception&)
{
@@ -509,60 +344,95 @@ void SvtHistoryOptions_Impl::DeleteItem(EHistoryType eHistory, const OUString& s
}
}
-namespace {
+} // namespace
-std::weak_ptr<SvtHistoryOptions_Impl> g_pHistoryOptions;
+static uno::Reference<container::XNameAccess> GetConfig()
+{
+ return uno::Reference<container::XNameAccess>(
+ ::comphelper::ConfigurationHelper::openConfig(
+ ::comphelper::getProcessComponentContext(),
+ "org.openoffice.Office.Histories/Histories",
+ ::comphelper::EConfigurationModes::Standard),
+ uno::UNO_QUERY_THROW);
}
-SvtHistoryOptions::SvtHistoryOptions()
+static uno::Reference<container::XNameAccess> GetCommonXCU()
{
- MutexGuard aGuard(theHistoryOptionsMutex::get());
-
- m_pImpl = g_pHistoryOptions.lock();
- if( !m_pImpl )
- {
- m_pImpl = std::make_shared<SvtHistoryOptions_Impl>();
- g_pHistoryOptions = m_pImpl;
- ItemHolder1::holdConfigItem(EItem::HistoryOptions);
- }
+ return uno::Reference<container::XNameAccess>(
+ ::comphelper::ConfigurationHelper::openConfig(
+ ::comphelper::getProcessComponentContext(),
+ "org.openoffice.Office.Common/History",
+ ::comphelper::EConfigurationModes::Standard),
+ uno::UNO_QUERY_THROW);
}
-SvtHistoryOptions::~SvtHistoryOptions()
+static uno::Reference<container::XNameAccess> GetListAccess(
+ const uno::Reference<container::XNameAccess>& xCfg,
+ EHistoryType eHistory)
{
- MutexGuard aGuard(theHistoryOptionsMutex::get());
+ uno::Reference<container::XNameAccess> xListAccess;
+ switch (eHistory)
+ {
+ case EHistoryType::PickList:
+ xCfg->getByName("PickList") >>= xListAccess;
+ break;
- m_pImpl.reset();
+ case EHistoryType::HelpBookmarks:
+ xCfg->getByName("HelpBookmarks") >>= xListAccess;
+ break;
+ }
+ return xListAccess;
}
-void SvtHistoryOptions::Clear( EHistoryType eHistory )
+static void TruncateList(
+ const uno::Reference<container::XNameAccess>& xCfg,
+ const uno::Reference<container::XNameAccess>& xList,
+ sal_uInt32 nSize)
{
- MutexGuard aGuard(theHistoryOptionsMutex::get());
+ uno::Reference<container::XNameContainer> xItemList;
+ uno::Reference<container::XNameContainer> xOrderList;
+ xList->getByName(s_sOrderList) >>= xOrderList;
+ xList->getByName(s_sItemList) >>= xItemList;
+
+ const sal_uInt32 nLength = xOrderList->getElementNames().getLength();
+ if (nSize < nLength)
+ {
+ for (sal_uInt32 i=nLength-1; i>=nSize; --i)
+ {
+ uno::Reference<beans::XPropertySet> xSet;
+ OUString sTmp;
+ const OUString sRemove = OUString::number(i);
+ xOrderList->getByName(sRemove) >>= xSet;
+ xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp;
+ xItemList->removeByName(sTmp);
+ xOrderList->removeByName(sRemove);
+ }
- m_pImpl->Clear( eHistory );
+ ::comphelper::ConfigurationHelper::flush(xCfg);
+ }
}
-Sequence< Sequence< PropertyValue > > SvtHistoryOptions::GetList( EHistoryType eHistory ) const
-{
- MutexGuard aGuard(theHistoryOptionsMutex::get());
- return m_pImpl->GetList( eHistory );
-}
-void SvtHistoryOptions::AppendItem(EHistoryType eHistory,
- const OUString& sURL, const OUString& sFilter, const OUString& sTitle,
- const std::optional<OUString>& sThumbnail)
+static sal_uInt32 GetCapacity(const uno::Reference<container::XNameAccess>& xCommonXCU, EHistoryType eHistory)
{
- MutexGuard aGuard(theHistoryOptionsMutex::get());
+ uno::Reference<beans::XPropertySet> xListAccess(xCommonXCU, uno::UNO_QUERY_THROW);
- m_pImpl->AppendItem(eHistory, sURL, sFilter, sTitle, sThumbnail);
-}
+ sal_uInt32 nSize = 0;
-void SvtHistoryOptions::DeleteItem(EHistoryType eHistory, const OUString& sURL)
-{
- MutexGuard aGuard(theHistoryOptionsMutex::get());
+ switch (eHistory)
+ {
+ case EHistoryType::PickList:
+ xListAccess->getPropertyValue("PickListSize") >>= nSize;
+ break;
+
+ case EHistoryType::HelpBookmarks:
+ xListAccess->getPropertyValue("HelpBookmarkSize") >>= nSize;
+ break;
+ }
- m_pImpl->DeleteItem(eHistory, sURL);
+ return nSize;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index 7183ea2e12f9..a5a78edbd299 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -129,10 +129,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
//rItem.pItem.reset( new GlobalEventConfig() );
break;
- case EItem::HistoryOptions :
- rItem.pItem.reset( new SvtHistoryOptions() );
- break;
-
case EItem::LinguConfig :
rItem.pItem.reset( new SvtLinguConfig() );
break;
More information about the Libreoffice-commits
mailing list