Link Here
|
43 |
#include <tools/debug.hxx> |
43 |
#include <tools/debug.hxx> |
44 |
#include <com/sun/star/uno/Any.hxx> |
44 |
#include <com/sun/star/uno/Any.hxx> |
45 |
#include <com/sun/star/uno/Sequence.hxx> |
45 |
#include <com/sun/star/uno/Sequence.hxx> |
|
|
46 |
#include <vcl/svapp.hxx> |
46 |
|
47 |
|
47 |
#include <rtl/logfile.hxx> |
48 |
#include <rtl/logfile.hxx> |
48 |
#include "itemholder1.hxx" |
49 |
#include "itemholder1.hxx" |
Link Here
|
63 |
#define ROOTNODE_MENU OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/View/Menu" )) |
64 |
#define ROOTNODE_MENU OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/View/Menu" )) |
64 |
#define DEFAULT_DONTHIDEDISABLEDENTRIES sal_False |
65 |
#define DEFAULT_DONTHIDEDISABLEDENTRIES sal_False |
65 |
#define DEFAULT_FOLLOWMOUSE sal_True |
66 |
#define DEFAULT_FOLLOWMOUSE sal_True |
66 |
#define DEFAULT_MENUICONS sal_True |
67 |
#define DEFAULT_MENUICONS 2 |
67 |
|
68 |
|
68 |
#define PROPERTYNAME_DONTHIDEDISABLEDENTRIES OUString(RTL_CONSTASCII_USTRINGPARAM("DontHideDisabledEntry" )) |
69 |
#define PROPERTYNAME_DONTHIDEDISABLEDENTRIES OUString(RTL_CONSTASCII_USTRINGPARAM("DontHideDisabledEntry" )) |
69 |
#define PROPERTYNAME_FOLLOWMOUSE OUString(RTL_CONSTASCII_USTRINGPARAM("FollowMouse" )) |
70 |
#define PROPERTYNAME_FOLLOWMOUSE OUString(RTL_CONSTASCII_USTRINGPARAM("FollowMouse" )) |
70 |
#define PROPERTYNAME_SHOWICONSINMENUES OUString(RTL_CONSTASCII_USTRINGPARAM("ShowIconsInMenues" )) |
71 |
#define PROPERTYNAME_SHOWICONSINMENUES OUString(RTL_CONSTASCII_USTRINGPARAM("ShowIconsInMenues" )) |
|
|
72 |
#define PROPERTYNAME_SYSTEMICONSINMENUES OUString(RTL_CONSTASCII_USTRINGPARAM("IsSystemIconsInMenus" )) |
71 |
|
73 |
|
72 |
#define PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES 0 |
74 |
#define PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES 0 |
73 |
#define PROPERTYHANDLE_FOLLOWMOUSE 1 |
75 |
#define PROPERTYHANDLE_FOLLOWMOUSE 1 |
74 |
#define PROPERTYHANDLE_SHOWICONSINMENUES 2 |
76 |
#define PROPERTYHANDLE_SHOWICONSINMENUES 2 |
|
|
77 |
#define PROPERTYHANDLE_SYSTEMICONSINMENUES 3 |
75 |
|
78 |
|
76 |
#define PROPERTYCOUNT 3 |
79 |
#define PROPERTYCOUNT 4 |
77 |
|
80 |
|
78 |
#include <tools/link.hxx> |
81 |
#include <tools/link.hxx> |
79 |
#include <tools/list.hxx> |
82 |
#include <tools/list.hxx> |
Link Here
|
93 |
LinkList aList; |
96 |
LinkList aList; |
94 |
sal_Bool m_bDontHideDisabledEntries ; /// cache "DontHideDisabledEntries" of Menu section |
97 |
sal_Bool m_bDontHideDisabledEntries ; /// cache "DontHideDisabledEntries" of Menu section |
95 |
sal_Bool m_bFollowMouse ; /// cache "FollowMouse" of Menu section |
98 |
sal_Bool m_bFollowMouse ; /// cache "FollowMouse" of Menu section |
96 |
sal_Bool m_bMenuIcons ; /// cache "MenuIcons" of Menu section |
99 |
sal_Int16 m_nMenuIcons ; /// cache "MenuIcons" of Menu section |
97 |
|
100 |
|
98 |
//------------------------------------------------------------------------------------------------------------- |
101 |
//------------------------------------------------------------------------------------------------------------- |
99 |
// public methods |
102 |
// public methods |
Link Here
|
169 |
sal_Bool IsFollowMouseEnabled() const |
172 |
sal_Bool IsFollowMouseEnabled() const |
170 |
{ return m_bFollowMouse; } |
173 |
{ return m_bFollowMouse; } |
171 |
|
174 |
|
172 |
sal_Bool IsMenuIconsEnabled() const |
175 |
sal_Int16 GetMenuIconsState() const |
173 |
{ return m_bMenuIcons; } |
176 |
{ return m_nMenuIcons; } |
174 |
|
177 |
|
175 |
void SetEntryHidingState ( sal_Bool bState ) |
178 |
void SetEntryHidingState ( sal_Bool bState ) |
176 |
{ |
179 |
{ |
Link Here
|
190 |
Commit(); |
193 |
Commit(); |
191 |
} |
194 |
} |
192 |
|
195 |
|
193 |
void SetMenuIconsState ( sal_Bool bState ) |
196 |
void SetMenuIconsState ( sal_Int16 bState ) |
194 |
{ |
197 |
{ |
195 |
m_bMenuIcons = bState; |
198 |
m_nMenuIcons = bState; |
196 |
SetModified(); |
199 |
SetModified(); |
197 |
for ( USHORT n=0; n<aList.Count(); n++ ) |
200 |
for ( USHORT n=0; n<aList.Count(); n++ ) |
198 |
aList.GetObject(n)->Call( this ); |
201 |
aList.GetObject(n)->Call( this ); |
Link Here
|
234 |
// Init member then. |
237 |
// Init member then. |
235 |
, m_bDontHideDisabledEntries ( DEFAULT_DONTHIDEDISABLEDENTRIES ) |
238 |
, m_bDontHideDisabledEntries ( DEFAULT_DONTHIDEDISABLEDENTRIES ) |
236 |
, m_bFollowMouse ( DEFAULT_FOLLOWMOUSE ) |
239 |
, m_bFollowMouse ( DEFAULT_FOLLOWMOUSE ) |
237 |
, m_bMenuIcons ( DEFAULT_MENUICONS ) |
240 |
, m_nMenuIcons ( DEFAULT_MENUICONS ) |
238 |
{ |
241 |
{ |
239 |
// Use our static list of configuration keys to get his values. |
242 |
// Use our static list of configuration keys to get his values. |
240 |
Sequence< OUString > seqNames = impl_GetPropertyNames(); |
243 |
Sequence< OUString > seqNames = impl_GetPropertyNames(); |
Link Here
|
245 |
// Follow assignment use order of values in relation to our list of key names! |
248 |
// Follow assignment use order of values in relation to our list of key names! |
246 |
DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nI miss some values of configuration keys!\n" ); |
249 |
DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nI miss some values of configuration keys!\n" ); |
247 |
|
250 |
|
|
|
251 |
sal_Bool bMenuIcons = true; |
252 |
sal_Bool bSystemMenuIcons = true; |
253 |
|
248 |
// Copy values from list in right order to ouer internal member. |
254 |
// Copy values from list in right order to ouer internal member. |
249 |
sal_Int32 nPropertyCount = seqValues.getLength() ; |
255 |
sal_Int32 nPropertyCount = seqValues.getLength() ; |
250 |
sal_Int32 nProperty = 0 ; |
256 |
sal_Int32 nProperty = 0 ; |
Link Here
|
268 |
break; |
274 |
break; |
269 |
case PROPERTYHANDLE_SHOWICONSINMENUES : { |
275 |
case PROPERTYHANDLE_SHOWICONSINMENUES : { |
270 |
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\ShowIconsInMenues\"?" ); |
276 |
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\ShowIconsInMenues\"?" ); |
271 |
seqValues[nProperty] >>= m_bMenuIcons; |
277 |
seqValues[nProperty] >>= bMenuIcons; |
|
|
278 |
} |
279 |
break; |
280 |
case PROPERTYHANDLE_SYSTEMICONSINMENUES : { |
281 |
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\IsSystemIconsInMenus\"?" ); |
282 |
seqValues[nProperty] >>= bSystemMenuIcons; |
272 |
} |
283 |
} |
273 |
break; |
284 |
break; |
274 |
} |
285 |
} |
275 |
} |
286 |
} |
276 |
|
287 |
|
|
|
288 |
m_nMenuIcons = bSystemMenuIcons ? 2 : bMenuIcons; |
289 |
|
277 |
EnableNotification( seqNames ); |
290 |
EnableNotification( seqNames ); |
278 |
} |
291 |
} |
279 |
|
292 |
|
Link Here
|
303 |
// Safe impossible cases. |
316 |
// Safe impossible cases. |
304 |
// We need values from ALL notified configuration keys. |
317 |
// We need values from ALL notified configuration keys. |
305 |
DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtMenuOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); |
318 |
DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtMenuOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); |
|
|
319 |
|
320 |
sal_Bool bMenuIcons = true; |
321 |
sal_Bool bSystemMenuIcons = true; |
322 |
|
306 |
// Step over list of property names and get right value from coreesponding value list to set it on internal members! |
323 |
// Step over list of property names and get right value from coreesponding value list to set it on internal members! |
307 |
sal_Int32 nCount = seqPropertyNames.getLength(); |
324 |
sal_Int32 nCount = seqPropertyNames.getLength(); |
308 |
for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty ) |
325 |
for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty ) |
Link Here
|
312 |
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\View\\Menu\\DontHideDisabledEntry\"?" ); |
329 |
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\View\\Menu\\DontHideDisabledEntry\"?" ); |
313 |
seqValues[nProperty] >>= m_bDontHideDisabledEntries; |
330 |
seqValues[nProperty] >>= m_bDontHideDisabledEntries; |
314 |
} |
331 |
} |
315 |
else |
332 |
else if( seqPropertyNames[nProperty] == PROPERTYNAME_FOLLOWMOUSE ) |
316 |
if( seqPropertyNames[nProperty] == PROPERTYNAME_FOLLOWMOUSE ) |
|
|
317 |
{ |
333 |
{ |
318 |
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\View\\Menu\\FollowMouse\"?" ); |
334 |
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\View\\Menu\\FollowMouse\"?" ); |
319 |
seqValues[nProperty] >>= m_bFollowMouse; |
335 |
seqValues[nProperty] >>= m_bFollowMouse; |
320 |
} |
336 |
} |
321 |
if( seqPropertyNames[nProperty] == PROPERTYNAME_SHOWICONSINMENUES ) |
337 |
else if( seqPropertyNames[nProperty] == PROPERTYNAME_SHOWICONSINMENUES ) |
322 |
{ |
338 |
{ |
323 |
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\ShowIconsInMenues\"?" ); |
339 |
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\ShowIconsInMenues\"?" ); |
324 |
seqValues[nProperty] >>= m_bMenuIcons; |
340 |
seqValues[nProperty] >>= bMenuIcons; |
325 |
} |
341 |
} |
|
|
342 |
else if( seqPropertyNames[nProperty] == PROPERTYNAME_SYSTEMICONSINMENUES ) |
343 |
{ |
344 |
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\IsSystemIconsInMenus\"?" ); |
345 |
seqValues[nProperty] >>= bSystemMenuIcons; |
346 |
} |
347 |
|
326 |
#if OSL_DEBUG_LEVEL > 1 |
348 |
#if OSL_DEBUG_LEVEL > 1 |
327 |
else DBG_ASSERT( sal_False, "SvtMenuOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); |
349 |
else DBG_ASSERT( sal_False, "SvtMenuOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); |
328 |
#endif |
350 |
#endif |
329 |
} |
351 |
} |
330 |
|
352 |
|
|
|
353 |
m_nMenuIcons = bSystemMenuIcons ? 2 : bMenuIcons; |
354 |
|
331 |
for ( USHORT n=0; n<aList.Count(); n++ ) |
355 |
for ( USHORT n=0; n<aList.Count(); n++ ) |
332 |
aList.GetObject(n)->Call( this ); |
356 |
aList.GetObject(n)->Call( this ); |
333 |
} |
357 |
} |
Link Here
|
354 |
seqValues[nProperty] <<= m_bFollowMouse; |
378 |
seqValues[nProperty] <<= m_bFollowMouse; |
355 |
} |
379 |
} |
356 |
break; |
380 |
break; |
|
|
381 |
//Output cache of current setting as possibly modified by System Theme for older version |
357 |
case PROPERTYHANDLE_SHOWICONSINMENUES : { |
382 |
case PROPERTYHANDLE_SHOWICONSINMENUES : { |
358 |
seqValues[nProperty] <<= m_bMenuIcons; |
383 |
seqValues[nProperty] <<=(sal_Bool)(Application::GetSettings().GetStyleSettings().GetUseImagesInMenus()); |
|
|
384 |
} |
385 |
break; |
386 |
case PROPERTYHANDLE_SYSTEMICONSINMENUES : { |
387 |
seqValues[nProperty] <<= (m_nMenuIcons == 2 ? sal_True : sal_False) ; |
359 |
} |
388 |
} |
360 |
break; |
389 |
break; |
361 |
} |
390 |
} |
Link Here
|
374 |
{ |
403 |
{ |
375 |
PROPERTYNAME_DONTHIDEDISABLEDENTRIES , |
404 |
PROPERTYNAME_DONTHIDEDISABLEDENTRIES , |
376 |
PROPERTYNAME_FOLLOWMOUSE , |
405 |
PROPERTYNAME_FOLLOWMOUSE , |
377 |
PROPERTYNAME_SHOWICONSINMENUES |
406 |
PROPERTYNAME_SHOWICONSINMENUES , |
|
|
407 |
PROPERTYNAME_SYSTEMICONSINMENUES |
378 |
}; |
408 |
}; |
379 |
// Initialize return sequence with these list ... |
409 |
// Initialize return sequence with these list ... |
380 |
static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); |
410 |
static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); |
Link Here
|
483 |
//***************************************************************************************************************** |
513 |
//***************************************************************************************************************** |
484 |
// public method |
514 |
// public method |
485 |
//***************************************************************************************************************** |
515 |
//***************************************************************************************************************** |
486 |
sal_Bool SvtMenuOptions::IsMenuIconsEnabled() const |
516 |
sal_Int16 SvtMenuOptions::GetMenuIconsState() const |
487 |
{ |
517 |
{ |
488 |
MutexGuard aGuard( GetOwnStaticMutex() ); |
518 |
MutexGuard aGuard( GetOwnStaticMutex() ); |
489 |
return m_pDataContainer->IsMenuIconsEnabled(); |
519 |
return m_pDataContainer->GetMenuIconsState(); |
490 |
} |
520 |
} |
491 |
|
521 |
|
492 |
//***************************************************************************************************************** |
522 |
//***************************************************************************************************************** |
493 |
// public method |
523 |
// public method |
494 |
//***************************************************************************************************************** |
524 |
//***************************************************************************************************************** |
495 |
void SvtMenuOptions::SetMenuIconsState( sal_Bool bState ) |
525 |
void SvtMenuOptions::SetMenuIconsState( sal_Int16 bState ) |
496 |
{ |
526 |
{ |
497 |
MutexGuard aGuard( GetOwnStaticMutex() ); |
527 |
MutexGuard aGuard( GetOwnStaticMutex() ); |
498 |
m_pDataContainer->SetMenuIconsState( bState ); |
528 |
m_pDataContainer->SetMenuIconsState( bState ); |