/* -*- 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 .
*/
/************************************************************************* |* |* reads the passed item set |*
\************************************************************************/
// #103516# Do the setup based on states of hor/ver adjust // Setup center field and FullWidth
SfxItemState eVState = rAttrs->GetItemState( SDRATTR_TEXT_VERTADJUST );
SfxItemState eHState = rAttrs->GetItemState( SDRATTR_TEXT_HORZADJUST );
/************************************************************************* |* |* fills the passed item set with dialog box attributes |*
\************************************************************************/
void SvxTextAttrPage::Construct()
{ switch (m_eObjKind)
{ case SdrObjKind::NONE: // indeterminate, show them all
bFitToSizeEnabled = bContourEnabled = bWordWrapTextEnabled =
bAutoGrowSizeEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = true;
m_xCustomShapeText->show();
m_xDrawingText->show(); break; case SdrObjKind::Text: case SdrObjKind::TitleText: case SdrObjKind::OutlineText: case SdrObjKind::Caption: // contour NOT possible for pure text objects
bContourEnabled = bWordWrapTextEnabled = bAutoGrowSizeEnabled = false;
// adjusting width and height is ONLY possible for pure text objects
bFitToSizeEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = true;
m_xCustomShapeText->hide();
m_xDrawingText->show(); break; case SdrObjKind::CustomShape:
bFitToSizeEnabled = bContourEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = false;
bWordWrapTextEnabled = bAutoGrowSizeEnabled = true;
m_xDrawingText->hide();
m_xCustomShapeText->show(); break; case SdrObjKind::Edge: case SdrObjKind::Line: //contour NOT possible for connector and line objects
bContourEnabled = false; break; default:
bFitToSizeEnabled = bContourEnabled = true;
bWordWrapTextEnabled = bAutoGrowSizeEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = false;
m_xCustomShapeText->hide();
m_xDrawingText->show(); break;
}
/** Check whether we have to uncheck the "Full width" check box.
*/ void SvxTextAttrPage::PointChanged(weld::DrawingArea*, RectPoint eRP)
{ if (m_xTsbFullWidth->get_state() != TRISTATE_TRUE) return;
// Depending on write direction and currently checked anchor we have // to uncheck the "full width" button. if (IsTextDirectionLeftToRight()) switch( eRP )
{ case RectPoint::LT: case RectPoint::LM: case RectPoint::LB: case RectPoint::RT: case RectPoint::RM: case RectPoint::RB:
m_xTsbFullWidth->set_state( TRISTATE_FALSE ); break; default: ;//prevent warning
} else switch (eRP)
{ case RectPoint::LT: case RectPoint::MT: case RectPoint::RT: case RectPoint::LB: case RectPoint::MB: case RectPoint::RB:
m_xTsbFullWidth->set_state( TRISTATE_FALSE ); break; default: ;//prevent warning
}
}
/************************************************************************* |* |* possibly changes the position of the position-control |*
\************************************************************************/
/** When switching the "full width" check button on the text anchor may have to be moved to a valid and adjacent position. This position depends on the current anchor position and the text writing direction.
*/
IMPL_LINK_NOARG(SvxTextAttrPage, ClickFullWidthHdl_Impl, weld::Toggleable&, void)
{ if( m_xTsbFullWidth->get_state() != TRISTATE_TRUE ) return;
if (IsTextDirectionLeftToRight())
{ // Move text anchor to horizontal middle axis. switch( m_aCtlPosition.GetActualRP() )
{ case RectPoint::LT: case RectPoint::RT:
m_aCtlPosition.SetActualRP( RectPoint::MT ); break;
case RectPoint::LM: case RectPoint::RM:
m_aCtlPosition.SetActualRP( RectPoint::MM ); break;
case RectPoint::LB: case RectPoint::RB:
m_aCtlPosition.SetActualRP( RectPoint::MB ); break; default: ;//prevent warning
}
} else
{ // Move text anchor to vertical middle axis. switch( m_aCtlPosition.GetActualRP() )
{ case RectPoint::LT: case RectPoint::LB:
m_aCtlPosition.SetActualRP( RectPoint::LM ); break;
case RectPoint::MT: case RectPoint::MB:
m_aCtlPosition.SetActualRP( RectPoint::MM ); break;
case RectPoint::RT: case RectPoint::RB:
m_aCtlPosition.SetActualRP( RectPoint::RM ); break; default: ;//prevent warning
}
}
}
/************************************************************************* |* |* enables/disables "size at text" or "adjust to frame" |*
\************************************************************************/
// #103516# Do the setup based on states of hor/ver adjust
SfxItemState eVState = rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
SfxItemState eHState = rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); bool bHorAndVer(SfxItemState::INVALID == eVState || SfxItemState::INVALID == eHState);
// #83698# enable/disable text anchoring dependent of contour
m_xFlPosition->set_sensitive(!bContour && !bHorAndVer);
}
bool SvxTextAttrPage::IsTextDirectionLeftToRight() const
{ // Determine the text writing direction with left to right as default. bool bLeftToRightDirection = true;
SfxItemState eState = rOutAttrs.GetItemState(SDRATTR_TEXTDIRECTION);
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.