[Libreoffice-commits] core.git: 3 commits - cui/source editeng/source include/editeng include/svtools sc/inc sc/source svtools/source svx/source sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Dec 18 06:21:12 UTC 2017
cui/source/dialogs/cuihyperdlg.cxx | 30 +++++++++++++++---------------
cui/source/dialogs/iconcdlg.cxx | 30 +++++++++++++++---------------
cui/source/inc/cuihyperdlg.hxx | 13 +++++++------
cui/source/inc/iconcdlg.hxx | 23 ++++++++++++-----------
cui/source/tabpages/tpcolor.cxx | 2 +-
editeng/source/editeng/impedit2.cxx | 6 +++---
include/editeng/editdata.hxx | 2 +-
include/svtools/colrdlg.hxx | 9 +++++----
sc/inc/document.hxx | 3 ++-
sc/source/core/data/documen8.cxx | 10 +++++-----
sc/source/ui/app/inputhdl.cxx | 2 +-
sc/source/ui/drawfunc/drtxtob.cxx | 2 +-
sc/source/ui/pagedlg/tphfedit.cxx | 2 +-
sc/source/ui/view/formatsh.cxx | 12 ++++++------
sc/source/ui/view/output2.cxx | 2 +-
sc/source/ui/view/output3.cxx | 2 +-
sc/source/ui/view/viewdata.cxx | 2 +-
svtools/source/dialogs/colrdlg.cxx | 6 +++---
svx/source/tbxctrls/PaletteManager.cxx | 2 +-
sw/source/core/view/vdraw.cxx | 4 ++--
sw/source/uibase/uiview/viewdraw.cxx | 2 +-
21 files changed, 85 insertions(+), 81 deletions(-)
New commits:
commit 39c618caf5aa19da95285bec6cab7108bee3984c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Dec 15 17:15:31 2017 +0200
convert EEHorizontalTextDirection to scoped enum
Change-Id: Icb7298742ae80fa17d5e6f6a3a09a6bb30892b6d
Reviewed-on: https://gerrit.libreoffice.org/46590
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 1597764a4927..5d2b0d27e8a3 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -137,7 +137,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
nAsianCompressionMode = CharCompressType::NONE;
- eDefaultHorizontalTextDirection = EE_HTEXTDIR_DEFAULT;
+ eDefaultHorizontalTextDirection = EEHorizontalTextDirection::Default;
aStatus.GetControlWord() = EEControlBits::USECHARATTRIBS | EEControlBits::DOIDLEFORMAT |
@@ -1971,12 +1971,12 @@ bool ImpEditEngine::IsRightToLeft( sal_Int32 nPara ) const
if ( !IsVertical() )
{
- bR2L = GetDefaultHorizontalTextDirection() == EE_HTEXTDIR_R2L;
+ bR2L = GetDefaultHorizontalTextDirection() == EEHorizontalTextDirection::R2L;
pFrameDirItem = &GetParaAttrib( nPara, EE_PARA_WRITINGDIR );
if ( pFrameDirItem->GetValue() == SvxFrameDirection::Environment )
{
// #103045# if DefaultHorizontalTextDirection is set, use that value, otherwise pool default.
- if ( GetDefaultHorizontalTextDirection() != EE_HTEXTDIR_DEFAULT )
+ if ( GetDefaultHorizontalTextDirection() != EEHorizontalTextDirection::Default )
{
pFrameDirItem = nullptr; // bR2L already set to default horizontal text direction
}
diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx
index eef5770900a1..9e71c81a2dd8 100644
--- a/include/editeng/editdata.hxx
+++ b/include/editeng/editdata.hxx
@@ -34,7 +34,7 @@ class SvxRTFItemStackType;
enum class HtmlTokenId : sal_Int16;
enum class EETextFormat { Text = 0x20, Rtf, Html = 0x32, Xml };
-enum EEHorizontalTextDirection { EE_HTEXTDIR_DEFAULT, EE_HTEXTDIR_L2R, EE_HTEXTDIR_R2L };
+enum class EEHorizontalTextDirection { Default, L2R, R2L };
enum class EESelectionMode { Std, TxtOnly, Hidden };
// EE_SELMODE_HIDDEN can be used to completely hide the selection. This is useful e.g. when you want show the selection
// only as long as your window (which the edit view works on) has the focus
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 5c1b93763d1c..ac3025ffb1d8 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -55,6 +55,7 @@ enum class SvtScriptType;
enum class ScMF;
enum class FormulaError : sal_uInt16;
enum class CharCompressType;
+enum class EEHorizontalTextDirection;
namespace editeng { class SvxBorderLine; }
namespace formula { struct VectorRefArray; }
namespace svl {
@@ -2032,7 +2033,7 @@ public:
void SetAsianKerning(bool bNew);
void ApplyAsianEditSettings(ScEditEngineDefaulter& rEngine);
- sal_uInt8 GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
+ EEHorizontalTextDirection GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index c474f068c49e..24dda526ec6d 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -360,9 +360,9 @@ bool ScDocument::RenamePageStyleInUse( const OUString& rOld, const OUString& rNe
return bWasInUse;
}
-sal_uInt8 ScDocument::GetEditTextDirection(SCTAB nTab) const
+EEHorizontalTextDirection ScDocument::GetEditTextDirection(SCTAB nTab) const
{
- EEHorizontalTextDirection eRet = EE_HTEXTDIR_DEFAULT;
+ EEHorizontalTextDirection eRet = EEHorizontalTextDirection::Default;
OUString aStyleName = GetPageStyle( nTab );
SfxStyleSheetBase* pStyle = mxPoolHelper->GetStylePool()->Find( aStyleName, SfxStyleFamily::Page );
@@ -373,13 +373,13 @@ sal_uInt8 ScDocument::GetEditTextDirection(SCTAB nTab) const
rStyleSet.Get( ATTR_WRITINGDIR ).GetValue();
if ( eDirection == SvxFrameDirection::Horizontal_LR_TB )
- eRet = EE_HTEXTDIR_L2R;
+ eRet = EEHorizontalTextDirection::L2R;
else if ( eDirection == SvxFrameDirection::Horizontal_RL_TB )
- eRet = EE_HTEXTDIR_R2L;
+ eRet = EEHorizontalTextDirection::R2L;
// else (invalid for EditEngine): keep "default"
}
- return sal::static_int_cast<sal_uInt8>(eRet);
+ return eRet;
}
ScMacroManager* ScDocument::GetMacroManager()
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 7cf8faa1d231..4afd6f76e4a1 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -783,7 +783,7 @@ void ScInputHandler::UpdateSpellSettings( bool bFromStartTab )
ScDocument* pDoc = rViewData.GetDocument();
pDoc->ApplyAsianEditSettings( *mpEditEngine );
mpEditEngine->SetDefaultHorizontalTextDirection(
- (EEHorizontalTextDirection)pDoc->GetEditTextDirection( rViewData.GetTabNo() ) );
+ pDoc->GetEditTextDirection( rViewData.GetTabNo() ) );
mpEditEngine->SetFirstWordCapitalization( false );
}
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 3069a5a855e2..3e428992b63e 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -1170,7 +1170,7 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet )
if ( eAttrDir == SvxFrameDirection::Environment )
{
// get "environment" direction from page style
- if ( pViewData->GetDocument()->GetEditTextDirection( pViewData->GetTabNo() ) == EE_HTEXTDIR_R2L )
+ if ( pViewData->GetDocument()->GetEditTextDirection( pViewData->GetTabNo() ) == EEHorizontalTextDirection::R2L )
eAttrDir = SvxFrameDirection::Horizontal_RL_TB;
else
eAttrDir = SvxFrameDirection::Horizontal_LR_TB;
diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx
index 63021b4810f2..786dad811bbe 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -93,7 +93,7 @@ ScEditWindow::ScEditWindow( vcl::Window* pParent, WinBits nBits, ScEditWindowLoc
pEdEngine->SetControlWord( pEdEngine->GetControlWord() | EEControlBits::MARKFIELDS );
mbRTL = ScGlobal::IsSystemRTL();
if (mbRTL)
- pEdEngine->SetDefaultHorizontalTextDirection(EE_HTEXTDIR_R2L);
+ pEdEngine->SetDefaultHorizontalTextDirection(EEHorizontalTextDirection::R2L);
pEdView = new EditView( pEdEngine, this );
pEdView->SetOutputArea( tools::Rectangle( Point(0,0), GetOutputSize() ) );
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 0716ff89a815..c1938e213908 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2737,17 +2737,17 @@ void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet )
rAttrSet.Get( ATTR_VERTICAL_ASIAN ).GetValue();
bool bBidiDontCare = (rAttrSet.GetItemState( ATTR_WRITINGDIR ) == SfxItemState::DONTCARE);
- EEHorizontalTextDirection eBidiDir = EE_HTEXTDIR_DEFAULT;
+ EEHorizontalTextDirection eBidiDir = EEHorizontalTextDirection::Default;
if ( !bBidiDontCare )
{
SvxFrameDirection eCellDir = rAttrSet.Get( ATTR_WRITINGDIR ).GetValue();
if ( eCellDir == SvxFrameDirection::Environment )
- eBidiDir = (EEHorizontalTextDirection)GetViewData()->GetDocument()->
+ eBidiDir = GetViewData()->GetDocument()->
GetEditTextDirection( GetViewData()->GetTabNo() );
else if ( eCellDir == SvxFrameDirection::Horizontal_RL_TB )
- eBidiDir = EE_HTEXTDIR_R2L;
+ eBidiDir = EEHorizontalTextDirection::R2L;
else
- eBidiDir = EE_HTEXTDIR_L2R;
+ eBidiDir = EEHorizontalTextDirection::L2R;
}
SvtLanguageOptions aLangOpt;
@@ -2786,9 +2786,9 @@ void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet )
else if ( bBidiDontCare )
rSet.InvalidateItem( nWhich );
else if ( nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT )
- rSet.Put( SfxBoolItem( nWhich, eBidiDir == EE_HTEXTDIR_L2R ) );
+ rSet.Put( SfxBoolItem( nWhich, eBidiDir == EEHorizontalTextDirection::L2R ) );
else
- rSet.Put( SfxBoolItem( nWhich, eBidiDir == EE_HTEXTDIR_R2L ) );
+ rSet.Put( SfxBoolItem( nWhich, eBidiDir == EEHorizontalTextDirection::R2L ) );
}
}
nWhich = aIter.NextWhich();
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index effa25a89b13..25bc75f745ce 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -2123,7 +2123,7 @@ ScFieldEditEngine* ScOutputData::CreateOutputEditEngine()
pEngine->SetControlWord( nCtrl );
mpDoc->ApplyAsianEditSettings( *pEngine );
pEngine->EnableAutoColor( mbUseStyleColor );
- pEngine->SetDefaultHorizontalTextDirection( (EEHorizontalTextDirection)mpDoc->GetEditTextDirection( nTab ) );
+ pEngine->SetDefaultHorizontalTextDirection( mpDoc->GetEditTextDirection( nTab ) );
return pEngine;
}
diff --git a/sc/source/ui/view/output3.cxx b/sc/source/ui/view/output3.cxx
index 4fdf0a2b67aa..9cb20ad3c1ad 100644
--- a/sc/source/ui/view/output3.cxx
+++ b/sc/source/ui/view/output3.cxx
@@ -178,7 +178,7 @@ void ScOutputData::DrawSelectiveObjects(SdrLayerID nLayer)
SdrOutliner& rOutl = pModel->GetDrawOutliner();
rOutl.EnableAutoColor( mbUseStyleColor );
rOutl.SetDefaultHorizontalTextDirection(
- (EEHorizontalTextDirection)mpDoc->GetEditTextDirection( nTab ) );
+ mpDoc->GetEditTextDirection( nTab ) );
// #i69767# The hyphenator must be set (used to be before drawing a text shape with hyphenation).
// LinguMgr::GetHyphenator (EditEngine) uses a wrapper now that creates the real hyphenator on demand,
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 1728e4990927..a7fe6dc18ce8 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -3472,7 +3472,7 @@ void ScViewData::UpdateOutlinerFlags( Outliner& rOutl ) const
}
rOutl.SetDefaultHorizontalTextDirection(
- (EEHorizontalTextDirection)pLocalDoc->GetEditTextDirection( nTabNo ) );
+ pLocalDoc->GetEditTextDirection( nTabNo ) );
}
ScAddress ScViewData::GetCurPos() const
diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx
index 6f1c02898f76..5cd851f2c66e 100644
--- a/sw/source/core/view/vdraw.cxx
+++ b/sw/source/core/view/vdraw.cxx
@@ -114,7 +114,7 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
Color aOldOutlinerBackgrdColor;
// set default horizontal text direction on painting <hell> or
// <heaven>.
- EEHorizontalTextDirection aOldEEHoriTextDir = EE_HTEXTDIR_L2R;
+ EEHorizontalTextDirection aOldEEHoriTextDir = EEHorizontalTextDirection::L2R;
const IDocumentDrawModelAccess& rIDDMA = GetShell()->getIDocumentDrawModelAccess();
if ( (_nLayerID == rIDDMA.GetHellId()) ||
(_nLayerID == rIDDMA.GetHeavenId()) )
@@ -131,7 +131,7 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
aOldEEHoriTextDir =
GetDrawView()->GetModel()->GetDrawOutliner().GetDefaultHorizontalTextDirection();
EEHorizontalTextDirection aEEHoriTextDirOfPage =
- _bIsPageRightToLeft ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
+ _bIsPageRightToLeft ? EEHorizontalTextDirection::R2L : EEHorizontalTextDirection::L2R;
GetDrawView()->GetModel()->GetDrawOutliner().SetDefaultHorizontalTextDirection( aEEHoriTextDirOfPage );
}
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 013e40085d02..4366440bf8d4 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -538,7 +538,7 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin,
// set default horizontal text direction at outliner
EEHorizontalTextDirection aDefHoriTextDir =
- pSh->IsShapeDefaultHoriTextDirR2L() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
+ pSh->IsShapeDefaultHoriTextDirR2L() ? EEHorizontalTextDirection::R2L : EEHorizontalTextDirection::L2R;
pOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
}
commit 12bb4bc980863d4338725cf5a5dcaf3acbfddc09
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Dec 15 15:35:18 2017 +0200
convert HyperLinkPageType to scoped enum
Change-Id: I9554cdee56c7079ed8633ffb16074c99d5ab144e
Reviewed-on: https://gerrit.libreoffice.org/46588
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index cc301e5b47c2..50255e36ae35 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -102,16 +102,16 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
aImage = Image(aBitmap);
}
aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLINETTP );
- pEntry = AddTabPage ( HyperLinkPageType::INTERNET, aStrTitle, imgVector[0], SvxHyperlinkInternetTp::Create );
+ pEntry = AddTabPage ( HyperLinkPageType::Internet, aStrTitle, imgVector[0], SvxHyperlinkInternetTp::Create );
pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLINETTP_HELP ) );
aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLMAILTP );
- pEntry = AddTabPage ( HyperLinkPageType::MAIL, aStrTitle, imgVector[1], SvxHyperlinkMailTp::Create );
+ pEntry = AddTabPage ( HyperLinkPageType::Mail, aStrTitle, imgVector[1], SvxHyperlinkMailTp::Create );
pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLMAILTP_HELP ) );
aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLDOCTP );
- pEntry = AddTabPage ( HyperLinkPageType::DOCUMENT, aStrTitle, imgVector[2], SvxHyperlinkDocTp::Create );
+ pEntry = AddTabPage ( HyperLinkPageType::Document, aStrTitle, imgVector[2], SvxHyperlinkDocTp::Create );
pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLDOCTP_HELP ) );
aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLDOCNTP );
- pEntry = AddTabPage ( HyperLinkPageType::NEWDOCUMENT, aStrTitle, imgVector[3], SvxHyperlinkNewDocTp::Create );
+ pEntry = AddTabPage ( HyperLinkPageType::NewDocument, aStrTitle, imgVector[3], SvxHyperlinkNewDocTp::Create );
pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP ) );
// set OK/Cancel - button
@@ -127,25 +127,25 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
SetInputSet (mpItemSet.get());
//loop through the pages and get their max bounds and lock that down
- ShowPage(HyperLinkPageType::NEWDOCUMENT);
+ ShowPage(HyperLinkPageType::NewDocument);
VclBox *pBox = get_content_area();
Size aMaxPrefSize(pBox->get_preferred_size());
- ShowPage(HyperLinkPageType::DOCUMENT);
+ ShowPage(HyperLinkPageType::Document);
Size aSize(pBox->get_preferred_size());
aMaxPrefSize.Width() = std::max(aMaxPrefSize.Width(), aSize.Width());
aMaxPrefSize.Height() = std::max(aMaxPrefSize.Height(), aSize.Height());
- ShowPage(HyperLinkPageType::MAIL);
+ ShowPage(HyperLinkPageType::Mail);
aSize = pBox->get_preferred_size();
aMaxPrefSize.Width() = std::max(aMaxPrefSize.Width(), aSize.Width());
aMaxPrefSize.Height() = std::max(aMaxPrefSize.Height(), aSize.Height());
- ShowPage(HyperLinkPageType::INTERNET);
+ ShowPage(HyperLinkPageType::Internet);
aSize = pBox->get_preferred_size();
aMaxPrefSize.Width() = std::max(aMaxPrefSize.Width(), aSize.Width());
aMaxPrefSize.Height() = std::max(aMaxPrefSize.Height(), aSize.Height());
pBox->set_width_request(aMaxPrefSize.Width());
pBox->set_height_request(aMaxPrefSize.Height());
- SetCurPageId(HyperLinkPageType::INTERNET);
+ SetCurPageId(HyperLinkPageType::Internet);
// Init Dialog
Start();
@@ -301,7 +301,7 @@ IMPL_LINK_NOARG(SvxHpLinkDlg, ClickCloseHdl_Impl, Button*, void)
void SvxHpLinkDlg::SetPage ( SvxHyperlinkItem const * pItem )
{
- sal_uInt16 nPageId = HyperLinkPageType::INTERNET;
+ HyperLinkPageType nPageId = HyperLinkPageType::Internet;
OUString aStrURL(pItem->GetURL());
INetURLObject aURL(aStrURL);
@@ -311,17 +311,17 @@ void SvxHpLinkDlg::SetPage ( SvxHyperlinkItem const * pItem )
{
case INetProtocol::Http :
case INetProtocol::Ftp :
- nPageId = HyperLinkPageType::INTERNET;
+ nPageId = HyperLinkPageType::Internet;
break;
case INetProtocol::File :
- nPageId = HyperLinkPageType::DOCUMENT;
+ nPageId = HyperLinkPageType::Document;
break;
case INetProtocol::Mailto :
- nPageId = HyperLinkPageType::MAIL;
+ nPageId = HyperLinkPageType::Mail;
break;
default :
if (aStrURL.startsWith("#"))
- nPageId = HyperLinkPageType::DOCUMENT;
+ nPageId = HyperLinkPageType::Document;
else
{
// not valid
@@ -371,7 +371,7 @@ void SvxHpLinkDlg::SetReadOnlyMode( bool bRdOnly )
|*
|************************************************************************/
-void SvxHpLinkDlg::PageCreated( sal_uInt16 /*nId*/, IconChoicePage& rPage )
+void SvxHpLinkDlg::PageCreated( HyperLinkPageType /*nId*/, IconChoicePage& rPage )
{
SvxHyperlinkTabPageBase& rHyperlinkPage = dynamic_cast< SvxHyperlinkTabPageBase& >( rPage );
Reference< XFrame > xDocumentFrame;
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index ce3d292b97b0..acf04885b488 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -22,6 +22,7 @@
#include <dialmgr.hxx>
#include <iconcdlg.hxx>
+#include <cuihyperdlg.hxx>
#include <helpids.h>
#include <unotools/viewoptions.hxx>
@@ -148,7 +149,7 @@ VCL_BUILDER_FACTORY_ARGS(SvtIconChoiceCtrl,
IconChoiceDialog::IconChoiceDialog ( vcl::Window* pParent, const OUString& rID,
const OUString& rUIXMLDescription )
: SfxModalDialog ( pParent, rID, rUIXMLDescription ),
- mnCurrentPageId ( USHRT_MAX ),
+ mnCurrentPageId ( HyperLinkPageType::NONE ),
pSet ( nullptr ),
pOutSet ( nullptr ),
@@ -255,7 +256,7 @@ void IconChoiceDialog::dispose()
\**********************************************************************/
SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage(
- sal_uInt16 nId,
+ HyperLinkPageType nId,
const OUString& rIconText,
const Image& rChoiceIcon,
CreatePage pCreateFunc /* != 0 */
@@ -264,9 +265,8 @@ SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage(
IconChoicePageData* pData = new IconChoicePageData ( nId, pCreateFunc );
maPageList.push_back( pData );
- sal_uInt16 *pId = new sal_uInt16 ( nId );
SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->InsertEntry( rIconText, rChoiceIcon );
- pEntry->SetUserData ( static_cast<void*>(pId) );
+ pEntry->SetUserData ( reinterpret_cast<void*>(nId) );
return pEntry;
}
@@ -296,9 +296,9 @@ void IconChoiceDialog::HidePageImpl ( IconChoicePageData const * pData )
pData->pPage->Hide();
}
-void IconChoiceDialog::ShowPage(sal_uInt16 nId)
+void IconChoiceDialog::ShowPage(HyperLinkPageType nId)
{
- sal_uInt16 nOldPageId = GetCurPageId();
+ HyperLinkPageType nOldPageId = GetCurPageId();
bool bInvalidate = nOldPageId != nId;
if (bInvalidate)
{
@@ -329,11 +329,11 @@ IMPL_LINK_NOARG(IconChoiceDialog , ChosePageHdl_Impl, SvtIconChoiceCtrl*, void)
if ( !pEntry )
pEntry = m_pIconCtrl->GetCursor( );
- sal_uInt16 *pId = static_cast<sal_uInt16*>(pEntry->GetUserData());
+ HyperLinkPageType nId = static_cast<HyperLinkPageType>(reinterpret_cast<sal_uIntPtr>(pEntry->GetUserData()));
- if( *pId != mnCurrentPageId )
+ if( nId != mnCurrentPageId )
{
- ShowPage(*pId);
+ ShowPage(nId);
}
}
@@ -536,7 +536,7 @@ void IconChoiceDialog::SetInputSet( const SfxItemSet* pInSet )
}
-void IconChoiceDialog::PageCreated( sal_uInt16 /*nId*/, IconChoicePage& /*rPage*/ )
+void IconChoiceDialog::PageCreated( HyperLinkPageType /*nId*/, IconChoicePage& /*rPage*/ )
{
// not interested in
}
@@ -593,7 +593,7 @@ void IconChoiceDialog::Start_Impl()
|
\**********************************************************************/
-IconChoicePageData* IconChoiceDialog::GetPageData ( sal_uInt16 nId )
+IconChoicePageData* IconChoiceDialog::GetPageData ( HyperLinkPageType nId )
{
IconChoicePageData *pRet = nullptr;
for (IconChoicePageData* pData : maPageList)
@@ -656,7 +656,7 @@ void IconChoiceDialog::Ok()
for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i )
{
- IconChoicePageData* pData = GetPageData ( i );
+ IconChoicePageData* pData = GetPageData ( maPageList[i]->nId );
IconChoicePage* pPage = pData->pPage;
@@ -677,15 +677,15 @@ void IconChoiceDialog::Ok()
}
}
-void IconChoiceDialog::FocusOnIcon( sal_uInt16 nId )
+void IconChoiceDialog::FocusOnIcon( HyperLinkPageType nId )
{
// set focus to icon for the current visible page
for ( sal_Int32 i=0; i<m_pIconCtrl->GetEntryCount(); i++)
{
SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry ( i );
- sal_uInt16* pUserData = static_cast<sal_uInt16*>(pEntry->GetUserData());
+ HyperLinkPageType nUserData = static_cast<HyperLinkPageType>(reinterpret_cast<sal_uIntPtr>(pEntry->GetUserData()));
- if ( pUserData && *pUserData == nId )
+ if ( nUserData == nId )
{
m_pIconCtrl->SetCursor( pEntry );
break;
diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx
index 10e1f2d343b2..c832f17f7f49 100644
--- a/cui/source/inc/cuihyperdlg.hxx
+++ b/cui/source/inc/cuihyperdlg.hxx
@@ -33,12 +33,13 @@
#include "iconcdlg.hxx"
// hyperlink dialog
-enum HyperLinkPageType
+enum class HyperLinkPageType
{
- INTERNET,
- MAIL,
- DOCUMENT,
- NEWDOCUMENT
+ Internet,
+ Mail,
+ Document,
+ NewDocument,
+ NONE = USHRT_MAX
};
/*************************************************************************
@@ -94,7 +95,7 @@ public:
virtual ~SvxHpLinkDlg () override;
virtual void dispose() override;
- virtual void PageCreated( sal_uInt16 nId, IconChoicePage& rPage ) override;
+ virtual void PageCreated( HyperLinkPageType nId, IconChoicePage& rPage ) override;
void SetPage( SvxHyperlinkItem const * pItem );
void SetReadOnlyMode( bool bReadOnly );
diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx
index c5df3f09c70d..040444abb324 100644
--- a/cui/source/inc/iconcdlg.hxx
+++ b/cui/source/inc/iconcdlg.hxx
@@ -37,6 +37,7 @@ class IconChoiceDialog;
class IconChoicePage;
class SfxItemPool;
class SfxItemSet;
+enum class HyperLinkPageType;
// Create-Function
typedef VclPtr<IconChoicePage> (*CreatePage)(vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet* pAttrSet);
@@ -44,13 +45,13 @@ typedef VclPtr<IconChoicePage> (*CreatePage)(vcl::Window *pParent, IconChoiceDia
/// Data-structure for pages in dialog
struct IconChoicePageData
{
- sal_uInt16 nId;
+ HyperLinkPageType nId;
CreatePage fnCreatePage; ///< pointer to the factory
VclPtr<IconChoicePage> pPage; ///< the TabPage itself
bool bRefresh; ///< Flag: page has to be newly initialized
// constructor
- IconChoicePageData( sal_uInt16 Id, CreatePage fnPage )
+ IconChoicePageData( HyperLinkPageType Id, CreatePage fnPage )
: nId ( Id ),
fnCreatePage ( fnPage ),
pPage ( nullptr ),
@@ -102,7 +103,7 @@ private:
VclPtr<SvtIconChoiceCtrl> m_pIconCtrl;
- sal_uInt16 mnCurrentPageId;
+ HyperLinkPageType mnCurrentPageId;
// Buttons
VclPtr<OKButton> m_pOKBtn;
@@ -123,18 +124,18 @@ private:
DECL_LINK( ResetHdl, Button*, void) ;
DECL_LINK( CancelHdl, Button*, void );
- IconChoicePageData* GetPageData ( sal_uInt16 nId );
+ IconChoicePageData* GetPageData ( HyperLinkPageType nId );
void Start_Impl();
bool OK_Impl();
- void FocusOnIcon ( sal_uInt16 nId );
+ void FocusOnIcon ( HyperLinkPageType nId );
protected:
static void ShowPageImpl ( IconChoicePageData const * pData );
static void HidePageImpl ( IconChoicePageData const * pData );
- virtual void PageCreated( sal_uInt16 nId, IconChoicePage& rPage );
- IconChoicePage* GetTabPage( sal_uInt16 nPageId )
+ virtual void PageCreated( HyperLinkPageType nId, IconChoicePage& rPage );
+ IconChoicePage* GetTabPage( HyperLinkPageType nPageId )
{ return ( GetPageData (nPageId)->pPage ? GetPageData (nPageId)->pPage.get() : nullptr); }
void ActivatePageImpl ();
@@ -152,12 +153,12 @@ public:
// interface
SvxIconChoiceCtrlEntry* AddTabPage(
- sal_uInt16 nId, const OUString& rIconText, const Image& rChoiceIcon,
+ HyperLinkPageType nId, const OUString& rIconText, const Image& rChoiceIcon,
CreatePage pCreateFunc /* != NULL */ );
- void SetCurPageId( sal_uInt16 nId ) { mnCurrentPageId = nId; FocusOnIcon( nId ); }
- sal_uInt16 GetCurPageId() const { return mnCurrentPageId; }
- void ShowPage( sal_uInt16 nId );
+ void SetCurPageId( HyperLinkPageType nId ) { mnCurrentPageId = nId; FocusOnIcon( nId ); }
+ HyperLinkPageType GetCurPageId() const { return mnCurrentPageId; }
+ void ShowPage( HyperLinkPageType nId );
/// gives via map converted local slots if applicable
const sal_uInt16* GetInputRanges( const SfxItemPool& );
commit 0045ee9b7f028dba5f9a3cad43125c9154169ef0
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Dec 15 15:13:56 2017 +0200
convert ColorPickerMode to scoped enum
and drop unused Add constant
Change-Id: I4e4f0d35e4d081883b78e0205ffd7086c9cadf04
Reviewed-on: https://gerrit.libreoffice.org/46587
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 185f28fcfcc4..055bf4f19af8 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -424,7 +424,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, Button*, void)
std::unique_ptr<SvColorDialog> pColorDlg(new SvColorDialog( GetParentDialog() ));
pColorDlg->SetColor (aCurrentColor);
- pColorDlg->SetMode( svtools::ColorPickerMode_MODIFY );
+ pColorDlg->SetMode( svtools::ColorPickerMode::Modify );
if( pColorDlg->Execute() == RET_OK )
{
diff --git a/include/svtools/colrdlg.hxx b/include/svtools/colrdlg.hxx
index af7c27c6b441..69def8510b35 100644
--- a/include/svtools/colrdlg.hxx
+++ b/include/svtools/colrdlg.hxx
@@ -28,8 +28,9 @@ namespace vcl { class Window; }
namespace svtools
{
- // SELECT is the default
- enum ColorPickerMode { ColorPickerMode_SELECT = 0, ColorPickerMode_ADD = 1, ColorPickerMode_MODIFY = 2 };
+ // Select is the default.
+ // These values must match the constants used in ColorPickerDialog in cui/source/dialogs/colorpicker.cxx
+ enum class ColorPickerMode { Select = 0, Modify = 2 };
}
class SVT_DLLPUBLIC SvColorDialog final
@@ -41,14 +42,14 @@ public:
void SetColor( const Color& rColor );
const Color& GetColor() const { return maColor;}
- void SetMode( sal_Int16 eMode );
+ void SetMode( svtools::ColorPickerMode eMode );
short Execute();
private:
VclPtr<vcl::Window> mpParent;
Color maColor;
- sal_Int16 meMode;
+ svtools::ColorPickerMode meMode;
};
#endif // INCLUDED_SVTOOLS_COLRDLG_HXX
diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx
index be1ceb111af6..a0d4af23f78f 100644
--- a/svtools/source/dialogs/colrdlg.cxx
+++ b/svtools/source/dialogs/colrdlg.cxx
@@ -39,7 +39,7 @@ using namespace ::com::sun::star::ui::dialogs;
SvColorDialog::SvColorDialog( vcl::Window* pWindow )
: mpParent( pWindow )
-, meMode( svtools::ColorPickerMode_SELECT )
+, meMode( svtools::ColorPickerMode::Select )
{
}
@@ -53,7 +53,7 @@ void SvColorDialog::SetColor( const Color& rColor )
}
-void SvColorDialog::SetMode( sal_Int16 eMode )
+void SvColorDialog::SetMode( svtools::ColorPickerMode eMode )
{
meMode = eMode;
}
@@ -76,7 +76,7 @@ short SvColorDialog::Execute()
props[0].Name = sColor;
props[0].Value <<= (sal_Int32) maColor.GetColor();
props[1].Name = "Mode";
- props[1].Value <<= meMode;
+ props[1].Value <<= static_cast<sal_Int16>(meMode);
xPropertyAccess->setPropertyValues( props );
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 35b376c3839c..a275670e33c1 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -311,7 +311,7 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand, const Color& rIn
OUString aCommandCopy = aCommand;
SvColorDialog aColorDlg( nullptr );
aColorDlg.SetColor(rInitialColor);
- aColorDlg.SetMode(svtools::ColorPickerMode_MODIFY);
+ aColorDlg.SetMode(svtools::ColorPickerMode::Modify);
if( aColorDlg.Execute() == RET_OK )
{
if (mpBtnUpdater)
More information about the Libreoffice-commits
mailing list