Kaydet (Commit) 9965f611 authored tarafından Zolnai Tamás's avatar Zolnai Tamás Kaydeden (comit) Andras Timar

Handle highlighting case inside SvxBackgroundPage class

... instead of converting attributes.

(cherry picked from commit 62fb96e0)

Change-Id: I3e45c0641389a7b6bdecb5141646aa13ee5c0aa5
üst 54028ff5
...@@ -113,7 +113,6 @@ void SvxSearchFormatDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage ) ...@@ -113,7 +113,6 @@ void SvxSearchFormatDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage )
} }
else if (nId == m_nBackPageId) else if (nId == m_nBackPageId)
{ {
static_cast<SvxBackgroundTabPage&>(rPage).ShowParaControl(true);
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_HIGHLIGHTING))); aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_HIGHLIGHTING)));
rPage.PageCreated(aSet); rPage.PageCreated(aSet);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <svx/SvxColorValueSet.hxx> #include <svx/SvxColorValueSet.hxx>
#include <svx/dlgctrl.hxx> #include <svx/dlgctrl.hxx>
#include <editeng/brushitem.hxx> #include <editeng/brushitem.hxx>
#include <memory>
class BackgroundPreviewImpl; class BackgroundPreviewImpl;
class SvxOpenGraphicDialog; class SvxOpenGraphicDialog;
...@@ -118,6 +119,8 @@ private: ...@@ -118,6 +119,8 @@ private:
bool bLinkOnly : 1; bool bLinkOnly : 1;
bool bColTransparency : 1; bool bColTransparency : 1;
bool bGraphTransparency : 1; bool bGraphTransparency : 1;
bool bHighlighting : 1;
Graphic aBgdGraphic; Graphic aBgdGraphic;
OUString aBgdGraphicPath; OUString aBgdGraphicPath;
OUString aBgdGraphicFilter; OUString aBgdGraphicFilter;
...@@ -127,6 +130,7 @@ private: ...@@ -127,6 +130,7 @@ private:
SvxBackgroundTable_Impl* pTableBck_Impl;///< Items for Sw-Table must be corrected SvxBackgroundTable_Impl* pTableBck_Impl;///< Items for Sw-Table must be corrected
SvxBackgroundPara_Impl* pParaBck_Impl;///< also for the paragraph style SvxBackgroundPara_Impl* pParaBck_Impl;///< also for the paragraph style
std::unique_ptr<SvxBrushItem> pHighlighting;
void FillColorValueSets_Impl(); void FillColorValueSets_Impl();
void ShowColorUI_Impl(); void ShowColorUI_Impl();
......
...@@ -358,10 +358,12 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe ...@@ -358,10 +358,12 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(vcl::Window* pParent, const SfxItemSe
, bLinkOnly(false) , bLinkOnly(false)
, bColTransparency(false) , bColTransparency(false)
, bGraphTransparency(false) , bGraphTransparency(false)
, bHighlighting(false)
, pPageImpl(new SvxBackgroundPage_Impl) , pPageImpl(new SvxBackgroundPage_Impl)
, pImportDlg(NULL) , pImportDlg(NULL)
, pTableBck_Impl(NULL) , pTableBck_Impl(NULL)
, pParaBck_Impl(NULL) , pParaBck_Impl(NULL)
, pHighlighting(nullptr)
{ {
get(m_pAsGrid, "asgrid"); get(m_pAsGrid, "asgrid");
get(m_pSelectTxt, "asft"); get(m_pSelectTxt, "asft");
...@@ -554,6 +556,10 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) ...@@ -554,6 +556,10 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet )
break; break;
} }
} }
else if( bHighlighting )
{
nSlot = SID_ATTR_BRUSH_CHAR;
}
//#111173# the destination item is missing when the parent style has been changed //#111173# the destination item is missing when the parent style has been changed
if(USHRT_MAX == nDestValue && (m_pParaLBox->IsVisible()||m_pTblLBox->IsVisible())) if(USHRT_MAX == nDestValue && (m_pParaLBox->IsVisible()||m_pTblLBox->IsVisible()))
nDestValue = 0; nDestValue = 0;
...@@ -624,7 +630,7 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) ...@@ -624,7 +630,7 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet )
TblDestinationHdl_Impl(m_pTblLBox); TblDestinationHdl_Impl(m_pTblLBox);
m_pTblLBox->SaveValue(); m_pTblLBox->SaveValue();
} }
else else if (m_pParaLBox->GetData() == m_pParaLBox)
{ {
sal_Int32 nValue = m_pParaLBox->GetSelectEntryPos(); sal_Int32 nValue = m_pParaLBox->GetSelectEntryPos();
...@@ -659,6 +665,15 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) ...@@ -659,6 +665,15 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet )
ParaDestinationHdl_Impl(m_pParaLBox); ParaDestinationHdl_Impl(m_pParaLBox);
m_pParaLBox->SaveValue(); m_pParaLBox->SaveValue();
} }
else if( bHighlighting )
{
nWhich = GetWhich( SID_ATTR_BRUSH_CHAR );
if ( rSet->GetItemState( nWhich, false ) >= SfxItemState::DEFAULT )
{
pBgdAttr = static_cast<const SvxBrushItem*>(&( rSet->Get( nWhich ) ));
pHighlighting.reset(new SvxBrushItem(*pBgdAttr));
}
}
} }
} }
...@@ -770,6 +785,10 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet ) ...@@ -770,6 +785,10 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
break; break;
} }
} }
else if( bHighlighting )
{
nSlot = SID_ATTR_BRUSH_CHAR;
}
sal_uInt16 nWhich = GetWhich( nSlot ); sal_uInt16 nWhich = GetWhich( nSlot );
const SfxPoolItem* pOld = GetOldItem( *rCoreSet, nSlot ); const SfxPoolItem* pOld = GetOldItem( *rCoreSet, nSlot );
...@@ -974,6 +993,20 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet ) ...@@ -974,6 +993,20 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
bModified |= true; bModified |= true;
} }
} }
else if( bHighlighting )
{
if( nSlot != SID_ATTR_BRUSH_CHAR )
{
const SfxPoolItem* pOldChar =
GetOldItem( *rCoreSet, SID_ATTR_BRUSH_CHAR );
if ( pOldChar && pHighlighting &&
(*pHighlighting != *pOldChar || *pHighlighting != SvxBrushItem(SID_ATTR_BRUSH_CHAR)))
{
rCoreSet->Put( *pHighlighting );
bModified |= true;
}
}
}
return bModified; return bModified;
} }
...@@ -1789,6 +1822,7 @@ void SvxBackgroundTabPage::PageCreated(const SfxAllItemSet& aSet) ...@@ -1789,6 +1822,7 @@ void SvxBackgroundTabPage::PageCreated(const SfxAllItemSet& aSet)
if ( nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING ) if ( nFlags & SvxBackgroundTabFlags::SHOW_HIGHLIGHTING )
{ {
m_pBackGroundColorLabelFT->SetText(CUI_RES(RID_SVXSTR_CHARNAME_HIGHLIGHTING)); m_pBackGroundColorLabelFT->SetText(CUI_RES(RID_SVXSTR_CHARNAME_HIGHLIGHTING));
bHighlighting = true;
} }
} }
} }
......
...@@ -127,28 +127,15 @@ void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode) ...@@ -127,28 +127,15 @@ void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode)
{ {
// Always use the visible background // Always use the visible background
const SfxPoolItem *pTmpBrush; const SfxPoolItem *pTmpBrush;
bool bUseHighlight = false;
if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_HIGHLIGHT, true, &pTmpBrush ) ) if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_HIGHLIGHT, true, &pTmpBrush ) )
{ {
SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpBrush) ); SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpBrush) );
if( aTmpBrush.GetColor() != COL_TRANSPARENT ) if( aTmpBrush.GetColor() != COL_TRANSPARENT )
{ {
aTmpBrush.SetWhich( RES_BACKGROUND ); aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
rSet.Put( aTmpBrush ); rSet.Put( aTmpBrush );
bUseHighlight = true;
} }
} }
if( !bUseHighlight )
{
if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_BACKGROUND, true, &pTmpBrush ) )
{
SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpBrush) );
aTmpBrush.SetWhich( RES_BACKGROUND );
rSet.Put( aTmpBrush );
}
else
rSet.ClearItem(RES_BACKGROUND);
}
} }
if( nMode == CONV_ATTR_STD ) if( nMode == CONV_ATTR_STD )
...@@ -181,12 +168,8 @@ void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, const sa ...@@ -181,12 +168,8 @@ void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, const sa
// Background / highlighting // Background / highlighting
{ {
const SfxPoolItem *pTmpItem; const SfxPoolItem *pTmpItem;
if( SfxItemState::SET == rSet.GetItemState( RES_BACKGROUND, false, &pTmpItem ) ) if( SfxItemState::SET == rSet.GetItemState( RES_CHRATR_BACKGROUND, false, &pTmpItem ) )
{ {
SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpItem) );
aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
rSet.Put( aTmpBrush );
// Highlight is an MS specific thing, so remove it at the first time when LO modifies // Highlight is an MS specific thing, so remove it at the first time when LO modifies
// this part of the imported document. // this part of the imported document.
rSet.Put( SvxBrushItem(RES_CHRATR_HIGHLIGHT) ); rSet.Put( SvxBrushItem(RES_CHRATR_HIGHLIGHT) );
......
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