1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir // include --------------------------------------------------------------- 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <limits.h> 30cdf0e10cSrcweir #include <tools/shl.hxx> 31cdf0e10cSrcweir #include <vcl/status.hxx> 32cdf0e10cSrcweir #include <vcl/menu.hxx> 33cdf0e10cSrcweir #include <vcl/image.hxx> 34cdf0e10cSrcweir #include <svl/stritem.hxx> 35cdf0e10cSrcweir #include <svl/ptitem.hxx> 36cdf0e10cSrcweir #include <svl/itempool.hxx> 37cdf0e10cSrcweir #include <sfx2/app.hxx> 38cdf0e10cSrcweir #include <sfx2/module.hxx> 39cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 40cdf0e10cSrcweir #include <sfx2/objsh.hxx> 41cdf0e10cSrcweir #include <svl/intitem.hxx> 42cdf0e10cSrcweir #define _SVX_PSZCTRL_CXX 43cdf0e10cSrcweir 44cdf0e10cSrcweir #include "svx/pszctrl.hxx" 45cdf0e10cSrcweir 46cdf0e10cSrcweir #define PAINT_OFFSET 5 47cdf0e10cSrcweir 48cdf0e10cSrcweir #include <editeng/sizeitem.hxx> 49cdf0e10cSrcweir #include <svx/dialmgr.hxx> 50cdf0e10cSrcweir #include "svx/dlgutil.hxx" 51cdf0e10cSrcweir #include "stbctrls.h" 52cdf0e10cSrcweir 53cdf0e10cSrcweir #include <svx/dialogs.hrc> 54cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx> 55cdf0e10cSrcweir #ifndef _UNOTOOLS_PROCESSFACTORY_HXX 56cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 57cdf0e10cSrcweir #endif 58cdf0e10cSrcweir 59cdf0e10cSrcweir // ----------------------------------------------------------------------- 60cdf0e10cSrcweir 61cdf0e10cSrcweir /* [Beschreibung] 62cdf0e10cSrcweir 63cdf0e10cSrcweir Funktion, mit der ein metrischer Wert in textueller Darstellung 64cdf0e10cSrcweir umgewandelt wird. 65cdf0e10cSrcweir 66cdf0e10cSrcweir nVal ist hier der metrische Wert in der Einheit eUnit. 67cdf0e10cSrcweir 68cdf0e10cSrcweir [Querverweise] 69cdf0e10cSrcweir 70cdf0e10cSrcweir <SvxPosSizeStatusBarControl::Paint(const UserDrawEvent&)> 71cdf0e10cSrcweir */ 72cdf0e10cSrcweir 73cdf0e10cSrcweir String SvxPosSizeStatusBarControl::GetMetricStr_Impl( long nVal ) 74cdf0e10cSrcweir { 75cdf0e10cSrcweir // Applikations-Metrik besorgen und setzen 76cdf0e10cSrcweir FieldUnit eOutUnit = SfxModule::GetModuleFieldUnit( getFrameInterface() ); 77cdf0e10cSrcweir FieldUnit eInUnit = FUNIT_100TH_MM; 78cdf0e10cSrcweir 79cdf0e10cSrcweir String sMetric; 80cdf0e10cSrcweir const sal_Unicode cSep = Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep().GetChar(0); 81cdf0e10cSrcweir sal_Int64 nConvVal = MetricField::ConvertValue( nVal * 100, 0L, 0, eInUnit, eOutUnit ); 82cdf0e10cSrcweir 83cdf0e10cSrcweir if ( nConvVal < 0 && ( nConvVal / 100 == 0 ) ) 84cdf0e10cSrcweir sMetric += '-'; 85cdf0e10cSrcweir sMetric += String::CreateFromInt64( nConvVal / 100 ); 86cdf0e10cSrcweir 87cdf0e10cSrcweir if( FUNIT_NONE != eOutUnit ) 88cdf0e10cSrcweir { 89cdf0e10cSrcweir sMetric += cSep; 90cdf0e10cSrcweir sal_Int64 nFract = nConvVal % 100; 91cdf0e10cSrcweir 92cdf0e10cSrcweir if ( nFract < 0 ) 93cdf0e10cSrcweir nFract *= -1; 94cdf0e10cSrcweir if ( nFract < 10 ) 95cdf0e10cSrcweir sMetric += '0'; 96cdf0e10cSrcweir sMetric += String::CreateFromInt64( nFract ); 97cdf0e10cSrcweir } 98cdf0e10cSrcweir 99cdf0e10cSrcweir return sMetric; 100cdf0e10cSrcweir } 101cdf0e10cSrcweir 102cdf0e10cSrcweir // ----------------------------------------------------------------------- 103cdf0e10cSrcweir 104cdf0e10cSrcweir SFX_IMPL_STATUSBAR_CONTROL(SvxPosSizeStatusBarControl, SvxSizeItem); 105cdf0e10cSrcweir 106cdf0e10cSrcweir // class FunctionPopup_Impl ---------------------------------------------- 107cdf0e10cSrcweir 108cdf0e10cSrcweir class FunctionPopup_Impl : public PopupMenu 109cdf0e10cSrcweir { 110cdf0e10cSrcweir public: 111cdf0e10cSrcweir FunctionPopup_Impl( sal_uInt16 nCheck ); 112cdf0e10cSrcweir 113cdf0e10cSrcweir sal_uInt16 GetSelected() const { return nSelected; } 114cdf0e10cSrcweir 115cdf0e10cSrcweir private: 116cdf0e10cSrcweir sal_uInt16 nSelected; 117cdf0e10cSrcweir 118cdf0e10cSrcweir virtual void Select(); 119cdf0e10cSrcweir }; 120cdf0e10cSrcweir 121cdf0e10cSrcweir // ----------------------------------------------------------------------- 122cdf0e10cSrcweir 123cdf0e10cSrcweir FunctionPopup_Impl::FunctionPopup_Impl( sal_uInt16 nCheck ) : 124cdf0e10cSrcweir PopupMenu( ResId( RID_SVXMNU_PSZ_FUNC, DIALOG_MGR() ) ), 125cdf0e10cSrcweir nSelected( 0 ) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir if (nCheck) 128cdf0e10cSrcweir CheckItem( nCheck ); 129cdf0e10cSrcweir } 130cdf0e10cSrcweir 131cdf0e10cSrcweir // ----------------------------------------------------------------------- 132cdf0e10cSrcweir 133cdf0e10cSrcweir void FunctionPopup_Impl::Select() 134cdf0e10cSrcweir { 135cdf0e10cSrcweir nSelected = GetCurItemId(); 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir // struct SvxPosSizeStatusBarControl_Impl -------------------------------- 139cdf0e10cSrcweir 140cdf0e10cSrcweir struct SvxPosSizeStatusBarControl_Impl 141cdf0e10cSrcweir 142cdf0e10cSrcweir /* [Beschreibung] 143cdf0e10cSrcweir 144cdf0e10cSrcweir Diese Implementations-Struktur der Klasse SvxPosSizeStatusBarControl 145*07662b26Smseidel dient der Entkopplung von Änderungen vom exportierten Interface sowie 146cdf0e10cSrcweir der Verringerung von extern sichtbaren Symbolen. 147cdf0e10cSrcweir 148*07662b26Smseidel Eine Instanz existiert pro SvxPosSizeStatusBarControl-Instanz 149*07662b26Smseidel für deren Laufzeit. 150cdf0e10cSrcweir */ 151cdf0e10cSrcweir 152cdf0e10cSrcweir { 153*07662b26Smseidel Point aPos; // gültig, wenn eine Position angezeigt wird 154*07662b26Smseidel Size aSize; // gültig, wenn eine Größe angezeigt wird 155*07662b26Smseidel String aStr; // gültig, wenn ein Text angezeigt wird 156*07662b26Smseidel sal_Bool bPos; // show position? 157*07662b26Smseidel sal_Bool bSize; // show size? 158cdf0e10cSrcweir sal_Bool bTable; // Tabellenindex anzeigen? 159*07662b26Smseidel sal_Bool bHasMenu; // Calc Popup-Menü anzeigen? 160*07662b26Smseidel sal_uInt16 nFunction; // selektierte Calc Funktion 161*07662b26Smseidel Image aPosImage; // Image für die Positionsanzeige 162*07662b26Smseidel Image aSizeImage; // Image für die Größenanzeige 163cdf0e10cSrcweir }; 164cdf0e10cSrcweir 165cdf0e10cSrcweir // class SvxPosSizeStatusBarControl ------------------------------------------ 166cdf0e10cSrcweir 167cdf0e10cSrcweir /* [Beschreibung] 168cdf0e10cSrcweir 169cdf0e10cSrcweir Ctor(): 170cdf0e10cSrcweir Anlegen einer Impl-Klassen-Instanz, Default die Zeitanzeige enablen, 171*07662b26Smseidel Images für die Position und Größe laden. 172cdf0e10cSrcweir */ 173cdf0e10cSrcweir 174cdf0e10cSrcweir #define STR_POSITION ".uno:Position" 175cdf0e10cSrcweir #define STR_TABLECELL ".uno:StateTableCell" 176cdf0e10cSrcweir #define STR_FUNC ".uno:StatusBarFunc" 177cdf0e10cSrcweir 178cdf0e10cSrcweir SvxPosSizeStatusBarControl::SvxPosSizeStatusBarControl( sal_uInt16 _nSlotId, 179cdf0e10cSrcweir sal_uInt16 _nId, 180cdf0e10cSrcweir StatusBar& rStb ) : 181cdf0e10cSrcweir SfxStatusBarControl( _nSlotId, _nId, rStb ), 182cdf0e10cSrcweir pImp( new SvxPosSizeStatusBarControl_Impl ) 183cdf0e10cSrcweir { 184cdf0e10cSrcweir pImp->bPos = sal_False; 185cdf0e10cSrcweir pImp->bSize = sal_False; 186cdf0e10cSrcweir pImp->bTable = sal_False; 187cdf0e10cSrcweir pImp->bHasMenu = sal_False; 188cdf0e10cSrcweir pImp->nFunction = 0; 189cdf0e10cSrcweir pImp->aPosImage = Image( ResId( RID_SVXBMP_POSITION, DIALOG_MGR() ) ); 190cdf0e10cSrcweir pImp->aSizeImage = Image( ResId( RID_SVXBMP_SIZE, DIALOG_MGR() ) ); 191cdf0e10cSrcweir 192cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STR_POSITION ))); // SID_ATTR_POSITION 193cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STR_TABLECELL ))); // SID_TABLE_CELL 194cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STR_FUNC ))); // SID_PSZ_FUNCTION 195cdf0e10cSrcweir } 196cdf0e10cSrcweir 197cdf0e10cSrcweir // ----------------------------------------------------------------------- 198cdf0e10cSrcweir 199cdf0e10cSrcweir /* [Beschreibung] 200cdf0e10cSrcweir 201cdf0e10cSrcweir Dtor(): 202*07662b26Smseidel Pointer auf die Impl-Klasse löschen, damit der Timer gestoppt wird. 203cdf0e10cSrcweir */ 204cdf0e10cSrcweir 205cdf0e10cSrcweir SvxPosSizeStatusBarControl::~SvxPosSizeStatusBarControl() 206cdf0e10cSrcweir { 207cdf0e10cSrcweir delete pImp; 208cdf0e10cSrcweir } 209cdf0e10cSrcweir 210cdf0e10cSrcweir // ----------------------------------------------------------------------- 211cdf0e10cSrcweir 212cdf0e10cSrcweir /* [Beschreibung] 213cdf0e10cSrcweir 214*07662b26Smseidel SID_PSZ_FUNCTION aktiviert das Popup-Menü für Calc, ansonsten: 215cdf0e10cSrcweir 216cdf0e10cSrcweir Statusbenachrichtigung; 217cdf0e10cSrcweir Je nach Item-Typ wird eine bestimmte Anzeige enabled, die anderen disabled. 218cdf0e10cSrcweir 219cdf0e10cSrcweir NULL/Void SfxPointItem SvxSizeItem SfxStringItem 220cdf0e10cSrcweir ------------------------------------------------------------------------ 221cdf0e10cSrcweir Zeit sal_True sal_False sal_False FALSE 222cdf0e10cSrcweir Position sal_False FALSE 223*07662b26Smseidel Größe FALSE TRUE FALSE 224cdf0e10cSrcweir Text sal_False sal_False TRUE 225cdf0e10cSrcweir 226cdf0e10cSrcweir Ein anderes Item bewirkt einen Assert, die Zeitanzeige wird enabled. 227cdf0e10cSrcweir */ 228cdf0e10cSrcweir 229cdf0e10cSrcweir void SvxPosSizeStatusBarControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, 230cdf0e10cSrcweir const SfxPoolItem* pState ) 231cdf0e10cSrcweir { 232cdf0e10cSrcweir // da Kombi-Controller, immer die aktuelle Id als HelpId setzen 233*07662b26Smseidel // gecachten HelpText vorher löschen 234cdf0e10cSrcweir GetStatusBar().SetHelpText( GetId(), String() ); 235cdf0e10cSrcweir 236cdf0e10cSrcweir switch ( nSID ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir case SID_ATTR_POSITION : GetStatusBar().SetHelpId( GetId(), STR_POSITION ); break; 239cdf0e10cSrcweir case SID_TABLE_CELL: GetStatusBar().SetHelpId( GetId(), STR_TABLECELL ); break; 240cdf0e10cSrcweir case SID_PSZ_FUNCTION: GetStatusBar().SetHelpId( GetId(), STR_FUNC ); break; 241cdf0e10cSrcweir default: break; 242cdf0e10cSrcweir } 243cdf0e10cSrcweir 244cdf0e10cSrcweir if ( nSID == SID_PSZ_FUNCTION ) 245cdf0e10cSrcweir { 246cdf0e10cSrcweir if ( eState == SFX_ITEM_AVAILABLE ) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir pImp->bHasMenu = sal_True; 249cdf0e10cSrcweir if ( pState && pState->ISA(SfxUInt16Item) ) 250cdf0e10cSrcweir pImp->nFunction = ((const SfxUInt16Item*)pState)->GetValue(); 251cdf0e10cSrcweir } 252cdf0e10cSrcweir else 253cdf0e10cSrcweir pImp->bHasMenu = sal_False; 254cdf0e10cSrcweir } 255cdf0e10cSrcweir else if ( SFX_ITEM_AVAILABLE != eState ) 256cdf0e10cSrcweir { 257cdf0e10cSrcweir // #i34458# don't switch to empty display before an empty state was 258cdf0e10cSrcweir // notified for all display types 259cdf0e10cSrcweir 260cdf0e10cSrcweir if ( nSID == SID_TABLE_CELL ) 261cdf0e10cSrcweir pImp->bTable = sal_False; 262cdf0e10cSrcweir else if ( nSID == SID_ATTR_POSITION ) 263cdf0e10cSrcweir pImp->bPos = sal_False; 264cdf0e10cSrcweir else if ( nSID == GetSlotId() ) // controller is registered for SID_ATTR_SIZE 265cdf0e10cSrcweir pImp->bSize = sal_False; 266cdf0e10cSrcweir else 267cdf0e10cSrcweir { 268cdf0e10cSrcweir DBG_ERRORFILE("unknown slot id"); 269cdf0e10cSrcweir } 270cdf0e10cSrcweir } 271cdf0e10cSrcweir else if ( pState->ISA( SfxPointItem ) ) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir // Position anzeigen 274cdf0e10cSrcweir pImp->aPos = ( (SfxPointItem*)pState )->GetValue(); 275cdf0e10cSrcweir pImp->bPos = sal_True; 276cdf0e10cSrcweir pImp->bTable = sal_False; 277cdf0e10cSrcweir } 278cdf0e10cSrcweir else if ( pState->ISA( SvxSizeItem ) ) 279cdf0e10cSrcweir { 280*07662b26Smseidel // Größe anzeigen 281cdf0e10cSrcweir pImp->aSize = ( (SvxSizeItem*)pState )->GetSize(); 282cdf0e10cSrcweir pImp->bSize = sal_True; 283cdf0e10cSrcweir pImp->bTable = sal_False; 284cdf0e10cSrcweir } 285cdf0e10cSrcweir else if ( pState->ISA( SfxStringItem ) ) 286cdf0e10cSrcweir { 287cdf0e10cSrcweir // String anzeigen (Tabellen-Zelle oder anderes) 288cdf0e10cSrcweir pImp->aStr = ( (SfxStringItem*)pState )->GetValue(); 289cdf0e10cSrcweir pImp->bTable = sal_True; 290cdf0e10cSrcweir pImp->bPos = sal_False; 291cdf0e10cSrcweir pImp->bSize = sal_False; 292cdf0e10cSrcweir } 293cdf0e10cSrcweir else 294cdf0e10cSrcweir { 295cdf0e10cSrcweir DBG_ERRORFILE( "invalid item type" ); 296cdf0e10cSrcweir // trotzdem Datum und Zeit anzeigen 297cdf0e10cSrcweir pImp->bPos = sal_False; 298cdf0e10cSrcweir pImp->bSize = sal_False; 299cdf0e10cSrcweir pImp->bTable = sal_False; 300cdf0e10cSrcweir } 301cdf0e10cSrcweir 302cdf0e10cSrcweir if ( GetStatusBar().AreItemsVisible() ) 303cdf0e10cSrcweir GetStatusBar().SetItemData( GetId(), 0 ); 304cdf0e10cSrcweir 305cdf0e10cSrcweir // nur Strings auch als Text an der StatusBar setzen, damit Tip-Hilfe 306cdf0e10cSrcweir // funktioniert, wenn der Text zu lang ist. 307cdf0e10cSrcweir String aText; 308cdf0e10cSrcweir if ( pImp->bTable ) 309cdf0e10cSrcweir aText = pImp->aStr; 310cdf0e10cSrcweir GetStatusBar().SetItemText( GetId(), aText ); 311cdf0e10cSrcweir } 312cdf0e10cSrcweir 313cdf0e10cSrcweir // ----------------------------------------------------------------------- 314cdf0e10cSrcweir 315cdf0e10cSrcweir /* [Beschreibung] 316cdf0e10cSrcweir 317*07662b26Smseidel Popup-Menü ausführen, wenn per Status enabled 318cdf0e10cSrcweir */ 319cdf0e10cSrcweir 320cdf0e10cSrcweir void SvxPosSizeStatusBarControl::Command( const CommandEvent& rCEvt ) 321cdf0e10cSrcweir { 322cdf0e10cSrcweir if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU && pImp->bHasMenu ) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir sal_uInt16 nSelect = pImp->nFunction; 325cdf0e10cSrcweir if (!nSelect) 326cdf0e10cSrcweir nSelect = PSZ_FUNC_NONE; 327cdf0e10cSrcweir FunctionPopup_Impl aMenu( nSelect ); 328cdf0e10cSrcweir if ( aMenu.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel() ) ) 329cdf0e10cSrcweir { 330cdf0e10cSrcweir nSelect = aMenu.GetSelected(); 331cdf0e10cSrcweir if (nSelect) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir if (nSelect == PSZ_FUNC_NONE) 334cdf0e10cSrcweir nSelect = 0; 335cdf0e10cSrcweir 336cdf0e10cSrcweir ::com::sun::star::uno::Any a; 337cdf0e10cSrcweir SfxUInt16Item aItem( SID_PSZ_FUNCTION, nSelect ); 338cdf0e10cSrcweir 339cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 ); 340cdf0e10cSrcweir aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusBarFunc" )); 341cdf0e10cSrcweir aItem.QueryValue( a ); 342cdf0e10cSrcweir aArgs[0].Value = a; 343cdf0e10cSrcweir 344cdf0e10cSrcweir execute( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StatusBarFunc" )), aArgs ); 345cdf0e10cSrcweir // GetBindings().GetDispatcher()->Execute( SID_PSZ_FUNCTION, SFX_CALLMODE_RECORD, &aItem, 0L ); 346cdf0e10cSrcweir } 347cdf0e10cSrcweir } 348cdf0e10cSrcweir } 349cdf0e10cSrcweir else 350cdf0e10cSrcweir SfxStatusBarControl::Command( rCEvt ); 351cdf0e10cSrcweir } 352cdf0e10cSrcweir 353cdf0e10cSrcweir // ----------------------------------------------------------------------- 354cdf0e10cSrcweir 355cdf0e10cSrcweir /* [Beschreibung] 356cdf0e10cSrcweir 357cdf0e10cSrcweir Je nach enableden Anzeigentyp, wird der Wert angezeigt. Vorher wird 358*07662b26Smseidel das Rectangle übermalt (gelöscht). 359cdf0e10cSrcweir */ 360cdf0e10cSrcweir 361cdf0e10cSrcweir void SvxPosSizeStatusBarControl::Paint( const UserDrawEvent& rUsrEvt ) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir OutputDevice* pDev = rUsrEvt.GetDevice(); 364cdf0e10cSrcweir DBG_ASSERT( pDev, "no OutputDevice on UserDrawEvent" ); 365cdf0e10cSrcweir const Rectangle& rRect = rUsrEvt.GetRect(); 366cdf0e10cSrcweir StatusBar& rBar = GetStatusBar(); 367cdf0e10cSrcweir Point aItemPos = rBar.GetItemTextPos( GetId() ); 368cdf0e10cSrcweir Color aOldLineColor = pDev->GetLineColor(); 369cdf0e10cSrcweir Color aOldFillColor = pDev->GetFillColor(); 370cdf0e10cSrcweir pDev->SetLineColor(); 371cdf0e10cSrcweir pDev->SetFillColor( pDev->GetBackground().GetColor() ); 372cdf0e10cSrcweir 373cdf0e10cSrcweir if ( pImp->bPos || pImp->bSize ) 374cdf0e10cSrcweir { 375*07662b26Smseidel // Position für Size-Anzeige berechnen 376cdf0e10cSrcweir long nSizePosX = 377cdf0e10cSrcweir rRect.Left() + rRect.GetWidth() / 2 + PAINT_OFFSET; 378cdf0e10cSrcweir // Position zeichnen 379cdf0e10cSrcweir Point aPnt = rRect.TopLeft(); 380cdf0e10cSrcweir aPnt.Y() = aItemPos.Y(); 381cdf0e10cSrcweir aPnt.X() += PAINT_OFFSET; 382cdf0e10cSrcweir pDev->DrawImage( aPnt, pImp->aPosImage ); 383cdf0e10cSrcweir aPnt.X() += pImp->aPosImage.GetSizePixel().Width(); 384cdf0e10cSrcweir aPnt.X() += PAINT_OFFSET; 385cdf0e10cSrcweir String aStr = GetMetricStr_Impl( pImp->aPos.X()); 386cdf0e10cSrcweir aStr.AppendAscii(" / "); 387cdf0e10cSrcweir aStr += GetMetricStr_Impl( pImp->aPos.Y()); 388cdf0e10cSrcweir pDev->DrawRect( 389cdf0e10cSrcweir Rectangle( aPnt, Point( nSizePosX, rRect.Bottom() ) ) ); 390cdf0e10cSrcweir pDev->DrawText( aPnt, aStr ); 391cdf0e10cSrcweir 392*07662b26Smseidel // falls verfügbar, Größe zeichnen 393cdf0e10cSrcweir aPnt.X() = nSizePosX; 394cdf0e10cSrcweir 395cdf0e10cSrcweir if ( pImp->bSize ) 396cdf0e10cSrcweir { 397cdf0e10cSrcweir pDev->DrawImage( aPnt, pImp->aSizeImage ); 398cdf0e10cSrcweir aPnt.X() += pImp->aSizeImage.GetSizePixel().Width(); 399cdf0e10cSrcweir Point aDrwPnt = aPnt; 400cdf0e10cSrcweir aPnt.X() += PAINT_OFFSET; 401cdf0e10cSrcweir aStr = GetMetricStr_Impl( pImp->aSize.Width() ); 402cdf0e10cSrcweir aStr.AppendAscii(" x "); 403cdf0e10cSrcweir aStr += GetMetricStr_Impl( pImp->aSize.Height() ); 404cdf0e10cSrcweir pDev->DrawRect( Rectangle( aDrwPnt, rRect.BottomRight() ) ); 405cdf0e10cSrcweir pDev->DrawText( aPnt, aStr ); 406cdf0e10cSrcweir } 407cdf0e10cSrcweir else 408cdf0e10cSrcweir pDev->DrawRect( Rectangle( aPnt, rRect.BottomRight() ) ); 409cdf0e10cSrcweir } 410cdf0e10cSrcweir else if ( pImp->bTable ) 411cdf0e10cSrcweir { 412cdf0e10cSrcweir pDev->DrawRect( rRect ); 413cdf0e10cSrcweir pDev->DrawText( Point( 414cdf0e10cSrcweir rRect.Left() + rRect.GetWidth() / 2 - pDev->GetTextWidth( pImp->aStr ) / 2, 415cdf0e10cSrcweir aItemPos.Y() ), pImp->aStr ); 416cdf0e10cSrcweir } 417cdf0e10cSrcweir else 418cdf0e10cSrcweir { 419cdf0e10cSrcweir // Empty display if neither size nor table position are available. 420cdf0e10cSrcweir // Date/Time are no longer used (#65302#). 421cdf0e10cSrcweir pDev->DrawRect( rRect ); 422cdf0e10cSrcweir } 423cdf0e10cSrcweir 424cdf0e10cSrcweir pDev->SetLineColor( aOldLineColor ); 425cdf0e10cSrcweir pDev->SetFillColor( aOldFillColor ); 426cdf0e10cSrcweir } 427cdf0e10cSrcweir 428cdf0e10cSrcweir // ----------------------------------------------------------------------- 429cdf0e10cSrcweir 430cdf0e10cSrcweir sal_uIntPtr SvxPosSizeStatusBarControl::GetDefItemWidth(const StatusBar& rStb) 431cdf0e10cSrcweir { 432cdf0e10cSrcweir Image aTmpPosImage( ResId( RID_SVXBMP_POSITION, DIALOG_MGR() ) ); 433cdf0e10cSrcweir Image aTmpSizeImage( ResId( RID_SVXBMP_SIZE, DIALOG_MGR() ) ); 434cdf0e10cSrcweir 435cdf0e10cSrcweir sal_uIntPtr nWidth=PAINT_OFFSET+aTmpPosImage.GetSizePixel().Width(); 436cdf0e10cSrcweir nWidth+=PAINT_OFFSET+aTmpSizeImage.GetSizePixel().Width(); 437cdf0e10cSrcweir nWidth+=2*(PAINT_OFFSET+rStb.GetTextWidth(String::CreateFromAscii("XXXX,XX / XXXX,XX"))); 438cdf0e10cSrcweir 439cdf0e10cSrcweir return nWidth; 440cdf0e10cSrcweir } 441cdf0e10cSrcweir 442*07662b26Smseidel /* vim: set noet sw=4 ts=4: */ 443