summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-07-26 17:05:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-27 08:43:31 +0200
commitae34c3fe49267be34f9fb055ea1cb92240796a26 (patch)
treec9c5250268b5d574c45f6c7fa3fda1c2e4481063 /sfx2
parentdf2b617b612f24b1dd394faf6fd605bdc69790cb (diff)
use officecfg for SvtHistoryOptions
Change-Id: I5cfd3a51bc4026ccb66ee23eb6f49a5dff5fe042 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119525 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/newhelp.cxx29
-rw-r--r--sfx2/source/appl/sfxpicklist.cxx2
-rw-r--r--sfx2/source/appl/shutdowniconaqua.mm25
-rw-r--r--sfx2/source/control/recentdocsview.cxx44
-rw-r--r--sfx2/source/control/recentdocsviewitem.cxx2
-rw-r--r--sfx2/source/dialog/backingwindow.cxx2
-rw-r--r--sfx2/source/inet/inettbc.cxx15
7 files changed, 36 insertions, 83 deletions
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;