Kaydet (Commit) 63ca46a0 authored tarafından Zolnai Tamás's avatar Zolnai Tamás

Transparency part of Background Tab is unused now

It was used for frames, but on Frame Dialog
Background Tab was replaced with Area Tab.

Change-Id: I69774c7321a210094f6e139a5b3d4d5819947ceb
üst 0bf12a06
......@@ -64,7 +64,6 @@ public:
/// for the Writer (paragraph/characters)
void ShowParaControl(bool bCharOnly = false);
void EnableTransparency(bool bColor, bool bGraphic);
virtual void PageCreated(const SfxAllItemSet& aSet) SAL_OVERRIDE;
protected:
virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
......@@ -85,8 +84,6 @@ private:
VclPtr<SvxColorValueSet> m_pBackgroundColorSet;
VclPtr<BackgroundPreviewImpl> m_pPreviewWin1;
VclPtr<FixedText> m_pColTransFT;///<color transparency
VclPtr<MetricField> m_pColTransMF;
VclPtr<CheckBox> m_pBtnPreview;
// Background Bitmap ----------------------------------
......@@ -103,9 +100,6 @@ private:
VclPtr<RadioButton> m_pBtnTile;
VclPtr<SvxRectCtl> m_pWndPosition;
VclPtr<VclContainer> m_pGraphTransFrame;///<transparency of graphics
VclPtr<MetricField> m_pGraphTransMF;
VclPtr<BackgroundPreviewImpl> m_pPreviewWin2;
// DDListBox for Writer -------------------------------
......@@ -115,8 +109,6 @@ private:
bool bAllowShowSelector : 1;
bool bIsGraphicValid : 1;
bool bLinkOnly : 1;
bool bColTransparency : 1;
bool bGraphTransparency : 1;
Graphic aBgdGraphic;
OUString aBgdGraphicPath;
OUString aBgdGraphicFilter;
......
......@@ -115,21 +115,10 @@ struct SvxBackgroundPage_Impl
{}
};
static inline sal_uInt8 lcl_PercentToTransparency(long nPercent)
{
//0xff must not be returned!
return sal_uInt8(nPercent ? (50 + 0xfe * nPercent) / 100 : 0);
}
static inline sal_uInt8 lcl_TransparencyToPercent(sal_uInt8 nTrans)
{
return (nTrans * 100 + 127) / 254;
}
static void lcl_SetTransparency(SvxBrushItem& rBrush, long nTransparency)
{
uno::Any aTransparency;
aTransparency <<= (sal_Int8)nTransparency;
rBrush.PutValue(aTransparency, MID_GRAPHIC_TRANSPARENCY);
}
/// Returns the fill style of the currently selected entry.
static drawing::FillStyle lcl_getFillStyle(ListBox* pLbSelect)
......@@ -356,8 +345,6 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe
, bAllowShowSelector(true)
, bIsGraphicValid(false)
, bLinkOnly(false)
, bColTransparency(false)
, bGraphTransparency(false)
, pPageImpl(new SvxBackgroundPage_Impl)
, pImportDlg(NULL)
, pTableBck_Impl(NULL)
......@@ -374,8 +361,6 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe
get(m_pBackgroundColorSet, "backgroundcolorset");
get(m_pPreviewWin1, "preview1");
get(m_pColTransFT, "transparencyft");
get(m_pColTransMF, "transparencymf");
get(m_pBtnPreview, "showpreview");
get(m_pBitmapContainer, "graphicgrid");
......@@ -391,9 +376,6 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe
get(m_pBtnTile, "tilerb");
get(m_pWndPosition, "windowpos");
get(m_pGraphTransFrame, "graphtransframe");
get(m_pGraphTransMF, "graphtransmf");
get(m_pPreviewWin2, "preview2");
m_pPreviewWin2->setBmp(true);
......@@ -460,8 +442,6 @@ void SvxBackgroundTabPage::dispose()
m_pBackGroundColorFrame.clear();
m_pBackgroundColorSet.clear();
m_pPreviewWin1.clear();
m_pColTransFT.clear();
m_pColTransMF.clear();
m_pBtnPreview.clear();
m_pBitmapContainer.clear();
m_pFileFrame.clear();
......@@ -474,8 +454,6 @@ void SvxBackgroundTabPage::dispose()
m_pBtnArea.clear();
m_pBtnTile.clear();
m_pWndPosition.clear();
m_pGraphTransFrame.clear();
m_pGraphTransMF.clear();
m_pPreviewWin2.clear();
SvxTabPage::dispose();
}
......@@ -775,19 +753,12 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
SfxItemState eOldItemState = rCoreSet->GetItemState(nSlot, false);
const SfxItemSet& rOldSet = GetItemSet();
bool bGraphTransparencyChanged = bGraphTransparency && m_pGraphTransMF->IsValueChangedFromSaved();
if ( pOld )
{
const SvxBrushItem& rOldItem = static_cast<const SvxBrushItem&>(*pOld);
SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos();
const bool bIsBrush = ( drawing::FillStyle_SOLID == lcl_getFillStyle(m_pLbSelect) );
// transparency has to be set if enabled, the color not already set to "No fill" and
if( bColTransparency &&
aBgdColor.GetTransparency() < 0xff)
{
aBgdColor.SetTransparency(lcl_PercentToTransparency(static_cast<long>(m_pColTransMF->GetValue())));
}
if ( ( (GPOS_NONE == eOldPos) && bIsBrush )
|| ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap changed?
{
......@@ -817,8 +788,7 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
if ( !bIsLink && !bIsGraphicValid )
bIsGraphicValid = LoadLinkedGraphic_Impl();
if ( bGraphTransparencyChanged ||
eNewPos != eOldPos
if ( eNewPos != eOldPos
|| bIsLink != bWasLink
|| ( bWasLink && rOldItem.GetGraphicLink()
!= aBgdGraphicPath )
......@@ -840,7 +810,6 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
aTmpBrush = SvxBrushItem( aBgdGraphic,
eNewPos,
nWhich );
lcl_SetTransparency(aTmpBrush, static_cast<long>(m_pGraphTransMF->GetValue()));
rCoreSet->Put(aTmpBrush);
}
......@@ -876,7 +845,6 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
}
if(pTmpBrush)
{
lcl_SetTransparency(*pTmpBrush, static_cast<long>(m_pGraphTransMF->GetValue()));
rCoreSet->Put(*pTmpBrush);
}
}
......@@ -1156,12 +1124,6 @@ void SvxBackgroundTabPage::ShowColorUI_Impl()
{
HideBitmapUI_Impl();
m_pBackGroundColorFrame->Show();
if(bColTransparency)
{
m_pColTransFT->Show();
m_pColTransMF->Show();
}
}
}
......@@ -1190,10 +1152,6 @@ void SvxBackgroundTabPage::ShowBitmapUI_Impl()
m_pPreviewWin2->Show();
m_pBtnPreview->Show();
m_pGraphTransFrame->Show(bGraphTransparency);
m_pColTransFT->Show(false);
m_pColTransMF->Show(false);
}
}
......@@ -1204,7 +1162,6 @@ void SvxBackgroundTabPage::HideBitmapUI_Impl()
m_pTypeFrame->Hide();
m_pPreviewWin2->Hide();
m_pBtnPreview->Hide();
m_pGraphTransFrame->Hide();
}
void SvxBackgroundTabPage::SetGraphicPosition_Impl( SvxGraphicPosition ePos )
......@@ -1285,9 +1242,6 @@ IMPL_LINK_NOARG(SvxBackgroundTabPage, BackgroundColorHdl_Impl)
Color aColor = nItemId ? ( m_pBackgroundColorSet->GetItemColor( nItemId ) ) : Color( COL_TRANSPARENT );
aBgdColor = aColor;
m_pPreviewWin1->NotifyChange( aBgdColor );
bool bEnableTransp = aBgdColor.GetTransparency() < 0xff;
m_pColTransFT->Enable(bEnableTransp);
m_pColTransMF->Enable(bEnableTransp);
return 0;
}
......@@ -1638,17 +1592,6 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
{
SvxGraphicPosition ePos = rBgdAttr.GetGraphicPos();
const Color& rColor = rBgdAttr.GetColor();
if(bColTransparency)
{
m_pColTransMF->SetValue(lcl_TransparencyToPercent(rColor.GetTransparency()));
m_pColTransMF->SaveValue();
bool bEnableTransp = rColor.GetTransparency() < 0xff;
m_pColTransFT->Enable(bEnableTransp);
m_pColTransMF->Enable(bEnableTransp);
//the default setting should be "no transparency"
if(!bEnableTransp)
m_pColTransMF->SetValue(0);
}
if ( GPOS_NONE == ePos || !m_pLbSelect->IsVisible() )
{
......@@ -1709,16 +1652,6 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
m_pBtnLink->Disable();
}
if (bGraphTransparency)
{
const GraphicObject* pObject = rBgdAttr.GetGraphicObject();
if(pObject)
m_pGraphTransMF->SetValue(lcl_TransparencyToPercent(pObject->GetAttr().GetTransparency()));
else
m_pGraphTransMF->SetValue(0);
m_pGraphTransMF->SaveValue();
}
FileClickHdl_Impl(m_pBtnLink);
aBgdGraphicFilter = aStrFilter;
......@@ -1762,14 +1695,6 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
}
}
void SvxBackgroundTabPage::EnableTransparency(bool bColor, bool bGraphic)
{
bColTransparency = bColor;
bGraphTransparency = bGraphic;
m_pColTransFT->Show(bColor);
m_pColTransMF->Show(bColor);
}
void SvxBackgroundTabPage::PageCreated(const SfxAllItemSet& aSet)
{
SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,false);
......@@ -1783,8 +1708,6 @@ void SvxBackgroundTabPage::PageCreated(const SfxAllItemSet& aSet)
ShowParaControl();
if ( nFlags & SvxBackgroundTabFlags::SHOW_SELECTOR )
ShowSelector();
if ( nFlags & SvxBackgroundTabFlags::ENABLE_TRANSPARENCY )
EnableTransparency(true, true);
}
}
......
......@@ -154,41 +154,6 @@
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkGrid" id="grid12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="transparencyft">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes">_Transparency:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="transparencymf:0%">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="invisible_char"></property>
<property name="adjustment">adjustment1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
......@@ -525,43 +490,6 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="graphtransframe">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkSpinButton" id="graphtransmf:0%">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="invisible_char"></property>
<property name="adjustment">adjustment1</property>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Transparency</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
</object>
<packing>
......
......@@ -43,7 +43,6 @@ enum class SvxBackgroundTabFlags
NONE = 0x00,
SHOW_SELECTOR = 0x01,
SHOW_PARACTL = 0x02,
ENABLE_TRANSPARENCY = 0x04,
SHOW_TBLCTL = 0x08,
};
namespace o3tl
......
......@@ -249,14 +249,6 @@ SwTemplateDlg::SwTemplateDlg(vcl::Window* pParent,
SwFrmAddPage::GetRanges);
m_nWrapId = AddTabPage("wrap", SwWrapTabPage::Create,
SwWrapTabPage::GetRanges);
//UUUU remove?
//OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
//OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
//UUUU remove?
//m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
//OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
//OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
//UUUU add Area and Transparence TabPages
m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA ));
......@@ -484,8 +476,6 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
nFlagType |= SvxBackgroundTabFlags::SHOW_PARACTL;
if( SFX_STYLE_FAMILY_CHAR != nType )
nFlagType |= SvxBackgroundTabFlags::SHOW_SELECTOR;
if( SFX_STYLE_FAMILY_FRAME == nType )
nFlagType |= SvxBackgroundTabFlags::ENABLE_TRANSPARENCY;
aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(nFlagType)));
rPage.PageCreated(aSet);
}
......
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