1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "DrawViewShell.hxx"
21 #include <com/sun/star/form/FormButtonType.hpp>
22 #include <com/sun/star/beans/XPropertySet.hpp>
23 #include <comphelper/string.hxx>
24 #include <svx/svxids.hrc>
25 #include <svx/globl3d.hxx>
26 #include <svx/hlnkitem.hxx>
27 #include <editeng/eeitem.hxx>
28 #include <editeng/flditem.hxx>
29 #include <sfx2/viewfrm.hxx>
30 #include <svl/whiter.hxx>
31 #include <svl/eitem.hxx>
32 #include <svl/itempool.hxx>
33 #include <sfx2/tplpitem.hxx>
34 #include <sfx2/bindings.hxx>
35 #include <sfx2/app.hxx>
36 #include <sfx2/templdlg.hxx>
37 #include <svx/xdef.hxx>
38 #include <svx/svddef.hxx>
39 #include <svx/fmglob.hxx>
40 #include <svx/svdouno.hxx>
41 #include <svx/fmshell.hxx>
42 #include <svl/cjkoptions.hxx>
44 #include "FrameView.hxx"
45 #include "Outliner.hxx"
49 #include "stlsheet.hxx"
50 #include "drawview.hxx"
51 #include "drawdoc.hxx"
53 #include "ViewShellBase.hxx"
54 #include "FormShellManager.hxx"
56 #include "anminfo.hxx"
58 #include <editeng/lspcitem.hxx>
59 #include <editeng/ulspitem.hxx>
60 #include <editeng/lrspitem.hxx>
61 #include <editeng/escapementitem.hxx>
62 #include <editeng/numitem.hxx>
63 #include <editeng/adjustitem.hxx>
64 #include <svx/nbdtmgfact.hxx>
65 #include <svx/nbdtmg.hxx>
66 #include <boost/scoped_ptr.hpp>
68 using namespace svx::sidebar
;
69 using namespace ::com::sun::star
;
74 * Set state of controller SfxSlots
76 void DrawViewShell::GetCtrlState(SfxItemSet
&rSet
)
78 if (rSet
.GetItemState(SID_RELOAD
) != SfxItemState::UNKNOWN
)
80 // let "last version" of SFx en/disable
81 GetViewFrame()->GetSlotState (SID_RELOAD
, NULL
, &rSet
);
84 if (SfxItemState::DEFAULT
== rSet
.GetItemState(SID_HYPERLINK_GETLINK
))
86 SvxHyperlinkItem aHLinkItem
;
88 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
93 const SvxFieldItem
* pFieldItem
= pOLV
->GetFieldAtSelection();
96 ESelection aSel
= pOLV
->GetSelection();
97 if ( abs( aSel
.nEndPos
- aSel
.nStartPos
) == 1 )
99 const SvxFieldData
* pField
= pFieldItem
->GetField();
100 if (pField
->ISA(SvxURLField
))
102 aHLinkItem
.SetName(static_cast<const SvxURLField
*>(pField
)->GetRepresentation());
103 aHLinkItem
.SetURL(static_cast<const SvxURLField
*>(pField
)->GetURL());
104 aHLinkItem
.SetTargetFrame(static_cast<const SvxURLField
*>(pField
)->GetTargetFrame());
111 // use selected text as name for urls
112 OUString sReturn
= pOLV
->GetSelected();
113 if (sReturn
.getLength() > 255)
114 sReturn
= sReturn
.copy(0, 255);
115 aHLinkItem
.SetName(comphelper::string::stripEnd(sReturn
, ' '));
120 if (mpDrawView
->GetMarkedObjectList().GetMarkCount() > 0)
124 SdrObject
* pMarkedObj
= mpDrawView
->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
125 if( pMarkedObj
&& (FmFormInventor
== pMarkedObj
->GetObjInventor()) )
127 SdrUnoObj
* pUnoCtrl
= dynamic_cast< SdrUnoObj
* >( pMarkedObj
);
131 uno::Reference
< awt::XControlModel
> xControlModel( pUnoCtrl
->GetUnoControlModel(), uno::UNO_QUERY_THROW
);
132 uno::Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY_THROW
);
133 uno::Reference
< beans::XPropertySetInfo
> xPropInfo( xPropSet
->getPropertySetInfo(), uno::UNO_QUERY_THROW
);
135 form::FormButtonType eButtonType
= form::FormButtonType_URL
;
136 const OUString
sButtonType( "ButtonType" );
137 if(xPropInfo
->hasPropertyByName( sButtonType
) && (xPropSet
->getPropertyValue( sButtonType
) >>= eButtonType
) )
142 const OUString
sLabel( "Label" );
143 if(xPropInfo
->hasPropertyByName(sLabel
))
145 if( xPropSet
->getPropertyValue(sLabel
) >>= aString
)
146 aHLinkItem
.SetName(aString
);
150 const OUString
sTargetURL( "TargetURL" );
151 if(xPropInfo
->hasPropertyByName(sTargetURL
))
153 if( xPropSet
->getPropertyValue(sTargetURL
) >>= aString
)
154 aHLinkItem
.SetURL(aString
);
158 const OUString
sTargetFrame( "TargetFrame" );
159 if(xPropInfo
->hasPropertyByName(sTargetFrame
) )
161 if( xPropSet
->getPropertyValue(sTargetFrame
) >>= aString
)
162 aHLinkItem
.SetTargetFrame(aString
);
165 aHLinkItem
.SetInsertMode(HLINK_BUTTON
);
169 catch( uno::Exception
& )
174 // try interaction link
175 if( !bFound
&& pMarkedObj
)
177 SdAnimationInfo
* pInfo
= SdDrawDocument::GetShapeUserData(*pMarkedObj
);
178 if( pInfo
&& (pInfo
->meClickAction
== presentation::ClickAction_DOCUMENT
) )
179 aHLinkItem
.SetURL( pInfo
->GetBookmark());
180 aHLinkItem
.SetInsertMode(HLINK_BUTTON
);
185 rSet
.Put(aHLinkItem
);
187 rSet
.Put( SfxBoolItem( SID_READONLY_MODE
, mbReadOnly
) );
190 if( SfxItemState::DEFAULT
== rSet
.GetItemState( SID_OUTPUT_QUALITY_COLOR
) ||
191 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_OUTPUT_QUALITY_GRAYSCALE
) ||
192 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_OUTPUT_QUALITY_BLACKWHITE
) ||
193 SfxItemState::DEFAULT
== rSet
.GetItemState( SID_OUTPUT_QUALITY_CONTRAST
) )
195 const sal_uLong nMode
= (sal_Int32
)GetActiveWindow()->GetDrawMode();
196 rSet
.Put( SfxBoolItem( SID_OUTPUT_QUALITY_COLOR
, (sal_uLong
)OUTPUT_DRAWMODE_COLOR
== nMode
) );
197 rSet
.Put( SfxBoolItem( SID_OUTPUT_QUALITY_GRAYSCALE
, (sal_uLong
)OUTPUT_DRAWMODE_GRAYSCALE
== nMode
) );
198 rSet
.Put( SfxBoolItem( SID_OUTPUT_QUALITY_BLACKWHITE
, (sal_uLong
)OUTPUT_DRAWMODE_BLACKWHITE
== nMode
) );
199 rSet
.Put( SfxBoolItem( SID_OUTPUT_QUALITY_CONTRAST
, (sal_uLong
)OUTPUT_DRAWMODE_CONTRAST
== nMode
) );
202 if ( SfxItemState::DEFAULT
== rSet
.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN
) )
204 rSet
.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN
, true ) );
207 if ( SfxItemState::DEFAULT
== rSet
.GetItemState(SID_ATTR_YEAR2000
) )
209 FmFormShell
* pFormShell
= GetViewShellBase().GetFormShellManager()->GetFormShell();
210 if (pFormShell
!= NULL
)
212 sal_uInt16 nState
= 0;
213 if (pFormShell
->GetY2KState(nState
))
214 rSet
.Put( SfxUInt16Item( SID_ATTR_YEAR2000
, nState
) );
216 rSet
.DisableItem( SID_ATTR_YEAR2000
);
220 if ( !GetView()->GetTextEditOutliner() )
222 SvtCJKOptions aCJKOptions
;
223 if( !aCJKOptions
.IsChangeCaseMapEnabled() )
225 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH
, false );
226 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH
, false );
227 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA
, false );
228 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA
, false );
232 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH
, true );
233 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH
, true );
234 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA
, true );
235 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA
, true );
238 rSet
.DisableItem( SID_TRANSLITERATE_SENTENCE_CASE
);
239 rSet
.DisableItem( SID_TRANSLITERATE_TITLE_CASE
);
240 rSet
.DisableItem( SID_TRANSLITERATE_TOGGLE_CASE
);
241 rSet
.DisableItem( SID_TRANSLITERATE_UPPER
);
242 rSet
.DisableItem( SID_TRANSLITERATE_LOWER
);
243 rSet
.DisableItem( SID_TRANSLITERATE_HALFWIDTH
);
244 rSet
.DisableItem( SID_TRANSLITERATE_FULLWIDTH
);
245 rSet
.DisableItem( SID_TRANSLITERATE_HIRAGANA
);
246 rSet
.DisableItem( SID_TRANSLITERATE_KATAGANA
);
250 SvtCJKOptions aCJKOptions
;
251 if( !aCJKOptions
.IsChangeCaseMapEnabled() )
253 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH
, false );
254 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH
, false );
255 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA
, false );
256 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA
, false );
257 rSet
.DisableItem( SID_TRANSLITERATE_HALFWIDTH
);
258 rSet
.DisableItem( SID_TRANSLITERATE_FULLWIDTH
);
259 rSet
.DisableItem( SID_TRANSLITERATE_HIRAGANA
);
260 rSet
.DisableItem( SID_TRANSLITERATE_KATAGANA
);
264 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH
, true );
265 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH
, true );
266 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA
, true );
267 GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA
, true );
272 void DrawViewShell::GetAttrState( SfxItemSet
& rSet
)
274 SfxWhichIter
aIter( rSet
);
275 sal_uInt16 nWhich
= aIter
.FirstWhich();
278 SfxAllItemSet
aAllSet( *rSet
.GetPool() );
282 sal_uInt16 nSlotId
= SfxItemPool::IsWhich(nWhich
)
283 ? GetPool().GetSlotId(nWhich
)
287 case SID_ATTR_PARA_ADJUST_LEFT
:
289 SfxItemSet
aAttrs( GetDoc()->GetPool() );
290 mpDrawView
->GetAttributes( aAttrs
);
292 SvxAdjustItem aItem
= static_cast<const SvxAdjustItem
&>( aAttrs
.Get( EE_PARA_JUST
) );
293 SvxAdjust eAdj
= aItem
.GetAdjust();
294 if ( eAdj
== SVX_ADJUST_LEFT
)
296 rSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT
, true ) );
304 case SID_ATTR_PARA_ADJUST_CENTER
:
306 SfxItemSet
aAttrs( GetDoc()->GetPool() );
307 mpDrawView
->GetAttributes( aAttrs
);
309 SvxAdjustItem aItem
= static_cast<const SvxAdjustItem
&>( aAttrs
.Get( EE_PARA_JUST
) );
310 SvxAdjust eAdj
= aItem
.GetAdjust();
311 if ( eAdj
== SVX_ADJUST_CENTER
)
313 rSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER
, true ) );
321 case SID_ATTR_PARA_ADJUST_RIGHT
:
323 SfxItemSet
aAttrs( GetDoc()->GetPool() );
324 mpDrawView
->GetAttributes( aAttrs
);
326 SvxAdjustItem aItem
= static_cast<const SvxAdjustItem
&>( aAttrs
.Get( EE_PARA_JUST
) );
327 SvxAdjust eAdj
= aItem
.GetAdjust();
328 if ( eAdj
== SVX_ADJUST_RIGHT
)
330 rSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT
, true ) );
338 case SID_ATTR_PARA_ADJUST_BLOCK
:
340 SfxItemSet
aAttrs( GetDoc()->GetPool() );
341 mpDrawView
->GetAttributes( aAttrs
);
343 SvxAdjustItem aItem
= static_cast<const SvxAdjustItem
&>( aAttrs
.Get( EE_PARA_JUST
) );
344 SvxAdjust eAdj
= aItem
.GetAdjust();
345 if ( eAdj
== SVX_ADJUST_BLOCK
)
347 rSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK
, true ) );
355 case SID_ATTR_PARA_LRSPACE
:
357 SfxItemSet
aAttrs( GetDoc()->GetPool() );
358 mpDrawView
->GetAttributes( aAttrs
);
359 SvxLRSpaceItem aLRSpace
= static_cast<const SvxLRSpaceItem
&>( aAttrs
.Get( EE_PARA_LRSPACE
) );
360 aLRSpace
.SetWhich(SID_ATTR_PARA_LRSPACE
);
363 Invalidate(SID_ATTR_PARA_LRSPACE
);
366 case SID_ATTR_PARA_LINESPACE
:
368 SfxItemSet
aAttrs( GetDoc()->GetPool() );
369 mpDrawView
->GetAttributes( aAttrs
);
370 SvxLineSpacingItem aLineLR
= static_cast<const SvxLineSpacingItem
&>( aAttrs
.Get( EE_PARA_SBL
) );
373 Invalidate(SID_ATTR_PARA_LINESPACE
);
376 case SID_ATTR_PARA_ULSPACE
:
378 SfxItemSet
aAttrs( GetDoc()->GetPool() );
379 mpDrawView
->GetAttributes( aAttrs
);
380 SvxULSpaceItem aULSP
= static_cast<const SvxULSpaceItem
&>( aAttrs
.Get( EE_PARA_ULSPACE
) );
381 aULSP
.SetWhich(SID_ATTR_PARA_ULSPACE
);
384 Invalidate(SID_ATTR_PARA_ULSPACE
);
387 case SID_ATTR_FILL_STYLE
:
388 case SID_ATTR_FILL_COLOR
:
389 case SID_ATTR_FILL_GRADIENT
:
390 case SID_ATTR_FILL_HATCH
:
391 case SID_ATTR_FILL_BITMAP
:
392 case SID_ATTR_FILL_SHADOW
:
393 case SID_ATTR_FILL_TRANSPARENCE
:
394 case SID_ATTR_FILL_FLOATTRANSPARENCE
:
395 case SID_ATTR_LINE_STYLE
:
396 case SID_ATTR_LINE_DASH
:
397 case SID_ATTR_LINE_WIDTH
:
398 case SID_ATTR_LINE_COLOR
:
399 case SID_ATTR_LINE_TRANSPARENCE
:
400 case SID_ATTR_LINE_JOINT
:
401 case SID_ATTR_LINE_CAP
:
402 case SID_ATTR_TEXT_FITTOSIZE
:
403 case SID_ATTR_CHAR_FONT
:
404 case SID_ATTR_CHAR_FONTHEIGHT
:
405 case SID_ATTR_CHAR_SHADOWED
:
406 case SID_ATTR_CHAR_POSTURE
:
407 case SID_ATTR_CHAR_UNDERLINE
:
408 case SID_ATTR_CHAR_STRIKEOUT
:
409 case SID_ATTR_CHAR_WEIGHT
:
410 case SID_ATTR_CHAR_COLOR
:
411 case SID_ATTR_CHAR_KERNING
:
412 case SID_SET_SUB_SCRIPT
:
413 case SID_SET_SUPER_SCRIPT
:
419 case SID_HYPHENATION
:
421 SfxItemSet
aAttrs( GetDoc()->GetPool() );
422 mpDrawView
->GetAttributes( aAttrs
);
423 if( aAttrs
.GetItemState( EE_PARA_HYPHENATE
) >= SfxItemState::DEFAULT
)
425 bool bValue
= static_cast<const SfxBoolItem
&>( aAttrs
.Get( EE_PARA_HYPHENATE
) ).GetValue();
426 rSet
.Put( SfxBoolItem( SID_HYPHENATION
, bValue
) );
431 case SID_STYLE_FAMILY2
:
432 case SID_STYLE_FAMILY3
:
433 case SID_STYLE_FAMILY5
:
434 case SID_STYLE_APPLY
: // StyleControl
436 SfxStyleSheet
* pStyleSheet
= mpDrawView
->GetStyleSheet();
439 if( nSlotId
!= SID_STYLE_APPLY
&& !mpDrawView
->AreObjectsMarked() )
441 SfxTemplateItem
aTmpItem( nWhich
, OUString() );
442 aAllSet
.Put( aTmpItem
, aTmpItem
.Which() );
446 if (pStyleSheet
->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE
)
447 pStyleSheet
= static_cast<SdStyleSheet
*>(pStyleSheet
)->GetPseudoStyleSheet();
451 SfxStyleFamily eFamily
= pStyleSheet
->GetFamily();
453 if ((eFamily
== SD_STYLE_FAMILY_GRAPHICS
&& nSlotId
== SID_STYLE_FAMILY2
) ||
454 (eFamily
== SD_STYLE_FAMILY_CELL
&& nSlotId
== SID_STYLE_FAMILY3
) ||
455 (eFamily
== SD_STYLE_FAMILY_PSEUDO
&& nSlotId
== SID_STYLE_FAMILY5
))
457 SfxTemplateItem
aTmpItem ( nWhich
, pStyleSheet
->GetName() );
458 aAllSet
.Put( aTmpItem
, aTmpItem
.Which() );
462 SfxTemplateItem
aTmpItem(nWhich
, OUString());
463 aAllSet
.Put(aTmpItem
,aTmpItem
.Which() );
469 { SfxTemplateItem
aItem( nWhich
, OUString() );
470 aAllSet
.Put( aItem
, aItem
.Which() );
475 case SID_SET_DEFAULT
:
477 if( !mpDrawView
->GetMarkedObjectList().GetMarkCount() ||
478 ( !mpDrawView
->IsTextEdit() && !mpDrawView
->GetStyleSheet() )
480 rSet
.DisableItem( nWhich
);
484 case SID_STYLE_WATERCAN
:
486 SfxPoolItem
* pItem
= NULL
;
487 GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY
, pItem
);
488 SfxUInt16Item
* pFamilyItem
= dynamic_cast<SfxUInt16Item
*>(pItem
);
489 if (pFamilyItem
&& SfxTemplate::NIdToSfxFamilyId(pFamilyItem
->GetValue()) == SD_STYLE_FAMILY_PSEUDO
)
490 rSet
.Put(SfxBoolItem(nWhich
,false));
493 SfxBoolItem
aItem(nWhich
, SD_MOD()->GetWaterCan());
494 aAllSet
.Put( aItem
, aItem
.Which());
502 SfxPoolItem
* pItem
= NULL
;
503 GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY
, pItem
);
504 SfxUInt16Item
* pFamilyItem
= dynamic_cast<SfxUInt16Item
*>(pItem
);
505 if (pFamilyItem
&& SfxTemplate::NIdToSfxFamilyId(pFamilyItem
->GetValue()) == SD_STYLE_FAMILY_PSEUDO
)
507 rSet
.DisableItem(nWhich
);
513 case SID_STYLE_DRAGHIERARCHIE
:
515 SfxPoolItem
* pItem
= NULL
;
516 GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY
, pItem
);
517 SfxUInt16Item
* pFamilyItem
= dynamic_cast<SfxUInt16Item
*>(pItem
);
518 if (pFamilyItem
&& SfxTemplate::NIdToSfxFamilyId(pFamilyItem
->GetValue()) == SD_STYLE_FAMILY_PSEUDO
)
519 rSet
.DisableItem(nWhich
);
524 case SID_STYLE_NEW_BY_EXAMPLE
:
526 // It is not possible to create PseudoStyleSheets 'by Example';
527 // normal style sheets need a selected object for that
529 SfxPoolItem
* pItem
= NULL
;
530 GetViewFrame()->GetBindings().QueryState(SID_STYLE_FAMILY
, pItem
);
531 SfxUInt16Item
* pFamilyItem
= dynamic_cast<SfxUInt16Item
*>(pItem
);
534 if (SfxTemplate::NIdToSfxFamilyId(pFamilyItem
->GetValue()) == SD_STYLE_FAMILY_PSEUDO
)
536 rSet
.DisableItem(nWhich
);
538 else if (SfxTemplate::NIdToSfxFamilyId(pFamilyItem
->GetValue()) == SD_STYLE_FAMILY_GRAPHICS
)
540 if (!mpDrawView
->AreObjectsMarked())
542 rSet
.DisableItem(nWhich
);
546 // if there is no (yet) a style designer, we have to go back into the
547 // view state; an actual set family can not be considered
550 if (!mpDrawView
->AreObjectsMarked())
552 rSet
.DisableItem(nWhich
);
559 case SID_STYLE_UPDATE_BY_EXAMPLE
:
561 if (!mpDrawView
->AreObjectsMarked())
563 rSet
.DisableItem(nWhich
);
567 case FN_BUL_NUM_RULE_INDEX
:
568 case FN_NUM_NUM_RULE_INDEX
:
570 SfxItemSet
aEditAttr( GetDoc()->GetPool() );
571 mpDrawView
->GetAttributes( aEditAttr
);
573 SfxItemSet
aNewAttr( GetPool(), EE_ITEMS_START
, EE_ITEMS_END
);
574 aNewAttr
.Put( aEditAttr
, false );
576 boost::scoped_ptr
<SvxNumRule
> pNumRule
;
577 const SfxPoolItem
* pTmpItem
=NULL
;
578 sal_uInt16 nNumItemId
= SID_ATTR_NUMBERING_RULE
;
579 sal_uInt16 nActNumLvl
= mpDrawView
->GetSelectionLevel();
580 pTmpItem
=GetNumBulletItem(aNewAttr
, nNumItemId
);
583 pNumRule
.reset(new SvxNumRule(*static_cast<const SvxNumBulletItem
*>(pTmpItem
)->GetNumRule()));
587 sal_uInt16 nMask
= 1;
588 sal_uInt16 nCount
= 0;
589 sal_uInt16 nCurLevel
= (sal_uInt16
)0xFFFF;
590 for(sal_uInt16 i
= 0; i
< pNumRule
->GetLevelCount(); i
++)
592 if(nActNumLvl
& nMask
)
601 const SvxNumberFormat
* pNumFmt
= pNumRule
->Get(nCurLevel
);
604 bool bBullets
= false;
605 switch(pNumFmt
->GetNumberingType())
607 case SVX_NUM_CHAR_SPECIAL
:
616 rSet
.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX
,(sal_uInt16
)0xFFFF));
617 rSet
.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX
,(sal_uInt16
)0xFFFF));
620 NBOTypeMgrBase
* pBullets
= NBOutlineTypeMgrFact::CreateInstance(eNBOType::BULLETS
);
623 sal_uInt16 nBulIndex
= pBullets
->GetNBOIndexForNumRule(*pNumRule
,nActNumLvl
);
624 rSet
.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX
,nBulIndex
));
628 NBOTypeMgrBase
* pNumbering
= NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING
);
631 sal_uInt16 nBulIndex
= pNumbering
->GetNBOIndexForNumRule(*pNumRule
,nActNumLvl
);
632 rSet
.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX
,nBulIndex
));
640 case FN_NUM_BULLET_ON
:
641 case FN_NUM_NUMBERING_ON
:
643 bool bEnable
= false;
644 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
645 const size_t nMarkCount
= rMarkList
.GetMarkCount();
646 for (size_t nIndex
= 0; nIndex
< nMarkCount
; ++nIndex
)
648 SdrTextObj
* pTextObj
= dynamic_cast< SdrTextObj
* >(rMarkList
.GetMark(nIndex
)->GetMarkedSdrObj());
649 if (pTextObj
&& pTextObj
->GetObjInventor() == SdrInventor
)
651 if (pTextObj
->GetObjIdentifier() != OBJ_OLE2
)
660 rSet
.Put(SfxBoolItem(FN_NUM_BULLET_ON
, false));
661 rSet
.Put(SfxBoolItem(FN_NUM_NUMBERING_ON
, false));
665 rSet
.DisableItem(FN_NUM_BULLET_ON
);
666 rSet
.DisableItem(FN_NUM_NUMBERING_ON
);
671 nWhich
= aIter
.NextWhich();
674 boost::scoped_ptr
<SfxItemSet
> pSet
;
678 pSet
.reset(new SfxItemSet( GetDoc()->GetPool() ));
679 mpDrawView
->GetAttributes( *pSet
);
680 rSet
.Put( *pSet
, false );
683 rSet
.Put( aAllSet
, false );
685 // there were changes at area and/or line attributes
688 // if the view owns selected objects, corresponding items have to be
689 // changed from SfxItemState::DEFAULT (_ON) to SfxItemState::DISABLED
690 if( mpDrawView
->AreObjectsMarked() )
692 SfxWhichIter
aNewIter( *pSet
, XATTR_LINE_FIRST
, XATTR_FILL_LAST
);
693 nWhich
= aNewIter
.FirstWhich();
696 if( SfxItemState::DEFAULT
== pSet
->GetItemState( nWhich
) )
698 rSet
.ClearItem( nWhich
);
699 rSet
.DisableItem( nWhich
);
701 nWhich
= aNewIter
.NextWhich();
705 SfxItemState eState
= pSet
->GetItemState( EE_PARA_LRSPACE
);
706 if ( eState
== SfxItemState::DONTCARE
)
708 rSet
.InvalidateItem(EE_PARA_LRSPACE
);
709 rSet
.InvalidateItem(SID_ATTR_PARA_LRSPACE
);
711 eState
= pSet
->GetItemState( EE_PARA_SBL
);
712 if ( eState
== SfxItemState::DONTCARE
)
714 rSet
.InvalidateItem(EE_PARA_SBL
);
715 rSet
.InvalidateItem(SID_ATTR_PARA_LINESPACE
);
717 eState
= pSet
->GetItemState( EE_PARA_ULSPACE
);
718 if ( eState
== SfxItemState::DONTCARE
)
720 rSet
.InvalidateItem(EE_PARA_ULSPACE
);
721 rSet
.InvalidateItem(SID_ATTR_PARA_ULSPACE
);
724 SvxEscapement eEsc
= (SvxEscapement
) static_cast<const SvxEscapementItem
&>(
725 pSet
->Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
726 if( eEsc
== SVX_ESCAPEMENT_SUPERSCRIPT
)
728 rSet
.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT
, true ) );
730 else if( eEsc
== SVX_ESCAPEMENT_SUBSCRIPT
)
732 rSet
.Put( SfxBoolItem( SID_SET_SUB_SCRIPT
, true ) );
735 eState
= pSet
->GetItemState( EE_CHAR_KERNING
, true );
736 if ( eState
== SfxItemState::DONTCARE
)
738 rSet
.InvalidateItem(EE_CHAR_KERNING
);
739 rSet
.InvalidateItem(SID_ATTR_CHAR_KERNING
);
744 OUString
DrawViewShell::GetSelectionText(bool bCompleteWords
)
746 OUString aStrSelection
;
747 ::Outliner
* pOl
= mpDrawView
->GetTextEditOutliner();
748 OutlinerView
* pOlView
= mpDrawView
->GetTextEditOutlinerView();
754 ESelection aSel
= pOlView
->GetSelection();
755 OUString aStrCurrentDelimiters
= pOl
->GetWordDelimiters();
757 pOl
->SetWordDelimiters(" .,;\"'");
758 aStrSelection
= pOl
->GetWord( aSel
.nEndPara
, aSel
.nEndPos
);
759 pOl
->SetWordDelimiters( aStrCurrentDelimiters
);
763 aStrSelection
= pOlView
->GetSelected();
767 return aStrSelection
;
770 bool DrawViewShell::HasSelection(bool bText
) const
772 bool bReturn
= false;
776 OutlinerView
* pOlView
= mpDrawView
->GetTextEditOutlinerView();
778 if (pOlView
&& !pOlView
->GetSelected().isEmpty())
783 else if (mpDrawView
->GetMarkedObjectList().GetMarkCount() != 0)
791 } // end of namespace sd
793 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */