tdf#86612: statusbar: hide some elements if width is not sufficient
new statusbar element property mandatory=true/false to determine if this element can be hidden if total statusbar width is not enough to fit all elements. marked some calc and draw statusbar elements as not mandatory. Change-Id: I20e26d3c4bd865e94ea48632a1e97d55f3fa712f Reviewed-on: https://gerrit.libreoffice.org/56443 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
This commit is contained in:
parent
f4c73f90da
commit
d77f8eef16
@ -33,6 +33,7 @@
|
|||||||
statusbar:align %alignment; "center"
|
statusbar:align %alignment; "center"
|
||||||
statusbar:style %style; "in"
|
statusbar:style %style; "in"
|
||||||
statusbar:autosize %boolean; "false"
|
statusbar:autosize %boolean; "false"
|
||||||
|
statusbar:mandatory %boolean; "true"
|
||||||
statusbar:ownerdraw %boolean; "false"
|
statusbar:ownerdraw %boolean; "false"
|
||||||
statusbar:width %numeric; "0"
|
statusbar:width %numeric; "0"
|
||||||
statusbar:offset %numeric; "5"
|
statusbar:offset %numeric; "5"
|
||||||
|
@ -53,6 +53,7 @@ class FWE_DLLPUBLIC OReadStatusBarDocumentHandler : public OReadStatusBarDocumen
|
|||||||
SB_ATTRIBUTE_WIDTH,
|
SB_ATTRIBUTE_WIDTH,
|
||||||
SB_ATTRIBUTE_OFFSET,
|
SB_ATTRIBUTE_OFFSET,
|
||||||
SB_ATTRIBUTE_HELPURL,
|
SB_ATTRIBUTE_HELPURL,
|
||||||
|
SB_ATTRIBUTE_MANDATORY,
|
||||||
SB_XML_ENTRY_COUNT
|
SB_XML_ENTRY_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,7 +71,8 @@ using namespace ::com::sun::star;
|
|||||||
#define INDEX_ALIGN 8
|
#define INDEX_ALIGN 8
|
||||||
#define INDEX_AUTOSIZE 9
|
#define INDEX_AUTOSIZE 9
|
||||||
#define INDEX_OWNERDRAW 10
|
#define INDEX_OWNERDRAW 10
|
||||||
#define PROPERTYCOUNT_INDEX 11
|
#define INDEX_MANDATORY 11
|
||||||
|
#define PROPERTYCOUNT_INDEX 12
|
||||||
|
|
||||||
// The following order is mandatory. Please add properties at the end!
|
// The following order is mandatory. Please add properties at the end!
|
||||||
#define PROPERTYCOUNT_MENUITEM 6
|
#define PROPERTYCOUNT_MENUITEM 6
|
||||||
@ -100,14 +101,15 @@ using namespace ::com::sun::star;
|
|||||||
#define OFFSET_TOOLBARITEM_WIDTH 6
|
#define OFFSET_TOOLBARITEM_WIDTH 6
|
||||||
|
|
||||||
// The following order is mandatory. Please add properties at the end!
|
// The following order is mandatory. Please add properties at the end!
|
||||||
#define PROPERTYCOUNT_STATUSBARITEM 7
|
#define PROPERTYCOUNT_STATUSBARITEM 8
|
||||||
#define OFFSET_STATUSBARITEM_URL 0
|
#define OFFSET_STATUSBARITEM_URL 0
|
||||||
#define OFFSET_STATUSBARITEM_TITLE 1
|
#define OFFSET_STATUSBARITEM_TITLE 1
|
||||||
#define OFFSET_STATUSBARITEM_CONTEXT 2
|
#define OFFSET_STATUSBARITEM_CONTEXT 2
|
||||||
#define OFFSET_STATUSBARITEM_ALIGN 3
|
#define OFFSET_STATUSBARITEM_ALIGN 3
|
||||||
#define OFFSET_STATUSBARITEM_AUTOSIZE 4
|
#define OFFSET_STATUSBARITEM_AUTOSIZE 4
|
||||||
#define OFFSET_STATUSBARITEM_OWNERDRAW 5
|
#define OFFSET_STATUSBARITEM_OWNERDRAW 5
|
||||||
#define OFFSET_STATUSBARITEM_WIDTH 6
|
#define OFFSET_STATUSBARITEM_MANDATORY 6
|
||||||
|
#define OFFSET_STATUSBARITEM_WIDTH 7
|
||||||
|
|
||||||
// The following order is mandatory. Please add properties at the end!
|
// The following order is mandatory. Please add properties at the end!
|
||||||
#define PROPERTYCOUNT_IMAGES 8
|
#define PROPERTYCOUNT_IMAGES 8
|
||||||
@ -331,6 +333,7 @@ AddonsOptions_Impl::AddonsOptions_Impl()
|
|||||||
m_aPropNames[ INDEX_ALIGN ] = "Alignment";
|
m_aPropNames[ INDEX_ALIGN ] = "Alignment";
|
||||||
m_aPropNames[ INDEX_AUTOSIZE ] = "AutoSize";
|
m_aPropNames[ INDEX_AUTOSIZE ] = "AutoSize";
|
||||||
m_aPropNames[ INDEX_OWNERDRAW ] = "OwnerDraw";
|
m_aPropNames[ INDEX_OWNERDRAW ] = "OwnerDraw";
|
||||||
|
m_aPropNames[ INDEX_MANDATORY ] = "Mandatory";
|
||||||
|
|
||||||
// initialize array with fixed images property names
|
// initialize array with fixed images property names
|
||||||
m_aPropImagesNames[ OFFSET_IMAGES_SMALL ] = "ImageSmall";
|
m_aPropImagesNames[ OFFSET_IMAGES_SMALL ] = "ImageSmall";
|
||||||
@ -1001,6 +1004,7 @@ bool AddonsOptions_Impl::ReadMergeStatusbarData(
|
|||||||
aStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Name = m_aPropNames[ INDEX_ALIGN ];
|
aStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Name = m_aPropNames[ INDEX_ALIGN ];
|
||||||
aStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Name = m_aPropNames[ INDEX_AUTOSIZE ];
|
aStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Name = m_aPropNames[ INDEX_AUTOSIZE ];
|
||||||
aStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Name = m_aPropNames[ INDEX_OWNERDRAW ];
|
aStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Name = m_aPropNames[ INDEX_OWNERDRAW ];
|
||||||
|
aStatusbarItem[ OFFSET_STATUSBARITEM_MANDATORY ].Name = m_aPropNames[ INDEX_MANDATORY ];
|
||||||
aStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH ].Name = m_aPropNames[ INDEX_WIDTH ];
|
aStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH ].Name = m_aPropNames[ INDEX_WIDTH ];
|
||||||
|
|
||||||
sal_uInt32 nCount = aAddonStatusbarItemSetNodeSeq.getLength();
|
sal_uInt32 nCount = aAddonStatusbarItemSetNodeSeq.getLength();
|
||||||
@ -1039,6 +1043,7 @@ bool AddonsOptions_Impl::ReadStatusBarItem(
|
|||||||
aStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_ALIGN ];
|
aStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_ALIGN ];
|
||||||
aStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_AUTOSIZE ];
|
aStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_AUTOSIZE ];
|
||||||
aStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_OWNERDRAW ];
|
aStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_OWNERDRAW ];
|
||||||
|
aStatusbarItem[ OFFSET_STATUSBARITEM_MANDATORY ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_MANDATORY ];
|
||||||
|
|
||||||
// Configuration uses hyper for long. Therefore transform into sal_Int32
|
// Configuration uses hyper for long. Therefore transform into sal_Int32
|
||||||
sal_Int64 nValue( 0 );
|
sal_Int64 nValue( 0 );
|
||||||
@ -1448,7 +1453,8 @@ Sequence< ::rtl::OUString > AddonsOptions_Impl::GetPropertyNamesStatusbarItem(
|
|||||||
lResult[3] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_ALIGN ] );
|
lResult[3] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_ALIGN ] );
|
||||||
lResult[4] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_AUTOSIZE ] );
|
lResult[4] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_AUTOSIZE ] );
|
||||||
lResult[5] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_OWNERDRAW ] );
|
lResult[5] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_OWNERDRAW ] );
|
||||||
lResult[6] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ] );
|
lResult[6] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_MANDATORY ] );
|
||||||
|
lResult[7] = ::rtl::OUString( aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ] );
|
||||||
|
|
||||||
return lResult;
|
return lResult;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ using namespace ::com::sun::star::container;
|
|||||||
#define ATTRIBUTE_AUTOSIZE "autosize"
|
#define ATTRIBUTE_AUTOSIZE "autosize"
|
||||||
#define ATTRIBUTE_OWNERDRAW "ownerdraw"
|
#define ATTRIBUTE_OWNERDRAW "ownerdraw"
|
||||||
#define ATTRIBUTE_HELPURL "helpid"
|
#define ATTRIBUTE_HELPURL "helpid"
|
||||||
|
#define ATTRIBUTE_MANDATORY "mandatory"
|
||||||
|
|
||||||
#define ELEMENT_NS_STATUSBAR "statusbar:statusbar"
|
#define ELEMENT_NS_STATUSBAR "statusbar:statusbar"
|
||||||
#define ELEMENT_NS_STATUSBARITEM "statusbar:statusbaritem"
|
#define ELEMENT_NS_STATUSBARITEM "statusbar:statusbaritem"
|
||||||
@ -140,7 +141,8 @@ StatusBarEntryProperty const StatusBarEntries[OReadStatusBarDocumentHandler::SB_
|
|||||||
{ OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_OWNERDRAW },
|
{ OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_OWNERDRAW },
|
||||||
{ OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_WIDTH },
|
{ OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_WIDTH },
|
||||||
{ OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_OFFSET },
|
{ OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_OFFSET },
|
||||||
{ OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_HELPURL }
|
{ OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_HELPURL },
|
||||||
|
{ OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ATTRIBUTE_MANDATORY }
|
||||||
};
|
};
|
||||||
|
|
||||||
OReadStatusBarDocumentHandler::OReadStatusBarDocumentHandler(
|
OReadStatusBarDocumentHandler::OReadStatusBarDocumentHandler(
|
||||||
@ -232,7 +234,7 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement(
|
|||||||
|
|
||||||
OUString aCommandURL;
|
OUString aCommandURL;
|
||||||
OUString aHelpURL;
|
OUString aHelpURL;
|
||||||
sal_Int16 nItemBits( ItemStyle::ALIGN_CENTER|ItemStyle::DRAW_IN3D );
|
sal_Int16 nItemBits( ItemStyle::ALIGN_CENTER|ItemStyle::DRAW_IN3D|ItemStyle::MANDATORY );
|
||||||
sal_Int16 nWidth( 0 );
|
sal_Int16 nWidth( 0 );
|
||||||
sal_Int16 nOffset( STATUSBAR_OFFSET );
|
sal_Int16 nOffset( STATUSBAR_OFFSET );
|
||||||
bool bCommandURL( false );
|
bool bCommandURL( false );
|
||||||
@ -350,6 +352,21 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SB_ATTRIBUTE_MANDATORY:
|
||||||
|
{
|
||||||
|
if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
|
||||||
|
nItemBits |= ItemStyle::MANDATORY;
|
||||||
|
else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
|
||||||
|
nItemBits &= ~ItemStyle::MANDATORY;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OUString aErrorMessage = getErrorLineString();
|
||||||
|
aErrorMessage += "Attribute statusbar:mandatory must have value 'true' or 'false'!";
|
||||||
|
throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -631,6 +648,14 @@ void OWriteStatusBarDocumentHandler::WriteStatusBarItem(
|
|||||||
OUString::number( nOffset ) );
|
OUString::number( nOffset ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mandatory (default sal_True)
|
||||||
|
if ( !( nStyle & ItemStyle::MANDATORY ) )
|
||||||
|
{
|
||||||
|
pList->AddAttribute( m_aXMLStatusBarNS + ATTRIBUTE_MANDATORY,
|
||||||
|
m_aAttributeType,
|
||||||
|
ATTRIBUTE_BOOLEAN_FALSE );
|
||||||
|
}
|
||||||
|
|
||||||
m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
|
m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
|
||||||
m_xWriteDocumentHandler->startElement( ELEMENT_NS_STATUSBARITEM, xList );
|
m_xWriteDocumentHandler->startElement( ELEMENT_NS_STATUSBARITEM, xList );
|
||||||
m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
|
m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
|
||||||
|
@ -113,6 +113,9 @@ StatusBarItemBits impl_convertItemStyleToItemBits( sal_Int16 nStyle )
|
|||||||
if ( nStyle & css::ui::ItemStyle::OWNER_DRAW )
|
if ( nStyle & css::ui::ItemStyle::OWNER_DRAW )
|
||||||
nItemBits |= StatusBarItemBits::UserDraw;
|
nItemBits |= StatusBarItemBits::UserDraw;
|
||||||
|
|
||||||
|
if ( nStyle & css::ui::ItemStyle::MANDATORY )
|
||||||
|
nItemBits |= StatusBarItemBits::Mandatory;
|
||||||
|
|
||||||
return nItemBits;
|
return nItemBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ void lcl_ConvertSequenceToValues(
|
|||||||
OUString sAlignment;
|
OUString sAlignment;
|
||||||
bool bAutoSize = false;
|
bool bAutoSize = false;
|
||||||
bool bOwnerDraw = false;
|
bool bOwnerDraw = false;
|
||||||
|
bool bMandatory = true;
|
||||||
|
|
||||||
PropertyValue aPropVal;
|
PropertyValue aPropVal;
|
||||||
for ( sal_Int32 i = 0; i < rSequence.getLength(); i++ )
|
for ( sal_Int32 i = 0; i < rSequence.getLength(); i++ )
|
||||||
@ -55,6 +56,8 @@ void lcl_ConvertSequenceToValues(
|
|||||||
aPropVal.Value >>= bAutoSize;
|
aPropVal.Value >>= bAutoSize;
|
||||||
else if ( aPropVal.Name == "OwnerDraw" )
|
else if ( aPropVal.Name == "OwnerDraw" )
|
||||||
aPropVal.Value >>= bOwnerDraw;
|
aPropVal.Value >>= bOwnerDraw;
|
||||||
|
else if ( aPropVal.Name == "Mandatory" )
|
||||||
|
aPropVal.Value >>= bMandatory;
|
||||||
else if ( aPropVal.Name == "Width" )
|
else if ( aPropVal.Name == "Width" )
|
||||||
{
|
{
|
||||||
sal_Int32 aWidth = 0;
|
sal_Int32 aWidth = 0;
|
||||||
@ -68,6 +71,8 @@ void lcl_ConvertSequenceToValues(
|
|||||||
nItemBits |= StatusBarItemBits::AutoSize;
|
nItemBits |= StatusBarItemBits::AutoSize;
|
||||||
if ( bOwnerDraw )
|
if ( bOwnerDraw )
|
||||||
nItemBits |= StatusBarItemBits::UserDraw;
|
nItemBits |= StatusBarItemBits::UserDraw;
|
||||||
|
if ( bMandatory )
|
||||||
|
nItemBits |= StatusBarItemBits::Mandatory;
|
||||||
if ( sAlignment == "center" )
|
if ( sAlignment == "center" )
|
||||||
nItemBits |= StatusBarItemBits::Center;
|
nItemBits |= StatusBarItemBits::Center;
|
||||||
else if ( sAlignment == "right" )
|
else if ( sAlignment == "right" )
|
||||||
|
@ -45,10 +45,11 @@ enum class StatusBarItemBits {
|
|||||||
Flat = 0x0020,
|
Flat = 0x0020,
|
||||||
AutoSize = 0x0040,
|
AutoSize = 0x0040,
|
||||||
UserDraw = 0x0080,
|
UserDraw = 0x0080,
|
||||||
|
Mandatory = 0x0100,
|
||||||
};
|
};
|
||||||
namespace o3tl
|
namespace o3tl
|
||||||
{
|
{
|
||||||
template<> struct typed_flags<StatusBarItemBits> : is_typed_flags<StatusBarItemBits, 0x00ff> {};
|
template<> struct typed_flags<StatusBarItemBits> : is_typed_flags<StatusBarItemBits, 0x01ff> {};
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STATUSBAR_APPEND (sal_uInt16(0xFFFF))
|
#define STATUSBAR_APPEND (sal_uInt16(0xFFFF))
|
||||||
|
@ -149,6 +149,13 @@ constants ItemStyle
|
|||||||
icon+text)</p>
|
icon+text)</p>
|
||||||
*/
|
*/
|
||||||
const short TEXT = 2048;
|
const short TEXT = 2048;
|
||||||
|
|
||||||
|
/** marks always visible element which can not be removed when statusbar
|
||||||
|
width is not sufficient.
|
||||||
|
|
||||||
|
@since LibreOffice 6.2
|
||||||
|
*/
|
||||||
|
const short MANDATORY = 4096;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; }; }; };
|
}; }; }; };
|
||||||
|
@ -64,6 +64,7 @@ interface XStatusbarItem
|
|||||||
</li>
|
</li>
|
||||||
<li>com::sun::star::ui::ItemStyle::AUTO_SIZE</li>
|
<li>com::sun::star::ui::ItemStyle::AUTO_SIZE</li>
|
||||||
<li>com::sun::star::ui::ItemStyle::OWNER_DRAW</li>
|
<li>com::sun::star::ui::ItemStyle::OWNER_DRAW</li>
|
||||||
|
<li>com::sun::star::ui::ItemStyle::MANDATORY (@since LibreOffice 6.2)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@see com::sun::star::ui::ItemStyle
|
@see com::sun::star::ui::ItemStyle
|
||||||
|
@ -282,6 +282,12 @@
|
|||||||
</info>
|
</info>
|
||||||
<value>false</value>
|
<value>false</value>
|
||||||
</prop>
|
</prop>
|
||||||
|
<prop oor:name="Mandatory" oor:type="xs:boolean">
|
||||||
|
<info>
|
||||||
|
<desc>Specifies whether the element can be hidden (false) or not (true) if status bar width is not sufficient to fit all elements.</desc>
|
||||||
|
</info>
|
||||||
|
<value>true</value>
|
||||||
|
</prop>
|
||||||
<prop oor:name="Width" oor:type="xs:long">
|
<prop oor:name="Width" oor:type="xs:long">
|
||||||
<info>
|
<info>
|
||||||
<desc>A property to define the size of a status bar item.</desc>
|
<desc>A property to define the size of a status bar item.</desc>
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
-->
|
-->
|
||||||
<statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink">
|
<statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
<statusbar:statusbaritem xlink:href=".uno:StatusDocPos" statusbar:align="left" statusbar:autosize="true" statusbar:width="58"/>
|
<statusbar:statusbaritem xlink:href=".uno:StatusDocPos" statusbar:align="left" statusbar:autosize="true" statusbar:width="58"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:RowColSelCount" statusbar:align="left" statusbar:autosize="true" statusbar:width="58"/>
|
<statusbar:statusbaritem xlink:href=".uno:RowColSelCount" statusbar:align="left" statusbar:autosize="true" statusbar:mandatory="false" statusbar:width="58"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:StatusPageStyle" statusbar:align="left" statusbar:autosize="true" statusbar:width="83"/>
|
<statusbar:statusbaritem xlink:href=".uno:StatusPageStyle" statusbar:align="left" statusbar:autosize="true" statusbar:width="83"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:LanguageStatus" statusbar:align="center" statusbar:autosize="true" statusbar:width="100"/>
|
<statusbar:statusbaritem xlink:href=".uno:LanguageStatus" statusbar:align="center" statusbar:autosize="true" statusbar:width="100"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:InsertMode" statusbar:align="center" statusbar:width="55"/>
|
<statusbar:statusbaritem xlink:href=".uno:InsertMode" statusbar:align="center" statusbar:mandatory="false" statusbar:width="55"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:StatusSelectionMode" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
|
<statusbar:statusbaritem xlink:href=".uno:StatusSelectionMode" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
|
<statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
|
<statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:autosize="true" statusbar:ownerdraw="true" statusbar:width="200"/>
|
<statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:autosize="true" statusbar:mandatory="false" statusbar:ownerdraw="true" statusbar:width="200"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130"/>
|
<statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="35"/>
|
<statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="35"/>
|
||||||
</statusbar:statusbar>
|
</statusbar:statusbar>
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
-->
|
-->
|
||||||
<statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink">
|
<statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
<statusbar:statusbaritem xlink:href=".uno:PageStatus" statusbar:align="left" statusbar:width="124"/>
|
<statusbar:statusbaritem xlink:href=".uno:PageStatus" statusbar:align="left" statusbar:width="124"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:Context" statusbar:align="left" statusbar:autosize="true" statusbar:width="184"/>
|
<statusbar:statusbaritem xlink:href=".uno:Context" statusbar:align="left" statusbar:autosize="true" statusbar:mandatory="false" statusbar:width="184"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:LayoutStatus" statusbar:align="left" statusbar:autosize="true" statusbar:width="54"/>
|
<statusbar:statusbaritem xlink:href=".uno:LayoutStatus" statusbar:align="left" statusbar:autosize="true" statusbar:mandatory="false" statusbar:width="54"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="400"/>
|
<statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:ownerdraw="true" statusbar:autosize="true" statusbar:width="200"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="9"/>
|
<statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="9"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
|
<statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
|
||||||
<statusbar:statusbaritem xlink:href=".uno:ZoomPage" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="9"/>
|
<statusbar:statusbaritem xlink:href=".uno:ZoomPage" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="9"/>
|
||||||
|
@ -217,22 +217,58 @@ void StatusBar::ImplFormat()
|
|||||||
long nExtraWidth;
|
long nExtraWidth;
|
||||||
long nExtraWidth2;
|
long nExtraWidth2;
|
||||||
long nX;
|
long nX;
|
||||||
sal_uInt16 nAutoSizeItems = 0;
|
sal_uInt16 nAutoSizeItems;
|
||||||
|
bool bChanged;
|
||||||
|
|
||||||
// sum up widths
|
do {
|
||||||
mnItemsWidth = STATUSBAR_OFFSET_X;
|
// sum up widths
|
||||||
long nOffset = 0;
|
nAutoSizeItems = 0;
|
||||||
for (auto & pItem : mvItemList) {
|
mnItemsWidth = STATUSBAR_OFFSET_X;
|
||||||
if ( pItem->mbVisible )
|
bChanged = false;
|
||||||
{
|
long nOffset = 0;
|
||||||
if ( pItem->mnBits & StatusBarItemBits::AutoSize ) {
|
for ( const auto & pItem : mvItemList ) {
|
||||||
nAutoSizeItems++;
|
if ( pItem->mbVisible )
|
||||||
|
{
|
||||||
|
if ( pItem->mnBits & StatusBarItemBits::AutoSize ) {
|
||||||
|
nAutoSizeItems++;
|
||||||
|
}
|
||||||
|
|
||||||
|
mnItemsWidth += pItem->mnWidth + nOffset;
|
||||||
|
nOffset = pItem->mnOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
mnItemsWidth += pItem->mnWidth + nOffset;
|
|
||||||
nOffset = pItem->mnOffset;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if ( mnDX > 0 && mnDX < mnItemsWidth )
|
||||||
|
{
|
||||||
|
// Total width of items is more than available width
|
||||||
|
// Try to hide secondary elements, if any
|
||||||
|
for ( auto & pItem : mvItemList )
|
||||||
|
{
|
||||||
|
if ( pItem->mbVisible && !(pItem->mnBits & StatusBarItemBits::Mandatory) )
|
||||||
|
{
|
||||||
|
pItem->mbVisible = false;
|
||||||
|
bChanged = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( mnDX > mnItemsWidth )
|
||||||
|
{
|
||||||
|
// Width of statusbar is sufficient.
|
||||||
|
// Try to restore hidden items, if any
|
||||||
|
for ( auto & pItem : mvItemList )
|
||||||
|
{
|
||||||
|
if ( !pItem->mbVisible &&
|
||||||
|
!(pItem->mnBits & StatusBarItemBits::Mandatory) &&
|
||||||
|
pItem->mnWidth + nOffset + mnItemsWidth < mnDX )
|
||||||
|
{
|
||||||
|
pItem->mbVisible = true;
|
||||||
|
bChanged = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while ( bChanged );
|
||||||
|
|
||||||
if ( GetStyle() & WB_RIGHT )
|
if ( GetStyle() & WB_RIGHT )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user