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 <com/sun/star/linguistic2/XThesaurus.hpp>
21 #include <com/sun/star/lang/Locale.hpp>
22 #include <comphelper/string.hxx>
23 #include "scitems.hxx"
25 #include <editeng/adjustitem.hxx>
26 #include <svx/clipfmtitem.hxx>
27 #include <editeng/contouritem.hxx>
28 #include <editeng/crossedoutitem.hxx>
29 #include <editeng/editeng.hxx>
30 #include <editeng/escapementitem.hxx>
31 #include <editeng/flditem.hxx>
32 #include <editeng/fontitem.hxx>
33 #include <editeng/frmdiritem.hxx>
34 #include <editeng/lrspitem.hxx>
35 #include <editeng/lspcitem.hxx>
36 #include <editeng/ulspitem.hxx>
37 #include <svx/hlnkitem.hxx>
38 #include <svx/svdoutl.hxx>
39 #include <editeng/unolingu.hxx>
40 #include <editeng/outlobj.hxx>
41 #include <editeng/postitem.hxx>
42 #include <editeng/scripttypeitem.hxx>
43 #include <editeng/shdditem.hxx>
44 #include <svl/srchitem.hxx>
45 #include <editeng/udlnitem.hxx>
46 #include <editeng/wghtitem.hxx>
47 #include <editeng/writingmodeitem.hxx>
48 #include <sfx2/app.hxx>
49 #include <sfx2/dispatch.hxx>
50 #include <sfx2/objface.hxx>
51 #include <sfx2/objsh.hxx>
52 #include <sfx2/request.hxx>
53 #include <sfx2/viewfrm.hxx>
54 #include <svtools/cliplistener.hxx>
55 #include <svtools/transfer.hxx>
56 #include <svl/whiter.hxx>
57 #include <svl/languageoptions.hxx>
58 #include <vcl/msgbox.hxx>
60 #include <svx/svxdlg.hxx>
61 #include <svx/dialogs.hrc>
62 #include <sfx2/sidebar/EnumContext.hxx>
65 #include "globstr.hrc"
67 #include "drtxtob.hxx"
69 #include "viewdata.hxx"
70 #include "document.hxx"
71 #include "drawview.hxx"
72 #include "viewutil.hxx"
73 #include "scresid.hxx"
74 #include "tabvwsh.hxx"
75 #include <gridwin.hxx>
77 #define ScDrawTextObjectBar
78 #include "scslots.hxx"
80 #include <boost/scoped_ptr.hpp>
82 using namespace ::com::sun::star
;
84 SFX_IMPL_INTERFACE(ScDrawTextObjectBar
, SfxShell
)
86 void ScDrawTextObjectBar::InitInterface_Impl()
88 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT
|SFX_VISIBILITY_STANDARD
|SFX_VISIBILITY_SERVER
,
91 GetStaticInterface()->RegisterPopupMenu(ScResId(RID_POPUP_DRAWTEXT
));
93 GetStaticInterface()->RegisterChildWindow(ScGetFontWorkId());
96 TYPEINIT1( ScDrawTextObjectBar
, SfxShell
);
98 // abschalten der nicht erwuenschten Acceleratoren:
100 void ScDrawTextObjectBar::StateDisableItems( SfxItemSet
&rSet
)
102 SfxWhichIter
aIter(rSet
);
103 sal_uInt16 nWhich
= aIter
.FirstWhich();
107 rSet
.DisableItem( nWhich
);
108 nWhich
= aIter
.NextWhich();
112 ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData
* pData
) :
113 SfxShell(pData
->GetViewShell()),
116 bPastePossible(false)
118 SetPool( pViewData
->GetScDrawView()->GetDefaultAttr().GetPool() );
120 // UndoManager wird beim Umschalten in den Edit-Modus umgesetzt...
121 ::svl::IUndoManager
* pMgr
= pViewData
->GetSfxDocShell()->GetUndoManager();
122 SetUndoManager( pMgr
);
123 if ( !pViewData
->GetDocument()->IsUndoEnabled() )
125 pMgr
->SetMaxUndoActionCount( 0 );
128 SetHelpId( HID_SCSHELL_DRTXTOB
);
129 SetName(OUString("DrawText"));
130 SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawText
));
133 ScDrawTextObjectBar::~ScDrawTextObjectBar()
137 pClipEvtLstnr
->AddRemoveListener( pViewData
->GetActiveWin(), false );
139 // The listener may just now be waiting for the SolarMutex and call the link
140 // afterwards, in spite of RemoveListener. So the link has to be reset, too.
141 pClipEvtLstnr
->ClearCallbackLink();
143 pClipEvtLstnr
->release();
149 void ScDrawTextObjectBar::Execute( SfxRequest
&rReq
)
151 ScDrawView
* pView
= pViewData
->GetScDrawView();
152 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
153 Outliner
* pOutliner
= pView
->GetTextEditOutliner();
155 if (!pOutView
|| !pOutliner
)
157 ExecuteGlobal( rReq
); // auf ganze Objekte
161 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
162 sal_uInt16 nSlot
= rReq
.GetSlot();
174 pOutView
->PasteSpecial();
177 case SID_CLIPBOARD_FORMAT_ITEMS
:
179 SotClipboardFormatId nFormat
= SotClipboardFormatId::NONE
;
180 const SfxPoolItem
* pItem
;
182 pReqArgs
->GetItemState(nSlot
, true, &pItem
) == SfxItemState::SET
&&
183 pItem
->ISA(SfxUInt32Item
) )
185 nFormat
= static_cast<SotClipboardFormatId
>(static_cast<const SfxUInt32Item
*>(pItem
)->GetValue());
188 if ( nFormat
!= SotClipboardFormatId::NONE
)
190 if (nFormat
== SotClipboardFormatId::STRING
)
193 pOutView
->PasteSpecial();
198 case SID_PASTE_SPECIAL
:
199 ExecutePasteContents( rReq
);
204 sal_Int32 nCount
= pOutliner
->GetParagraphCount();
205 ESelection
aSel( 0,0,nCount
,0 );
206 pOutView
->SetSelection( aSel
);
212 const SvxFontItem
& rItem
= static_cast<const SvxFontItem
&>(
213 pOutView
->GetAttribs().Get(EE_CHAR_FONTINFO
));
216 SvxFontItem
aNewItem( EE_CHAR_FONTINFO
);
218 const SfxItemSet
*pArgs
= rReq
.GetArgs();
219 const SfxPoolItem
* pItem
= 0;
221 pArgs
->GetItemState(GetPool().GetWhich(SID_CHARMAP
), false, &pItem
);
225 aString
= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
226 const SfxPoolItem
* pFtItem
= NULL
;
227 pArgs
->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR
), false, &pFtItem
);
228 const SfxStringItem
* pFontItem
= PTR_CAST( SfxStringItem
, pFtItem
);
231 OUString
aFontName(pFontItem
->GetValue());
232 vcl::Font
aFont(aFontName
, Size(1,1)); // Size nur wg. CTOR
233 aNewItem
= SvxFontItem( aFont
.GetFamily(), aFont
.GetName(),
234 aFont
.GetStyleName(), aFont
.GetPitch(),
235 aFont
.GetCharSet(), ATTR_FONT
);
241 ScViewUtil::ExecuteCharMap( rItem
, *pViewData
->GetViewShell()->GetViewFrame(), aNewItem
, aString
);
243 if ( !aString
.isEmpty() )
245 SfxItemSet
aSet( pOutliner
->GetEmptyItemSet() );
246 aSet
.Put( aNewItem
);
247 // SetAttribs an der View selektiert ein Wort, wenn nichts selektiert ist
248 pOutView
->GetOutliner()->QuickSetAttribs( aSet
, pOutView
->GetSelection() );
249 pOutView
->InsertText(aString
);
252 Invalidate( SID_ATTR_CHAR_FONT
);
256 case SID_HYPERLINK_SETLINK
:
259 const SfxPoolItem
* pItem
;
260 if ( pReqArgs
->GetItemState( SID_HYPERLINK_SETLINK
, true, &pItem
) == SfxItemState::SET
)
262 const SvxHyperlinkItem
* pHyper
= static_cast<const SvxHyperlinkItem
*>(pItem
);
263 const OUString
& rName
= pHyper
->GetName();
264 const OUString
& rURL
= pHyper
->GetURL();
265 const OUString
& rTarget
= pHyper
->GetTargetFrame();
266 SvxLinkInsertMode eMode
= pHyper
->GetInsertMode();
269 if ( pOutView
&& ( eMode
== HLINK_DEFAULT
|| eMode
== HLINK_FIELD
) )
271 const SvxFieldItem
* pFieldItem
= pOutView
->GetFieldAtSelection();
274 const SvxFieldData
* pField
= pFieldItem
->GetField();
275 if ( pField
&& pField
->ISA(SvxURLField
) )
277 // altes Feld selektieren
279 ESelection aSel
= pOutView
->GetSelection();
281 aSel
.nEndPara
= aSel
.nStartPara
;
282 aSel
.nEndPos
= aSel
.nStartPos
+ 1;
283 pOutView
->SetSelection( aSel
);
287 // neues Feld einfuegen
289 SvxURLField
aURLField( rURL
, rName
, SVXURLFORMAT_REPR
);
290 aURLField
.SetTargetFrame( rTarget
);
291 SvxFieldItem
aURLItem( aURLField
, EE_FEATURE_FIELD
);
292 pOutView
->InsertField( aURLItem
);
296 ESelection aSel
= pOutView
->GetSelection();
297 if ( aSel
.nStartPos
== aSel
.nEndPos
&& aSel
.nStartPos
> 0 )
299 // Cursor is behind the inserted field -> extend selection to the left
302 pOutView
->SetSelection( aSel
);
309 ExecuteGlobal( rReq
); // normal an der View
311 // InsertURL an der ViewShell schaltet bei "Text" die DrawShell ab !!!
316 case SID_OPEN_HYPERLINK
:
320 const SvxFieldItem
* pFieldItem
= pOutView
->GetFieldAtSelection();
323 const SvxFieldData
* pField
= pFieldItem
->GetField();
324 if( pField
&& pField
->ISA( SvxURLField
) )
326 const SvxURLField
* pURLField
= static_cast< const SvxURLField
* >( pField
);
327 ScGlobal::OpenURL( pURLField
->GetURL(), pURLField
->GetTargetFrame() );
334 case SID_ENABLE_HYPHENATION
:
335 case SID_TEXTDIRECTION_LEFT_TO_RIGHT
:
336 case SID_TEXTDIRECTION_TOP_TO_BOTTOM
:
337 pView
->ScEndTextEdit(); // end text edit before switching direction
338 ExecuteGlobal( rReq
);
339 // restore consistent state between shells and functions:
340 pViewData
->GetDispatcher().Execute(SID_OBJECT_SELECT
, SfxCallMode::SLOT
| SfxCallMode::RECORD
);
345 OUString aReplaceText
;
346 SFX_REQUEST_ARG( rReq
, pItem2
, SfxStringItem
, SID_THES
, false );
348 aReplaceText
= pItem2
->GetValue();
349 if (!aReplaceText
.isEmpty())
350 ReplaceTextWithSynonym( pOutView
->GetEditView(), aReplaceText
);
356 pOutView
->StartThesaurus();
363 void ScDrawTextObjectBar::GetState( SfxItemSet
& rSet
)
365 SfxViewFrame
* pViewFrm
= pViewData
->GetViewShell()->GetViewFrame();
366 bool bHasFontWork
= pViewFrm
->HasChildWindow(SID_FONTWORK
);
367 bool bDisableFontWork
= false;
371 // #i21255# notes now support rich text formatting (#i74140# but not fontwork)
372 bDisableFontWork
= true;
375 if ( bDisableFontWork
)
376 rSet
.DisableItem( SID_FONTWORK
);
378 rSet
.Put(SfxBoolItem(SID_FONTWORK
, bHasFontWork
));
380 if ( rSet
.GetItemState( SID_HYPERLINK_GETLINK
) != SfxItemState::UNKNOWN
)
382 SvxHyperlinkItem aHLinkItem
;
383 SdrView
* pView
= pViewData
->GetScDrawView();
384 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
388 const SvxFieldItem
* pFieldItem
= pOutView
->GetFieldAtSelection();
391 const SvxFieldData
* pField
= pFieldItem
->GetField();
392 if ( pField
&& pField
->ISA(SvxURLField
) )
394 const SvxURLField
* pURLField
= static_cast<const SvxURLField
*>(pField
);
395 aHLinkItem
.SetName( pURLField
->GetRepresentation() );
396 aHLinkItem
.SetURL( pURLField
->GetURL() );
397 aHLinkItem
.SetTargetFrame( pURLField
->GetTargetFrame() );
403 // use selected text as name for urls
404 OUString sReturn
= pOutView
->GetSelected();
405 sal_Int32 nLen
= std::min
<sal_Int32
>(sReturn
.getLength(), 255);
406 sReturn
= sReturn
.copy(0, nLen
);
407 aHLinkItem
.SetName(comphelper::string::stripEnd(sReturn
, ' '));
410 rSet
.Put(aHLinkItem
);
413 if ( rSet
.GetItemState( SID_OPEN_HYPERLINK
) != SfxItemState::UNKNOWN
)
415 SdrView
* pView
= pViewData
->GetScDrawView();
416 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
417 bool bEnable
= false;
420 const SvxFieldItem
* pFieldItem
= pOutView
->GetFieldAtSelection();
423 const SvxFieldData
* pField
= pFieldItem
->GetField();
424 bEnable
= pField
&& pField
->ISA( SvxURLField
);
428 rSet
.DisableItem( SID_OPEN_HYPERLINK
);
431 if( rSet
.GetItemState( SID_TRANSLITERATE_HALFWIDTH
) != SfxItemState::UNKNOWN
)
432 ScViewUtil::HideDisabledSlot( rSet
, pViewFrm
->GetBindings(), SID_TRANSLITERATE_HALFWIDTH
);
433 if( rSet
.GetItemState( SID_TRANSLITERATE_FULLWIDTH
) != SfxItemState::UNKNOWN
)
434 ScViewUtil::HideDisabledSlot( rSet
, pViewFrm
->GetBindings(), SID_TRANSLITERATE_FULLWIDTH
);
435 if( rSet
.GetItemState( SID_TRANSLITERATE_HIRAGANA
) != SfxItemState::UNKNOWN
)
436 ScViewUtil::HideDisabledSlot( rSet
, pViewFrm
->GetBindings(), SID_TRANSLITERATE_HIRAGANA
);
437 if( rSet
.GetItemState( SID_TRANSLITERATE_KATAGANA
) != SfxItemState::UNKNOWN
)
438 ScViewUtil::HideDisabledSlot( rSet
, pViewFrm
->GetBindings(), SID_TRANSLITERATE_KATAGANA
);
440 if ( rSet
.GetItemState( SID_ENABLE_HYPHENATION
) != SfxItemState::UNKNOWN
)
442 SdrView
* pView
= pViewData
->GetScDrawView();
443 SfxItemSet
aAttrs( pView
->GetModel()->GetItemPool() );
444 pView
->GetAttributes( aAttrs
);
445 if( aAttrs
.GetItemState( EE_PARA_HYPHENATE
) >= SfxItemState::DEFAULT
)
447 bool bValue
= static_cast<const SfxBoolItem
&>( aAttrs
.Get( EE_PARA_HYPHENATE
) ).GetValue();
448 rSet
.Put( SfxBoolItem( SID_ENABLE_HYPHENATION
, bValue
) );
452 if ( rSet
.GetItemState( SID_THES
) != SfxItemState::UNKNOWN
||
453 rSet
.GetItemState( SID_THESAURUS
) != SfxItemState::UNKNOWN
)
455 SdrView
* pView
= pViewData
->GetScDrawView();
456 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
459 LanguageType nLang
= LANGUAGE_NONE
;
460 bool bIsLookUpWord
= false;
463 EditView
& rEditView
= pOutView
->GetEditView();
464 bIsLookUpWord
= GetStatusValueForThesaurusFromContext( aStatusVal
, nLang
, rEditView
);
466 rSet
.Put( SfxStringItem( SID_THES
, aStatusVal
) );
468 // disable thesaurus main menu and context menu entry if there is nothing to look up
469 bool bCanDoThesaurus
= ScModule::HasThesaurusLanguage( nLang
);
470 if (!bIsLookUpWord
|| !bCanDoThesaurus
)
471 rSet
.DisableItem( SID_THES
);
472 if (!bCanDoThesaurus
)
473 rSet
.DisableItem( SID_THESAURUS
);
477 IMPL_LINK( ScDrawTextObjectBar
, ClipboardChanged
, TransferableDataHelper
*, pDataHelper
)
481 bPastePossible
= ( pDataHelper
->HasFormat( SotClipboardFormatId::STRING
) || pDataHelper
->HasFormat( SotClipboardFormatId::RTF
) );
483 SfxBindings
& rBindings
= pViewData
->GetBindings();
484 rBindings
.Invalidate( SID_PASTE
);
485 rBindings
.Invalidate( SID_PASTE_SPECIAL
);
486 rBindings
.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS
);
491 void ScDrawTextObjectBar::GetClipState( SfxItemSet
& rSet
)
493 SdrView
* pView
= pViewData
->GetScDrawView();
494 if ( !pView
->GetTextEditOutlinerView() )
496 GetGlobalClipState( rSet
);
500 if ( !pClipEvtLstnr
)
503 pClipEvtLstnr
= new TransferableClipboardListener( LINK( this, ScDrawTextObjectBar
, ClipboardChanged
) );
504 pClipEvtLstnr
->acquire();
505 vcl::Window
* pWin
= pViewData
->GetActiveWin();
506 pClipEvtLstnr
->AddRemoveListener( pWin
, true );
509 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData
->GetActiveWin() ) );
510 bPastePossible
= ( aDataHelper
.HasFormat( SotClipboardFormatId::STRING
) || aDataHelper
.HasFormat( SotClipboardFormatId::RTF
) );
513 SfxWhichIter
aIter( rSet
);
514 sal_uInt16 nWhich
= aIter
.FirstWhich();
520 case SID_PASTE_SPECIAL
:
521 if( !bPastePossible
)
522 rSet
.DisableItem( nWhich
);
524 case SID_CLIPBOARD_FORMAT_ITEMS
:
525 if ( bPastePossible
)
527 SvxClipboardFormatItem
aFormats( SID_CLIPBOARD_FORMAT_ITEMS
);
528 TransferableDataHelper
aDataHelper(
529 TransferableDataHelper::CreateFromSystemClipboard( pViewData
->GetActiveWin() ) );
531 if ( aDataHelper
.HasFormat( SotClipboardFormatId::STRING
) )
532 aFormats
.AddClipbrdFormat( SotClipboardFormatId::STRING
);
533 if ( aDataHelper
.HasFormat( SotClipboardFormatId::RTF
) )
534 aFormats
.AddClipbrdFormat( SotClipboardFormatId::RTF
);
536 rSet
.Put( aFormats
);
539 rSet
.DisableItem( nWhich
);
542 nWhich
= aIter
.NextWhich();
548 void ScDrawTextObjectBar::ExecuteToggle( SfxRequest
&rReq
)
552 SdrView
* pView
= pViewData
->GetScDrawView();
554 sal_uInt16 nSlot
= rReq
.GetSlot();
556 SfxItemSet
aSet( pView
->GetDefaultAttr() );
558 SfxItemSet
aViewAttr(pView
->GetModel()->GetItemPool());
559 pView
->GetAttributes(aViewAttr
);
562 FontUnderline eOld
= static_cast<const SvxUnderlineItem
&>( aViewAttr
.
563 Get(EE_CHAR_UNDERLINE
)).GetLineStyle();
564 FontUnderline eNew
= eOld
;
567 case SID_ULINE_VAL_NONE
:
568 eNew
= UNDERLINE_NONE
;
570 case SID_ULINE_VAL_SINGLE
:
571 eNew
= ( eOld
== UNDERLINE_SINGLE
) ? UNDERLINE_NONE
: UNDERLINE_SINGLE
;
573 case SID_ULINE_VAL_DOUBLE
:
574 eNew
= ( eOld
== UNDERLINE_DOUBLE
) ? UNDERLINE_NONE
: UNDERLINE_DOUBLE
;
576 case SID_ULINE_VAL_DOTTED
:
577 eNew
= ( eOld
== UNDERLINE_DOTTED
) ? UNDERLINE_NONE
: UNDERLINE_DOTTED
;
582 aSet
.Put( SvxUnderlineItem( eNew
, EE_CHAR_UNDERLINE
) );
584 pView
->SetAttributes( aSet
);
586 pViewData
->GetScDrawView()->InvalidateDrawTextAttrs();
589 static void lcl_RemoveFields( OutlinerView
& rOutView
)
591 //! Outliner should have RemoveFields with a selection
593 Outliner
* pOutliner
= rOutView
.GetOutliner();
594 if (!pOutliner
) return;
596 ESelection aOldSel
= rOutView
.GetSelection();
597 ESelection aSel
= aOldSel
;
599 sal_Int32 nNewEnd
= aSel
.nEndPos
;
601 bool bUpdate
= pOutliner
->GetUpdateMode();
602 bool bChanged
= false;
604 //! GetPortions and GetAttribs should be const!
605 EditEngine
& rEditEng
= (EditEngine
&)pOutliner
->GetEditEngine();
607 sal_Int32 nParCount
= pOutliner
->GetParagraphCount();
608 for (sal_Int32 nPar
=0; nPar
<nParCount
; nPar
++)
609 if ( nPar
>= aSel
.nStartPara
&& nPar
<= aSel
.nEndPara
)
611 std::vector
<sal_Int32
> aPortions
;
612 rEditEng
.GetPortions( nPar
, aPortions
);
614 for ( size_t nPos
= aPortions
.size(); nPos
; )
617 sal_Int32 nEnd
= aPortions
[ nPos
];
618 sal_Int32 nStart
= nPos
? aPortions
[ nPos
- 1 ] : 0;
619 // fields are single characters
620 if ( nEnd
== nStart
+1 &&
621 ( nPar
> aSel
.nStartPara
|| nStart
>= aSel
.nStartPos
) &&
622 ( nPar
< aSel
.nEndPara
|| nEnd
<= aSel
.nEndPos
) )
624 ESelection
aFieldSel( nPar
, nStart
, nPar
, nEnd
);
625 SfxItemSet aSet
= rEditEng
.GetAttribs( aFieldSel
);
626 if ( aSet
.GetItemState( EE_FEATURE_FIELD
) == SfxItemState::SET
)
631 pOutliner
->SetUpdateMode( false );
632 OUString aName
= ScGlobal::GetRscString( STR_UNDO_DELETECONTENTS
);
633 pOutliner
->GetUndoManager().EnterListAction( aName
, aName
);
637 OUString aFieldText
= rEditEng
.GetText( aFieldSel
);
638 pOutliner
->QuickInsertText( aFieldText
, aFieldSel
);
639 if ( nPar
== aSel
.nEndPara
)
641 nNewEnd
= nNewEnd
+ aFieldText
.getLength();
649 if (bUpdate
&& bChanged
)
651 pOutliner
->GetUndoManager().LeaveListAction();
652 pOutliner
->SetUpdateMode( true );
655 if ( aOldSel
.IsEqual( aSel
) ) // aSel is adjusted
656 aOldSel
.nEndPos
= nNewEnd
;
658 aOldSel
.nStartPos
= nNewEnd
; // if aOldSel is backwards
659 rOutView
.SetSelection( aOldSel
);
662 void ScDrawTextObjectBar::ExecuteAttr( SfxRequest
&rReq
)
664 SdrView
* pView
= pViewData
->GetScDrawView();
665 const SfxItemSet
* pArgs
= rReq
.GetArgs();
666 sal_uInt16 nSlot
= rReq
.GetSlot();
668 SfxItemSet
aEditAttr( pView
->GetModel()->GetItemPool() );
669 pView
->GetAttributes( aEditAttr
);
670 SfxItemSet
aNewAttr( *aEditAttr
.GetPool(), aEditAttr
.GetRanges() );
676 case SID_ALIGN_ANY_LEFT
:
677 case SID_ATTR_PARA_ADJUST_LEFT
:
678 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_LEFT
, EE_PARA_JUST
) );
681 case SID_ALIGNCENTERHOR
:
682 case SID_ALIGN_ANY_HCENTER
:
683 case SID_ATTR_PARA_ADJUST_CENTER
:
684 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_CENTER
, EE_PARA_JUST
) );
688 case SID_ALIGN_ANY_RIGHT
:
689 case SID_ATTR_PARA_ADJUST_RIGHT
:
690 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_RIGHT
, EE_PARA_JUST
) );
694 case SID_ALIGN_ANY_JUSTIFIED
:
695 case SID_ATTR_PARA_ADJUST_BLOCK
:
696 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_BLOCK
, EE_PARA_JUST
) );
699 case SID_ATTR_PARA_LINESPACE_10
:
701 SvxLineSpacingItem
aItem( SVX_LINESPACE_ONE_LINE
, EE_PARA_SBL
);
702 aItem
.SetPropLineSpace( 100 );
703 aNewAttr
.Put( aItem
);
707 case SID_ATTR_PARA_LINESPACE_15
:
709 SvxLineSpacingItem
aItem( SVX_LINESPACE_ONE_POINT_FIVE_LINES
, EE_PARA_SBL
);
710 aItem
.SetPropLineSpace( 150 );
711 aNewAttr
.Put( aItem
);
715 case SID_ATTR_PARA_LINESPACE_20
:
717 SvxLineSpacingItem
aItem( SVX_LINESPACE_TWO_LINES
, EE_PARA_SBL
);
718 aItem
.SetPropLineSpace( 200 );
719 aNewAttr
.Put( aItem
);
723 case SID_SET_SUPER_SCRIPT
:
725 SvxEscapementItem
aItem(EE_CHAR_ESCAPEMENT
);
726 SvxEscapement eEsc
= (SvxEscapement
) static_cast<const SvxEscapementItem
&>(
727 aEditAttr
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
729 if( eEsc
== SVX_ESCAPEMENT_SUPERSCRIPT
)
730 aItem
.SetEscapement( SVX_ESCAPEMENT_OFF
);
732 aItem
.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT
);
733 aNewAttr
.Put( aItem
);
737 case SID_SET_SUB_SCRIPT
:
739 SvxEscapementItem
aItem(EE_CHAR_ESCAPEMENT
);
740 SvxEscapement eEsc
= (SvxEscapement
) static_cast<const SvxEscapementItem
&>(
741 aEditAttr
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
743 if( eEsc
== SVX_ESCAPEMENT_SUBSCRIPT
)
744 aItem
.SetEscapement( SVX_ESCAPEMENT_OFF
);
746 aItem
.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT
);
747 aNewAttr
.Put( aItem
);
751 case SID_TABLE_VERT_NONE
:
752 case SID_TABLE_VERT_CENTER
:
753 case SID_TABLE_VERT_BOTTOM
:
755 SdrTextVertAdjust eTVA
= SDRTEXTVERTADJUST_TOP
;
756 if (nSlot
== SID_TABLE_VERT_CENTER
)
757 eTVA
= SDRTEXTVERTADJUST_CENTER
;
758 else if (nSlot
== SID_TABLE_VERT_BOTTOM
)
759 eTVA
= SDRTEXTVERTADJUST_BOTTOM
;
760 aNewAttr
.Put(SdrTextVertAdjustItem(eTVA
));
764 case SID_PARASPACE_INCREASE
:
765 case SID_PARASPACE_DECREASE
:
767 SvxULSpaceItem
aULSpace(
768 static_cast< const SvxULSpaceItem
& >( aEditAttr
.Get( EE_PARA_ULSPACE
) ) );
769 sal_uInt16 nUpper
= aULSpace
.GetUpper();
770 sal_uInt16 nLower
= aULSpace
.GetLower();
772 if ( nSlot
== SID_PARASPACE_INCREASE
)
779 nUpper
= std::max
< sal_Int16
>( nUpper
- 100, 0 );
780 nLower
= std::max
< sal_Int16
>( nLower
- 100, 0 );
783 aULSpace
.SetUpper( nUpper
);
784 aULSpace
.SetLower( nLower
);
785 aNewAttr
.Put( aULSpace
);
794 bool bArgsInReq
= ( pArgs
!= NULL
);
800 case SID_TEXT_STANDARD
: // Harte Textattributierung loeschen
802 OutlinerView
* pOutView
= pView
->IsTextEdit() ?
803 pView
->GetTextEditOutlinerView() : NULL
;
805 pOutView
->Paint( Rectangle() );
807 SfxItemSet
aEmptyAttr( *aEditAttr
.GetPool(), EE_ITEMS_START
, EE_ITEMS_END
);
808 pView
->SetAttributes( aEmptyAttr
, true );
812 lcl_RemoveFields( *pOutView
);
813 pOutView
->ShowCursor();
816 rReq
.Done( aEmptyAttr
);
817 pViewData
->GetScDrawView()->InvalidateDrawTextAttrs();
818 bDone
= false; // bereits hier passiert
822 case SID_CHAR_DLG_EFFECT
:
823 case SID_CHAR_DLG
: // Dialog-Button
824 case SID_ATTR_CHAR_FONT
: // Controller nicht angezeigt
825 case SID_ATTR_CHAR_FONTHEIGHT
:
826 bDone
= ExecuteCharDlg( aEditAttr
, aNewAttr
, nSlot
);
830 bDone
= ExecuteParaDlg( aEditAttr
, aNewAttr
);
833 case SID_ATTR_CHAR_WEIGHT
:
834 aNewAttr
.Put( static_cast<const SvxWeightItem
&>(aEditAttr
.Get( EE_CHAR_WEIGHT
)) );
837 case SID_ATTR_CHAR_POSTURE
:
838 aNewAttr
.Put( static_cast<const SvxPostureItem
&>(aEditAttr
.Get( EE_CHAR_ITALIC
)) );
841 case SID_ATTR_CHAR_UNDERLINE
:
842 aNewAttr
.Put( static_cast<const SvxUnderlineItem
&>(aEditAttr
.Get( EE_CHAR_UNDERLINE
)) );
845 case SID_ATTR_CHAR_OVERLINE
:
846 aNewAttr
.Put( static_cast<const SvxOverlineItem
&>(aEditAttr
.Get( EE_CHAR_OVERLINE
)) );
849 case SID_ATTR_CHAR_CONTOUR
:
850 aNewAttr
.Put( static_cast<const SvxContourItem
&>(aEditAttr
.Get( EE_CHAR_OUTLINE
)) );
853 case SID_ATTR_CHAR_SHADOWED
:
854 aNewAttr
.Put( static_cast<const SvxShadowedItem
&>(aEditAttr
.Get( EE_CHAR_SHADOW
)) );
857 case SID_ATTR_CHAR_STRIKEOUT
:
858 aNewAttr
.Put( static_cast<const SvxCrossedOutItem
&>(aEditAttr
.Get( EE_CHAR_STRIKEOUT
)) );
861 case SID_DRAWTEXT_ATTR_DLG
:
863 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
864 boost::scoped_ptr
<SfxAbstractTabDialog
> pDlg(pFact
->CreateTextTabDialog( pViewData
->GetDialogParent(), &aEditAttr
, pView
));
866 bDone
= ( RET_OK
== pDlg
->Execute() );
869 aNewAttr
.Put( *pDlg
->GetOutputItemSet() );
873 SfxBindings
& rBindings
= pViewData
->GetBindings();
874 rBindings
.Invalidate( SID_TABLE_VERT_NONE
);
875 rBindings
.Invalidate( SID_TABLE_VERT_CENTER
);
876 rBindings
.Invalidate( SID_TABLE_VERT_BOTTOM
);
884 rReq
.Done( aNewAttr
);
885 pArgs
= rReq
.GetArgs();
891 ( nSlot
== SID_ATTR_CHAR_FONT
|| nSlot
== SID_ATTR_CHAR_FONTHEIGHT
||
892 nSlot
== SID_ATTR_CHAR_WEIGHT
|| nSlot
== SID_ATTR_CHAR_POSTURE
) )
894 // font items from toolbox controller have to be applied for the right script type
896 // #i78017 establish the same behaviour as in Writer
897 SvtScriptType nScript
= SvtScriptType::LATIN
| SvtScriptType::ASIAN
| SvtScriptType::COMPLEX
;
898 if (nSlot
== SID_ATTR_CHAR_FONT
)
899 nScript
= pView
->GetScriptType();
901 SfxItemPool
& rPool
= GetPool();
902 SvxScriptSetItem
aSetItem( nSlot
, rPool
);
903 sal_uInt16 nWhich
= rPool
.GetWhich( nSlot
);
904 aSetItem
.PutItemForScriptType( nScript
, pArgs
->Get( nWhich
) );
906 pView
->SetAttributes( aSetItem
.GetItemSet() );
908 else if( nSlot
== SID_ATTR_PARA_LRSPACE
)
910 sal_uInt16 nId
= SID_ATTR_PARA_LRSPACE
;
911 const SvxLRSpaceItem
& rItem
= static_cast<const SvxLRSpaceItem
&>(
913 SfxItemSet
aAttr( GetPool(), EE_PARA_LRSPACE
, EE_PARA_LRSPACE
);
914 nId
= EE_PARA_LRSPACE
;
915 SvxLRSpaceItem
aLRSpaceItem( rItem
.GetLeft(),
916 rItem
.GetRight(), rItem
.GetTextLeft(),
917 rItem
.GetTextFirstLineOfst(), nId
);
918 aAttr
.Put( aLRSpaceItem
);
919 pView
->SetAttributes( aAttr
);
921 else if( nSlot
== SID_ATTR_PARA_LINESPACE
)
923 SvxLineSpacingItem aLineSpaceItem
= static_cast<const SvxLineSpacingItem
&>(pArgs
->Get(
924 GetPool().GetWhich(nSlot
)));
925 SfxItemSet
aAttr( GetPool(), EE_PARA_SBL
, EE_PARA_SBL
);
926 aAttr
.Put( aLineSpaceItem
);
927 pView
->SetAttributes( aAttr
);
929 else if( nSlot
== SID_ATTR_PARA_ULSPACE
)
931 SvxULSpaceItem aULSpaceItem
= static_cast<const SvxULSpaceItem
&>(pArgs
->Get(
932 GetPool().GetWhich(nSlot
)));
933 SfxItemSet
aAttr( GetPool(), EE_PARA_ULSPACE
, EE_PARA_ULSPACE
);
934 aULSpaceItem
.SetWhich(EE_PARA_ULSPACE
);
935 aAttr
.Put( aULSpaceItem
);
936 pView
->SetAttributes( aAttr
);
941 pView
->SetAttributes( *pArgs
);
943 pViewData
->GetScDrawView()->InvalidateDrawTextAttrs();
947 void ScDrawTextObjectBar::GetAttrState( SfxItemSet
& rDestSet
)
951 // issue 21255 - Notes now support rich text formatting.
954 SvtLanguageOptions aLangOpt
;
955 bool bDisableCTLFont
= !aLangOpt
.IsCTLFontEnabled();
956 bool bDisableVerticalText
= !aLangOpt
.IsVerticalTextEnabled();
958 SdrView
* pView
= pViewData
->GetScDrawView();
959 SfxItemSet
aAttrSet(pView
->GetModel()->GetItemPool());
960 pView
->GetAttributes(aAttrSet
);
964 rDestSet
.Put( aAttrSet
);
966 // choose font info according to selection script type
968 SvtScriptType nScript
= pView
->GetScriptType();
970 // #i55929# input-language-dependent script type (depends on input language if nothing selected)
971 SvtScriptType nInputScript
= nScript
;
972 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
973 if (pOutView
&& !pOutView
->GetSelection().HasRange())
975 LanguageType nInputLang
= pViewData
->GetActiveWin()->GetInputLanguage();
976 if (nInputLang
!= LANGUAGE_DONTKNOW
&& nInputLang
!= LANGUAGE_SYSTEM
)
977 nInputScript
= SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang
);
980 // #i55929# according to spec, nInputScript is used for font and font height only
981 if ( rDestSet
.GetItemState( EE_CHAR_FONTINFO
) != SfxItemState::UNKNOWN
)
982 ScViewUtil::PutItemScript( rDestSet
, aAttrSet
, EE_CHAR_FONTINFO
, nInputScript
);
983 if ( rDestSet
.GetItemState( EE_CHAR_FONTHEIGHT
) != SfxItemState::UNKNOWN
)
984 ScViewUtil::PutItemScript( rDestSet
, aAttrSet
, EE_CHAR_FONTHEIGHT
, nInputScript
);
985 if ( rDestSet
.GetItemState( EE_CHAR_WEIGHT
) != SfxItemState::UNKNOWN
)
986 ScViewUtil::PutItemScript( rDestSet
, aAttrSet
, EE_CHAR_WEIGHT
, nScript
);
987 if ( rDestSet
.GetItemState( EE_CHAR_ITALIC
) != SfxItemState::UNKNOWN
)
988 ScViewUtil::PutItemScript( rDestSet
, aAttrSet
, EE_CHAR_ITALIC
, nScript
);
991 SvxAdjust eAdj
= static_cast<const SvxAdjustItem
&>(aAttrSet
.Get(EE_PARA_JUST
)).GetAdjust();
994 case SVX_ADJUST_LEFT
:
996 rDestSet
.Put( SfxBoolItem( SID_ALIGNLEFT
, true ) );
997 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT
, true ) );
1000 case SVX_ADJUST_CENTER
:
1002 rDestSet
.Put( SfxBoolItem( SID_ALIGNCENTERHOR
, true ) );
1003 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER
, true ) );
1006 case SVX_ADJUST_RIGHT
:
1008 rDestSet
.Put( SfxBoolItem( SID_ALIGNRIGHT
, true ) );
1009 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT
, true ) );
1012 case SVX_ADJUST_BLOCK
:
1014 rDestSet
.Put( SfxBoolItem( SID_ALIGNBLOCK
, true ) );
1015 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK
, true ) );
1020 // added to avoid warnings
1023 // pseudo slots for Format menu
1024 rDestSet
.Put( SfxBoolItem( SID_ALIGN_ANY_LEFT
, eAdj
== SVX_ADJUST_LEFT
) );
1025 rDestSet
.Put( SfxBoolItem( SID_ALIGN_ANY_HCENTER
, eAdj
== SVX_ADJUST_CENTER
) );
1026 rDestSet
.Put( SfxBoolItem( SID_ALIGN_ANY_RIGHT
, eAdj
== SVX_ADJUST_RIGHT
) );
1027 rDestSet
.Put( SfxBoolItem( SID_ALIGN_ANY_JUSTIFIED
, eAdj
== SVX_ADJUST_BLOCK
) );
1029 SvxLRSpaceItem aLR
= static_cast<const SvxLRSpaceItem
&>(aAttrSet
.Get( EE_PARA_LRSPACE
));
1030 aLR
.SetWhich(SID_ATTR_PARA_LRSPACE
);
1032 Invalidate( SID_ATTR_PARA_LRSPACE
);
1033 SfxItemState eState
= aAttrSet
.GetItemState( EE_PARA_LRSPACE
);
1034 if ( eState
== SfxItemState::DONTCARE
)
1035 rDestSet
.InvalidateItem(SID_ATTR_PARA_LRSPACE
);
1036 //xuxu for Line Space
1037 SvxLineSpacingItem aLineSP
= static_cast<const SvxLineSpacingItem
&>(aAttrSet
.
1038 Get( EE_PARA_SBL
));
1039 aLineSP
.SetWhich(SID_ATTR_PARA_LINESPACE
);
1040 rDestSet
.Put(aLineSP
);
1041 Invalidate(SID_ATTR_PARA_LINESPACE
);
1042 eState
= aAttrSet
.GetItemState( EE_PARA_SBL
);
1043 if ( eState
== SfxItemState::DONTCARE
)
1044 rDestSet
.InvalidateItem(SID_ATTR_PARA_LINESPACE
);
1046 SvxULSpaceItem aULSP
= static_cast<const SvxULSpaceItem
&>(aAttrSet
.
1047 Get( EE_PARA_ULSPACE
));
1048 aULSP
.SetWhich(SID_ATTR_PARA_ULSPACE
);
1049 rDestSet
.Put(aULSP
);
1050 Invalidate(SID_ATTR_PARA_ULSPACE
);
1051 Invalidate(SID_PARASPACE_INCREASE
);
1052 Invalidate(SID_PARASPACE_DECREASE
);
1053 eState
= aAttrSet
.GetItemState( EE_PARA_ULSPACE
);
1054 if( eState
>= SfxItemState::DEFAULT
)
1056 if ( !aULSP
.GetUpper() && !aULSP
.GetLower() )
1057 rDestSet
.DisableItem( SID_PARASPACE_DECREASE
);
1061 rDestSet
.DisableItem( SID_PARASPACE_INCREASE
);
1062 rDestSet
.DisableItem( SID_PARASPACE_DECREASE
);
1063 rDestSet
.InvalidateItem(SID_ATTR_PARA_ULSPACE
);
1068 sal_uInt16 nLineSpace
= (sal_uInt16
)
1069 static_cast<const SvxLineSpacingItem
&>(aAttrSet
.
1070 Get( EE_PARA_SBL
)).GetPropLineSpace();
1071 switch( nLineSpace
)
1074 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_10
, true ) );
1077 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_15
, true ) );
1080 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_20
, true ) );
1084 // hoch-/tiefgestellt
1086 SvxEscapement eEsc
= (SvxEscapement
) static_cast<const SvxEscapementItem
&>(
1087 aAttrSet
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
1088 if( eEsc
== SVX_ESCAPEMENT_SUPERSCRIPT
)
1089 rDestSet
.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT
, true ) );
1090 else if( eEsc
== SVX_ESCAPEMENT_SUBSCRIPT
)
1091 rDestSet
.Put( SfxBoolItem( SID_SET_SUB_SCRIPT
, true ) );
1095 eState
= aAttrSet
.GetItemState( EE_CHAR_UNDERLINE
, true );
1096 if ( eState
== SfxItemState::DONTCARE
)
1098 rDestSet
.InvalidateItem( SID_ULINE_VAL_NONE
);
1099 rDestSet
.InvalidateItem( SID_ULINE_VAL_SINGLE
);
1100 rDestSet
.InvalidateItem( SID_ULINE_VAL_DOUBLE
);
1101 rDestSet
.InvalidateItem( SID_ULINE_VAL_DOTTED
);
1105 FontUnderline eUnderline
= static_cast<const SvxUnderlineItem
&>(
1106 aAttrSet
.Get(EE_CHAR_UNDERLINE
)).GetLineStyle();
1107 sal_uInt16 nId
= SID_ULINE_VAL_NONE
;
1110 case UNDERLINE_SINGLE
: nId
= SID_ULINE_VAL_SINGLE
; break;
1111 case UNDERLINE_DOUBLE
: nId
= SID_ULINE_VAL_DOUBLE
; break;
1112 case UNDERLINE_DOTTED
: nId
= SID_ULINE_VAL_DOTTED
; break;
1116 rDestSet
.Put( SfxBoolItem( nId
, true ) );
1119 // horizontal / vertical
1121 bool bLeftToRight
= true;
1123 SdrOutliner
* pOutl
= pView
->GetTextEditOutliner();
1126 if( pOutl
->IsVertical() )
1127 bLeftToRight
= false;
1130 bLeftToRight
= static_cast<const SvxWritingModeItem
&>( aAttrSet
.Get( SDRATTR_TEXTDIRECTION
) ).GetValue() == com::sun::star::text::WritingMode_LR_TB
;
1132 if ( bDisableVerticalText
)
1134 rDestSet
.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT
);
1135 rDestSet
.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM
);
1139 rDestSet
.Put( SfxBoolItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT
, bLeftToRight
) );
1140 rDestSet
.Put( SfxBoolItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM
, !bLeftToRight
) );
1143 // left-to-right or right-to-left
1145 if ( !bLeftToRight
|| bDisableCTLFont
)
1147 // disabled if vertical
1148 rDestSet
.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT
);
1149 rDestSet
.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT
);
1151 else if ( aAttrSet
.GetItemState( EE_PARA_WRITINGDIR
) == SfxItemState::DONTCARE
)
1153 rDestSet
.InvalidateItem( SID_ATTR_PARA_LEFT_TO_RIGHT
);
1154 rDestSet
.InvalidateItem( SID_ATTR_PARA_RIGHT_TO_LEFT
);
1158 SvxFrameDirection eAttrDir
= (SvxFrameDirection
)static_cast<const SvxFrameDirectionItem
&>(
1159 aAttrSet
.Get( EE_PARA_WRITINGDIR
)).GetValue();
1160 if ( eAttrDir
== FRMDIR_ENVIRONMENT
)
1162 // get "environment" direction from page style
1163 if ( pViewData
->GetDocument()->GetEditTextDirection( pViewData
->GetTabNo() ) == EE_HTEXTDIR_R2L
)
1164 eAttrDir
= FRMDIR_HORI_RIGHT_TOP
;
1166 eAttrDir
= FRMDIR_HORI_LEFT_TOP
;
1168 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT
, ( eAttrDir
== FRMDIR_HORI_LEFT_TOP
) ) );
1169 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT
, ( eAttrDir
== FRMDIR_HORI_RIGHT_TOP
) ) );
1173 void ScDrawTextObjectBar::ExecuteTrans( SfxRequest
& rReq
)
1175 sal_Int32 nType
= ScViewUtil::GetTransliterationType( rReq
.GetSlot() );
1178 ScDrawView
* pView
= pViewData
->GetScDrawView();
1179 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
1182 // change selected text in object
1183 pOutView
->TransliterateText( nType
);
1187 //! apply to whole objects?
1192 void ScDrawTextObjectBar::GetStatePropPanelAttr(SfxItemSet
&rSet
)
1194 SfxWhichIter
aIter( rSet
);
1195 sal_uInt16 nWhich
= aIter
.FirstWhich();
1197 SdrView
* pView
= pViewData
->GetScDrawView();
1199 SfxItemSet
aEditAttr(pView
->GetModel()->GetItemPool());
1200 pView
->GetAttributes(aEditAttr
);
1201 //SfxItemSet aAttrs( *aEditAttr.GetPool(), aEditAttr.GetRanges() );
1205 sal_uInt16 nSlotId
= SfxItemPool::IsWhich(nWhich
)
1206 ? GetPool().GetSlotId(nWhich
)
1210 case SID_TABLE_VERT_NONE
:
1211 case SID_TABLE_VERT_CENTER
:
1212 case SID_TABLE_VERT_BOTTOM
:
1213 bool bContour
= false;
1214 SfxItemState eConState
= aEditAttr
.GetItemState( SDRATTR_TEXT_CONTOURFRAME
);
1215 if( eConState
!= SfxItemState::DONTCARE
)
1217 bContour
= static_cast<const SdrOnOffItem
&>( aEditAttr
.Get( SDRATTR_TEXT_CONTOURFRAME
) ).GetValue();
1219 if (bContour
) break;
1221 SfxItemState eVState
= aEditAttr
.GetItemState( SDRATTR_TEXT_VERTADJUST
);
1222 //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
1224 //if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
1225 if(SfxItemState::DONTCARE
!= eVState
)
1227 SdrTextVertAdjust eTVA
= (SdrTextVertAdjust
)static_cast<const SdrTextVertAdjustItem
&>(aEditAttr
.Get(SDRATTR_TEXT_VERTADJUST
)).GetValue();
1228 bool bSet
= (nSlotId
== SID_TABLE_VERT_NONE
&& eTVA
== SDRTEXTVERTADJUST_TOP
) ||
1229 (nSlotId
== SID_TABLE_VERT_CENTER
&& eTVA
== SDRTEXTVERTADJUST_CENTER
) ||
1230 (nSlotId
== SID_TABLE_VERT_BOTTOM
&& eTVA
== SDRTEXTVERTADJUST_BOTTOM
);
1231 rSet
.Put(SfxBoolItem(nSlotId
, bSet
));
1235 rSet
.Put(SfxBoolItem(nSlotId
, false));
1239 nWhich
= aIter
.NextWhich();
1243 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */