/* -*- 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 .
*/
OUString SvxPosSizeStatusBarControl::GetMetricStr_Impl( tools::Long nVal ) const
{ // deliver and set the Metric of the application
FieldUnit eOutUnit = SfxModule::GetModuleFieldUnit( getFrameInterface() );
sal_uInt32 FunctionPopup_Impl::GetSelected(std::u16string_view curident) const
{
sal_uInt32 nSelected = m_nSelected;
sal_uInt16 nCurItemId = id_to_function(curident); if ( nCurItemId == PSZ_FUNC_NONE )
nSelected = ( 1 << PSZ_FUNC_NONE ); else
{
nSelected &= (~( 1u << PSZ_FUNC_NONE )); // Clear the "None" bit
nSelected ^= ( 1u << nCurItemId ); // Toggle the bit corresponding to nCurItemId if ( !nSelected )
nSelected = ( 1u << PSZ_FUNC_NONE );
} return nSelected;
}
struct SvxPosSizeStatusBarControl_Impl
/* [Description]
This implementation-structure of the class SvxPosSizeStatusBarControl is done for the un-linking of the changes of the exported interface such as the toning down of symbols that are visible externally.
One instance exists for each SvxPosSizeStatusBarControl-instance during its life time
*/
{
Point aPos; // valid when a position is shown
Size aSize; // valid when a size is shown
OUString aStr; // valid when a text is shown bool bPos; // show position ? bool bSize; // set size ? bool bTable; // set table index ? bool bHasMenu; // set StarCalc popup menu ?
sal_uInt32 nFunctionSet; // the selected StarCalc functions encoded in 32 bits
Image aPosImage; // Image to show the position
Image aSizeImage; // Image to show the size
};
/* [Description]
Ctor(): Create an instance of the implementation class, load the images for the position and size
*/
SID_PSZ_FUNCTION activates the popup menu for Calc:
Status overview Depending on the type of the item, a special setting is enabled, the others disabled.
NULL/Void SfxPointItem SvxSizeItem SfxStringItem ------------------------------------------------------------------------ Position sal_False FALSE Size FALSE TRUE FALSE Text sal_False sal_False TRUE
*/
void SvxPosSizeStatusBarControl::StateChangedAtStatusBarControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
{ // Because the combi-controller, always sets the current Id as HelpId // first clean the cached HelpText
GetStatusBar().SetHelpText( GetId(), u""_ustr );
void SvxPosSizeStatusBarControl::ImplUpdateItemText()
{ // set only strings as text at the statusBar, so that the Help-Tips // can work with the text, when it is too long for the statusBar
OUString aText; int nCharsWidth = -1; if ( pImpl->bPos || pImpl->bSize )
{
aText = GetMetricStr_Impl( pImpl->aPos.X()) + " / " +
GetMetricStr_Impl( pImpl->aPos.Y()); // widest X/Y string looks like "-999,99"
nCharsWidth = 1 + 6 + 3 + 6; // icon + x + slash + y if ( pImpl->bSize )
{
aText += " " + GetMetricStr_Impl( pImpl->aSize.Width() ) + " x " +
GetMetricStr_Impl( pImpl->aSize.Height() );
nCharsWidth += 1 + 1 + 4 + 3 + 4; // icon + space + w + x + h
}
} elseif ( pImpl->bTable )
aText = pImpl->aStr;
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.