Kaydet (Commit) 9f45e431 authored tarafından Muhammet Kara's avatar Muhammet Kara

Add new helper class to cui for SvxConfigPage

And kill the temporary namespace killmelater.

This class will contain helper functions/methods
for use of the tab pages of the Customize Dialog.

Change-Id: I63a05c9495a79009ed5b47f7790a46cff9f58c6a
Reviewed-on: https://gerrit.libreoffice.org/39617Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMuhammet Kara <muhammet.kara@pardus.org.tr>
Reviewed-on: https://gerrit.libreoffice.org/40308
üst 5a883e94
......@@ -88,6 +88,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
cui/source/customize/cfgutil \
cui/source/customize/eventdlg \
cui/source/customize/macropg \
cui/source/customize/SvxConfigPageHelper \
cui/source/customize/SvxMenuConfigPage \
cui/source/customize/SvxToolbarConfigPage \
cui/source/dialogs/about \
......
This diff is collapsed.
......@@ -59,6 +59,7 @@
#include "acccfg.hxx"
#include "cfg.hxx"
#include "SvxMenuConfigPage.hxx"
#include "SvxConfigPageHelper.hxx"
#include "eventdlg.hxx"
#include <dialmgr.hxx>
......@@ -252,7 +253,7 @@ void SvxMenuConfigPage::DeleteSelectedTopLevel()
SvxEntries* pParentEntries =
FindParentForChild( GetSaveInData()->GetEntries(), pMenuData );
killmelater::RemoveEntry( pParentEntries, pMenuData );
SvxConfigPageHelper::RemoveEntry( pParentEntries, pMenuData );
delete pMenuData;
ReloadTopLevelListBox();
......@@ -274,7 +275,7 @@ void SvxMenuConfigPage::DeleteSelectedContent()
SvxConfigEntry* pMenu = GetTopLevelSelection();
// remove menu entry from the list for this menu
killmelater::RemoveEntry( pMenu->GetEntries(), pMenuEntry );
SvxConfigPageHelper::RemoveEntry( pMenu->GetEntries(), pMenuEntry );
// remove menu entry from UI
m_pContentsListBox->GetModel()->Remove( pActEntry );
......@@ -300,7 +301,7 @@ short SvxMenuConfigPage::QueryReset()
OUString saveInName = m_pSaveInListBox->GetEntry(
m_pSaveInListBox->GetSelectEntryPos() );
OUString label = killmelater::replaceSaveInName( msg, saveInName );
OUString label = SvxConfigPageHelper::replaceSaveInName( msg, saveInName );
ScopedVclPtrInstance<QueryBox> qbox( this, WB_YES_NO, label );
......@@ -350,7 +351,7 @@ IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton, void )
{
SvxConfigEntry* pMenuData = GetTopLevelSelection();
OUString aNewName( killmelater::stripHotKey( pMenuData->GetName() ) );
OUString aNewName( SvxConfigPageHelper::stripHotKey( pMenuData->GetName() ) );
OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
......@@ -394,7 +395,7 @@ IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
SvxConfigEntry* pEntry =
static_cast<SvxConfigEntry*>(pActEntry->GetUserData());
OUString aNewName( killmelater::stripHotKey( pEntry->GetName() ) );
OUString aNewName( SvxConfigPageHelper::stripHotKey( pEntry->GetName() ) );
OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
......
......@@ -59,6 +59,7 @@
#include "acccfg.hxx"
#include "cfg.hxx"
#include "SvxToolbarConfigPage.hxx"
#include "SvxConfigPageHelper.hxx"
#include "eventdlg.hxx"
#include <dialmgr.hxx>
......@@ -281,7 +282,7 @@ void SvxToolbarConfigPage::DeleteSelectedContent()
SvxConfigEntry* pToolbar = GetTopLevelSelection();
// remove entry from the list for this toolbar
killmelater::RemoveEntry( pToolbar->GetEntries(), pEntry );
SvxConfigPageHelper::RemoveEntry( pToolbar->GetEntries(), pEntry );
// remove toolbar entry from UI
m_pContentsListBox->GetModel()->Remove( pActEntry );
......@@ -347,7 +348,7 @@ IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton, void )
}
else if (sCommand == "modtoolrename")
{
OUString aNewName( killmelater::stripHotKey( pToolbar->GetName() ) );
OUString aNewName( SvxConfigPageHelper::stripHotKey( pToolbar->GetName() ) );
OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
......@@ -386,7 +387,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
SvxConfigEntry* pEntry =
static_cast<SvxConfigEntry*>(pActEntry->GetUserData());
OUString aNewName( killmelater::stripHotKey( pEntry->GetName() ) );
OUString aNewName( SvxConfigPageHelper::stripHotKey( pEntry->GetName() ) );
OUString aDesc = CuiResId( RID_SVXSTR_LABEL_NEW_NAME );
VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc );
......@@ -433,7 +434,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
{
pEntry->SetName( aSystemName );
m_pContentsListBox->SetEntryText(
pActEntry, killmelater::stripHotKey( aSystemName ) );
pActEntry, SvxConfigPageHelper::stripHotKey( aSystemName ) );
bNeedsApply = true;
}
......@@ -442,7 +443,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
try
{
GetSaveInData()->GetImageManager()->removeImages(
killmelater::GetImageType(), aURLSeq );
SvxConfigPageHelper::GetImageType(), aURLSeq );
// reset backup in entry
pEntry->SetBackupGraphic(
......@@ -508,7 +509,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
if ( !pEntry->GetBackupGraphic().is() )
{
css::uno::Reference< css::graphic::XGraphic > backup;
backup = killmelater::GetGraphic(
backup = SvxConfigPageHelper::GetGraphic(
GetSaveInData()->GetImageManager(), aURLSeq[ 0 ] );
if ( backup.is() )
......@@ -521,7 +522,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
try
{
GetSaveInData()->GetImageManager()->replaceImages(
killmelater::GetImageType(), aURLSeq, aGraphicSeq );
SvxConfigPageHelper::GetImageType(), aURLSeq, aGraphicSeq );
m_pContentsListBox->GetModel()->Remove( pActEntry );
SvTreeListEntry* pNewLBEntry =
......@@ -574,7 +575,7 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
try
{
GetSaveInData()->GetImageManager()->replaceImages(
killmelater::GetImageType(), aURLSeq, aGraphicSeq );
SvxConfigPageHelper::GetImageType(), aURLSeq, aGraphicSeq );
m_pContentsListBox->GetModel()->Remove( pActEntry );
......@@ -704,7 +705,7 @@ short SvxToolbarConfigPage::QueryReset()
OUString saveInName = m_pSaveInListBox->GetEntry(
m_pSaveInListBox->GetSelectEntryPos() );
OUString label = killmelater::replaceSaveInName( msg, saveInName );
OUString label = SvxConfigPageHelper::replaceSaveInName( msg, saveInName );
ScopedVclPtrInstance< QueryBox > qbox( this, WB_YES_NO, label );
......@@ -828,10 +829,10 @@ IMPL_LINK_NOARG( SvxToolbarConfigPage, NewToolbarHdl, Button *, void )
OUString prefix = CuiResId( RID_SVXSTR_NEW_TOOLBAR );
OUString aNewName =
killmelater::generateCustomName( prefix, GetSaveInData()->GetEntries() );
SvxConfigPageHelper::generateCustomName( prefix, GetSaveInData()->GetEntries() );
OUString aNewURL =
killmelater::generateCustomURL( GetSaveInData()->GetEntries() );
SvxConfigPageHelper::generateCustomURL( GetSaveInData()->GetEntries() );
VclPtrInstance< SvxNewToolbarDialog > pNameDialog( nullptr, aNewName );
......
This diff is collapsed.
/* -*- 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_CUI_SOURCE_INC_SVXCONFIGPAGEHELPER_HXX
#define INCLUDED_CUI_SOURCE_INC_SVXCONFIGPAGEHELPER_HXX
#include <vector>
#include "cfg.hxx"
class SvxConfigPageHelper
{
public:
static void RemoveEntry( SvxEntries* pEntries, SvxConfigEntry* pChildEntry );
static OUString replaceSaveInName( const OUString& rMessage, const OUString& rSaveInName );
static OUString stripHotKey( const OUString& str );
static OUString replaceSixteen( const OUString& str, sal_Int32 nReplacement );
static sal_Int16 GetImageType();
static void InitImageType();
static css::uno::Reference< css::graphic::XGraphic > GetGraphic(
const css::uno::Reference< css::ui::XImageManager >& xImageManager,
const OUString& rCommandURL );
static OUString generateCustomName(
const OUString& prefix,
SvxEntries* entries,
sal_Int32 suffix = 1 );
static OUString generateCustomMenuURL(
SvxEntries* entries,
sal_Int32 suffix = 1 );
static sal_uInt32 generateRandomValue();
static OUString generateCustomURL( SvxEntries* entries );
static OUString GetModuleName( const OUString& aModuleId );
static OUString GetUIModuleName(
const OUString& aModuleId,
const css::uno::Reference< css::frame::XModuleManager2 >& rModuleManager );
static bool GetMenuItemData(
const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
sal_Int32 nIndex,
OUString& rCommandURL,
OUString& rLabel,
sal_uInt16& rType,
css::uno::Reference< css::container::XIndexAccess >& rSubMenu );
static bool GetToolbarItemData(
const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
sal_Int32 nIndex,
OUString& rCommandURL,
OUString& rLabel,
sal_uInt16& rType,
bool& rIsVisible,
sal_Int32& rStyle );
static css::uno::Sequence< css::beans::PropertyValue > ConvertSvxConfigEntry(
const SvxConfigEntry* pEntry );
static css::uno::Sequence< css::beans::PropertyValue > ConvertToolbarEntry(
const SvxConfigEntry* pEntry );
static bool showKeyConfigTabPage(
const css::uno::Reference< css::frame::XFrame >& xFrame );
static bool EntrySort( SvxConfigEntry* a, SvxConfigEntry* b );
static bool SvxConfigEntryModified( SvxConfigEntry* pEntry );
};
#endif // INCLUDED_CUI_SOURCE_INC_SVXCONFIGPAGEHELPER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment