unwind IL_PRE_BITMAPS ImageList

Change-Id: I71ad9f4a8e335fbf21cf121e68df163221a440df
This commit is contained in:
Caolán McNamara
2016-12-21 13:10:40 +00:00
parent 398a5f23a7
commit 6aca7389c6
5 changed files with 180 additions and 96 deletions

View File

@@ -102,7 +102,7 @@ private:
VclPtr<CheckBox> m_pRemoveAdjcentCellBordersCB;
std::vector<BitmapEx> m_aShadowImgVec;
ImageList aBorderImgLst;
std::vector<BitmapEx> m_aBorderImgVec;
long nMinValue; ///< minimum distance
SwBorderModes nSWMode; ///< table, textframe, paragraph

View File

@@ -184,6 +184,27 @@
#define RID_SVXBMP_SHADOW_BOT_LEFT (RID_SVX_START + 565)
#define RID_SVXBMP_SHADOW_TOP_RIGHT (RID_SVX_START + 566)
#define RID_SVXBMP_SHADOW_TOP_LEFT (RID_SVX_START + 567)
#define RID_SVXBMP_CELL_NONE (RID_SVX_START + 568)
#define RID_SVXBMP_CELL_ALL (RID_SVX_START + 569)
#define RID_SVXBMP_CELL_LR (RID_SVX_START + 570)
#define RID_SVXBMP_CELL_TB (RID_SVX_START + 571)
#define RID_SVXBMP_CELL_L (RID_SVX_START + 572)
#define RID_SVXBMP_CELL_DIAG (RID_SVX_START + 573)
#define RID_SVXBMP_HOR_NONE (RID_SVX_START + 574)
#define RID_SVXBMP_HOR_OUTER (RID_SVX_START + 575)
#define RID_SVXBMP_HOR_HOR (RID_SVX_START + 576)
#define RID_SVXBMP_HOR_ALL (RID_SVX_START + 577)
#define RID_SVXBMP_HOR_OUTER2 (RID_SVX_START + 578)
#define RID_SVXBMP_VER_NONE (RID_SVX_START + 579)
#define RID_SVXBMP_VER_OUTER (RID_SVX_START + 580)
#define RID_SVXBMP_VER_VER (RID_SVX_START + 581)
#define RID_SVXBMP_VER_ALL (RID_SVX_START + 582)
#define RID_SVXBMP_VER_OUTER2 (RID_SVX_START + 583)
#define RID_SVXBMP_TABLE_NONE (RID_SVX_START + 584)
#define RID_SVXBMP_TABLE_OUTER (RID_SVX_START + 585)
#define RID_SVXBMP_TABLE_OUTERH (RID_SVX_START + 586)
#define RID_SVXBMP_TABLE_ALL (RID_SVX_START + 587)
#define RID_SVXBMP_TABLE_OUTER2 (RID_SVX_START + 588)
#define RID_SVXPAGE_HYPERLINK_INTERNET (RID_SVX_START + 228)
#define RID_SVXPAGE_HYPERLINK_MAIL (RID_SVX_START + 229)
#define RID_SVXPAGE_HYPERLINK_DOCUMENT (RID_SVX_START + 230)

View File

@@ -24,7 +24,6 @@
#include <svx/dialmgr.hxx>
#include <cuires.hrc>
#include "border.hrc"
#include "helpid.hrc"
#include <svx/xtable.hxx>
@@ -94,7 +93,6 @@ const sal_uInt16 SVX_BORDER_SHADOW_COUNT = 5;
SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCoreAttrs)
: SfxTabPage(pParent, "BorderPage", "cui/ui/borderpage.ui", &rCoreAttrs)
, aBorderImgLst( CUI_RES(IL_PRE_BITMAPS))
, nMinValue(0)
, nSWMode(SwBorderModes::NONE)
, mbHorEnabled(false)
@@ -137,7 +135,35 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore
get(m_pMergeAdjacentBordersCB, "mergeadjacent");
get(m_pRemoveAdjcentCellBordersCB, "rmadjcellborders");
static const sal_uInt16 pnImgIds[SVX_BORDER_SHADOW_COUNT] =
static const sal_uInt16 pnBorderImgIds[] =
{
RID_SVXBMP_CELL_NONE,
RID_SVXBMP_CELL_ALL,
RID_SVXBMP_CELL_LR,
RID_SVXBMP_CELL_TB,
RID_SVXBMP_CELL_L,
RID_SVXBMP_CELL_DIAG,
RID_SVXBMP_HOR_NONE,
RID_SVXBMP_HOR_OUTER,
RID_SVXBMP_HOR_HOR,
RID_SVXBMP_HOR_ALL,
RID_SVXBMP_HOR_OUTER2,
RID_SVXBMP_VER_NONE,
RID_SVXBMP_VER_OUTER,
RID_SVXBMP_VER_VER,
RID_SVXBMP_VER_ALL,
RID_SVXBMP_VER_OUTER2,
RID_SVXBMP_TABLE_NONE,
RID_SVXBMP_TABLE_OUTER,
RID_SVXBMP_TABLE_OUTERH,
RID_SVXBMP_TABLE_ALL,
RID_SVXBMP_TABLE_OUTER2
};
for (size_t i = 0; i < SAL_N_ELEMENTS(pnBorderImgIds); ++i)
m_aBorderImgVec.push_back(BitmapEx(CUI_RES(pnBorderImgIds[i])));
static const sal_uInt16 pnShadowImgIds[SVX_BORDER_SHADOW_COUNT] =
{
RID_SVXBMP_SHADOWNONE,
RID_SVXBMP_SHADOW_BOT_RIGHT,
@@ -146,21 +172,16 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore
RID_SVXBMP_SHADOW_TOP_LEFT
};
for (size_t i = 0; i < SAL_N_ELEMENTS(pnImgIds); ++i)
m_aShadowImgVec.push_back(BitmapEx(CUI_RES(pnImgIds[i])));
for (size_t i = 0; i < SAL_N_ELEMENTS(pnShadowImgIds); ++i)
m_aShadowImgVec.push_back(BitmapEx(CUI_RES(pnShadowImgIds[i])));
assert(m_aShadowImgVec.size() == SVX_BORDER_SHADOW_COUNT);
if ( GetDPIScaleFactor() > 1 )
{
for (short i = 0; i < aBorderImgLst.GetImageCount(); i++)
{
OUString rImageName = aBorderImgLst.GetImageName(i);
BitmapEx b = aBorderImgLst.GetImage(rImageName).GetBitmapEx();
b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
aBorderImgLst.ReplaceImage(rImageName, Image(b));
}
for (size_t i = 0; i < m_aBorderImgVec.size(); ++i)
m_aBorderImgVec[i].Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
for (size_t i = 0; i < m_aShadowImgVec.size(); i++)
for (size_t i = 0; i < m_aShadowImgVec.size(); ++i)
m_aShadowImgVec[i].Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
}
@@ -767,12 +788,32 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
return bAttrsChanged;
}
void SvxBorderTabPage::HideShadowControls()
{
m_pShadowFrame->Hide();
}
#define IID_PRE_CELL_NONE 1
#define IID_PRE_CELL_ALL 2
#define IID_PRE_CELL_LR 3
#define IID_PRE_CELL_TB 4
#define IID_PRE_CELL_L 5
#define IID_PRE_CELL_DIAG 6
#define IID_PRE_HOR_NONE 7
#define IID_PRE_HOR_OUTER 8
#define IID_PRE_HOR_HOR 9
#define IID_PRE_HOR_ALL 10
#define IID_PRE_HOR_OUTER2 11
#define IID_PRE_VER_NONE 12
#define IID_PRE_VER_OUTER 13
#define IID_PRE_VER_VER 14
#define IID_PRE_VER_ALL 15
#define IID_PRE_VER_OUTER2 16
#define IID_PRE_TABLE_NONE 17
#define IID_PRE_TABLE_OUTER 18
#define IID_PRE_TABLE_OUTERH 19
#define IID_PRE_TABLE_ALL 20
#define IID_PRE_TABLE_OUTER2 21
IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, ValueSet*, void)
{
@@ -954,11 +995,8 @@ sal_uInt16 SvxBorderTabPage::GetPresetStringId( sal_uInt16 nValueSetIdx ) const
return pnStrIds[ GetPresetImageId( nValueSetIdx ) - 1 ];
}
void SvxBorderTabPage::FillPresetVS()
{
ImageList& rImgList = aBorderImgLst;
// basic initialization of the ValueSet
m_pWndPresets->SetStyle( m_pWndPresets->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
m_pWndPresets->SetColCount( SVX_BORDER_PRESET_COUNT );
@@ -967,7 +1005,7 @@ void SvxBorderTabPage::FillPresetVS()
for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_PRESET_COUNT; ++nVSIdx )
{
m_pWndPresets->InsertItem( nVSIdx );
m_pWndPresets->SetItemImage( nVSIdx, rImgList.GetImage( GetPresetImageId( nVSIdx ) ) );
m_pWndPresets->SetItemImage(nVSIdx, Image(m_aBorderImgVec[nVSIdx-1]));
m_pWndPresets->SetItemText( nVSIdx, CUI_RESSTR( GetPresetStringId( nVSIdx ) ) );
}
@@ -976,7 +1014,6 @@ void SvxBorderTabPage::FillPresetVS()
m_pWndPresets->Show();
}
void SvxBorderTabPage::FillShadowVS()
{
// basic initialization of the ValueSet

View File

@@ -1,48 +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_CUI_SOURCE_TABPAGES_BORDER_HRC
#define INCLUDED_CUI_SOURCE_TABPAGES_BORDER_HRC
// ImageList for ValueSets:
#define IL_PRE_BITMAPS 1400
#define IID_PRE_CELL_NONE 1
#define IID_PRE_CELL_ALL 2
#define IID_PRE_CELL_LR 3
#define IID_PRE_CELL_TB 4
#define IID_PRE_CELL_L 5
#define IID_PRE_CELL_DIAG 6
#define IID_PRE_HOR_NONE 7
#define IID_PRE_HOR_OUTER 8
#define IID_PRE_HOR_HOR 9
#define IID_PRE_HOR_ALL 10
#define IID_PRE_HOR_OUTER2 11
#define IID_PRE_VER_NONE 12
#define IID_PRE_VER_OUTER 13
#define IID_PRE_VER_VER 14
#define IID_PRE_VER_ALL 15
#define IID_PRE_VER_OUTER2 16
#define IID_PRE_TABLE_NONE 17
#define IID_PRE_TABLE_OUTER 18
#define IID_PRE_TABLE_OUTERH 19
#define IID_PRE_TABLE_ALL 20
#define IID_PRE_TABLE_OUTER2 21
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -19,37 +19,111 @@
#include "helpid.hrc"
#include <cuires.hrc>
#include "border.hrc"
#include <svx/dialogs.hrc>
ImageList IL_PRE_BITMAPS
Bitmap RID_SVXBMP_CELL_NONE
{
Prefix = "pr";
IdList =
{
IID_PRE_CELL_NONE ;
IID_PRE_CELL_ALL ;
IID_PRE_CELL_LR ;
IID_PRE_CELL_TB ;
IID_PRE_CELL_L ;
IID_PRE_CELL_DIAG ;
IID_PRE_HOR_NONE ;
IID_PRE_HOR_OUTER ;
IID_PRE_HOR_HOR ;
IID_PRE_HOR_ALL ;
IID_PRE_HOR_OUTER2 ;
IID_PRE_VER_NONE ;
IID_PRE_VER_OUTER ;
IID_PRE_VER_VER ;
IID_PRE_VER_ALL ;
IID_PRE_VER_OUTER2 ;
IID_PRE_TABLE_NONE ;
IID_PRE_TABLE_OUTER ;
IID_PRE_TABLE_OUTERH ;
IID_PRE_TABLE_ALL ;
IID_PRE_TABLE_OUTER2 ;
};
IdCount = { 21 ; };
File = "pr01.png";
};
Bitmap RID_SVXBMP_CELL_ALL
{
File = "pr02.png";
};
Bitmap RID_SVXBMP_CELL_LR
{
File = "pr03.png";
};
Bitmap RID_SVXBMP_CELL_TB
{
File = "pr04.png";
};
Bitmap RID_SVXBMP_CELL_L
{
File = "pr05.png";
};
Bitmap RID_SVXBMP_CELL_DIAG
{
File = "pr06.png";
};
Bitmap RID_SVXBMP_HOR_NONE
{
File = "pr07.png";
};
Bitmap RID_SVXBMP_HOR_OUTER
{
File = "pr08.png";
};
Bitmap RID_SVXBMP_HOR_HOR
{
File = "pr09.png";
};
Bitmap RID_SVXBMP_HOR_ALL
{
File = "pr010.png";
};
Bitmap RID_SVXBMP_HOR_OUTER2
{
File = "pr011.png";
};
Bitmap RID_SVXBMP_VER_NONE
{
File = "pr012.png";
};
Bitmap RID_SVXBMP_VER_OUTER
{
File = "pr013.png";
};
Bitmap RID_SVXBMP_VER_VER
{
File = "pr014.png";
};
Bitmap RID_SVXBMP_VER_ALL
{
File = "pr015.png";
};
Bitmap RID_SVXBMP_VER_OUTER2
{
File = "pr016.png";
};
Bitmap RID_SVXBMP_TABLE_NONE
{
File = "pr017.png";
};
Bitmap RID_SVXBMP_TABLE_OUTER
{
File = "pr018.png";
};
Bitmap RID_SVXBMP_TABLE_OUTERH
{
File = "pr019.png";
};
Bitmap RID_SVXBMP_TABLE_ALL
{
File = "pr020.png";
};
Bitmap RID_SVXBMP_TABLE_OUTER2
{
File = "pr021.png";
};
Bitmap RID_SVXBMP_SHADOWNONE