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