/* -*- 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 .
*/
if(drawing::FillStyle_NONE == eXFS)
{ // #i96350# // fallback to solid fillmode when no fill mode is provided to have // a reasonable shadow preview. The used color will be a set one or // the default (currently blue8)
eXFS = drawing::FillStyle_SOLID;
}
SfxItemSet rAttribs( rSet ); // rSet contains shadow attributes too, but we want // to use it for updating rectangle attributes only, // so set the shadow to none here
SdrOnOffItem aItem( makeSdrShadowItem( false ));
rAttribs.Put( aItem );
if (m_xTsbShowShadow->get_state_changed_from_saved())
{
TriState eState = m_xTsbShowShadow->get_state();
assert(eState != TRISTATE_INDET); // given how m_xTsbShowShadow is set up and saved in Reset(), // eState == TRISTATE_INDET would imply // !IsValueChangedFromSaved()
SdrOnOffItem aItem( makeSdrShadowItem(eState == TRISTATE_TRUE) );
pOld = GetOldItem( *rAttrs, SDRATTR_SHADOW ); if ( !pOld || !( *static_cast<const SdrOnOffItem*>(pOld) == aItem ) )
{
rAttrs->Put( aItem );
bModified = true;
}
}
// shadow removal // a bit intricate inquiry whether there was something changed, // as the items can't be displayed directly on controls
sal_Int32 nX = 0, nY = 0;
sal_Int32 nXY = GetCoreValue( *m_xMtrDistance, m_ePoolUnit );
switch (m_aCtlPosition.GetActualRP())
{ case RectPoint::LT: nX = nY = -nXY; break; case RectPoint::MT: nY = -nXY; break; case RectPoint::RT: nX = nXY; nY = -nXY; break; case RectPoint::LM: nX = -nXY; break; case RectPoint::RM: nX = nXY; break; case RectPoint::LB: nX = -nXY; nY = nXY; break; case RectPoint::MB: nY = nXY; break; case RectPoint::RB: nX = nY = nXY; break; case RectPoint::MM: break;
}
// If the values of the shadow distances==SfxItemState::INVALID and the displayed // string in the respective MetricField=="", then the comparison of the old // and the new distance values would return a wrong result because in such a // case the new distance values would match the default values of the MetricField !!!! if ( !m_xMtrDistance->get_text().isEmpty() ||
m_rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::INVALID ||
m_rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::INVALID )
{
sal_Int32 nOldX = 9876543; // impossible value, so DontCare
sal_Int32 nOldY = 9876543; if( m_rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::INVALID &&
m_rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::INVALID )
{
nOldX = m_rOutAttrs.Get( SDRATTR_SHADOWXDIST ).GetValue();
nOldY = m_rOutAttrs.Get( SDRATTR_SHADOWYDIST ).GetValue();
}
SdrMetricItem aXItem( makeSdrShadowXDistItem(nX) );
pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWXDIST ); if ( nX != nOldX &&
( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aXItem ) ) )
{
rAttrs->Put( aXItem );
bModified = true;
}
SdrMetricItem aYItem( makeSdrShadowYDistItem(nY) );
pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWYDIST ); if ( nY != nOldY &&
( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aYItem ) ) )
{
rAttrs->Put( aYItem );
bModified = true;
}
}
void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
{ // all objects can have a shadow // at the moment there are only 8 possible positions where a shadow can be set
// has a shadow been set? if( rAttrs->GetItemState( SDRATTR_SHADOW ) != SfxItemState::INVALID )
{ if( rAttrs->Get( SDRATTR_SHADOW ).GetValue() )
m_xTsbShowShadow->set_state(TRISTATE_TRUE); else
{
m_xTsbShowShadow->set_state(TRISTATE_FALSE);
}
} else
m_xTsbShowShadow->set_state(TRISTATE_INDET);
// distance (only 8 possible positions), // so there is only one item evaluated
// setting the shadow control if ( nX < 0 && nY < 0 ) m_aCtlPosition.SetActualRP( RectPoint::LT ); elseif( nX == 0 && nY < 0 ) m_aCtlPosition.SetActualRP( RectPoint::MT ); elseif( nX > 0 && nY < 0 ) m_aCtlPosition.SetActualRP( RectPoint::RT ); elseif( nX < 0 && nY == 0 ) m_aCtlPosition.SetActualRP( RectPoint::LM ); // there's no center point anymore elseif( nX == 0 && nY == 0 ) m_aCtlPosition.SetActualRP( RectPoint::RB ); elseif( nX > 0 && nY == 0 ) m_aCtlPosition.SetActualRP( RectPoint::RM ); elseif( nX < 0 && nY > 0 ) m_aCtlPosition.SetActualRP( RectPoint::LB ); elseif( nX == 0 && nY > 0 ) m_aCtlPosition.SetActualRP( RectPoint::MB ); elseif( nX > 0 && nY > 0 ) m_aCtlPosition.SetActualRP( RectPoint::RB );
} else
{ // determine default-distance
SfxItemPool* pPool = m_rOutAttrs.GetPool();
{
sal_Int32 n = pPool->GetUserOrPoolDefaultItem(SDRATTR_SHADOWXDIST).GetValue(); if (n == 0)
n = pPool->GetUserOrPoolDefaultItem(SDRATTR_SHADOWYDIST).GetValue();
SetMetricValue(*m_xMtrDistance, std::abs(n), m_ePoolUnit);
}
// Tristate, e. g. multiple objects have been marked of which some have a shadow and some don't. // The text (which shall be displayed) of the MetricFields is set to "" and serves as an // identification in the method FillItemSet for the fact that the distance value was NOT changed !!!!
m_xMtrDistance->set_text( u""_ustr );
m_aCtlPosition.SetActualRP( RectPoint::MM );
}
// #66832# This field was not saved, but used to determine changes. // Why? Seems to be the error. // It IS the error.
m_xMtrTransparent->save_value();
if (pColorListItem)
SetColorList(pColorListItem->GetColorList()); if (pPageTypeItem)
SetPageType(static_cast<PageType>(pPageTypeItem->GetValue())); if (pDlgTypeItem)
SetDlgType(pDlgTypeItem->GetValue());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.