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 <editeng/lspcitem.hxx>
39 #include <svx/svdoutl.hxx>
40 #include <editeng/unolingu.hxx>
41 #include <editeng/outlobj.hxx>
42 #include <editeng/postitem.hxx>
43 #include <editeng/scripttypeitem.hxx>
44 #include <editeng/shdditem.hxx>
45 #include <svl/srchitem.hxx>
46 #include <editeng/udlnitem.hxx>
47 #include <editeng/wghtitem.hxx>
48 #include <editeng/writingmodeitem.hxx>
49 #include <sfx2/app.hxx>
50 #include <sfx2/dispatch.hxx>
51 #include <sfx2/objface.hxx>
52 #include <sfx2/objsh.hxx>
53 #include <sfx2/request.hxx>
54 #include <sfx2/viewfrm.hxx>
55 #include <svtools/cliplistener.hxx>
56 #include <svtools/transfer.hxx>
57 #include <svl/whiter.hxx>
58 #include <svl/languageoptions.hxx>
59 #include <vcl/msgbox.hxx>
61 #include <svx/svxdlg.hxx>
62 #include <svx/dialogs.hrc>
63 #include <sfx2/sidebar/EnumContext.hxx>
66 #include "globstr.hrc"
68 #include "drtxtob.hxx"
70 #include "viewdata.hxx"
71 #include "document.hxx"
72 #include "drawview.hxx"
73 #include "viewutil.hxx"
74 #include "scresid.hxx"
75 #include "tabvwsh.hxx"
77 #define ScDrawTextObjectBar
78 #include "scslots.hxx"
81 using namespace ::com::sun::star
;
84 SFX_IMPL_INTERFACE( ScDrawTextObjectBar
, SfxShell
, ScResId(SCSTR_DRAWTEXTSHELL
) )
86 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT
|SFX_VISIBILITY_STANDARD
|SFX_VISIBILITY_SERVER
,
87 ScResId(RID_TEXT_TOOLBOX
) );
88 SFX_POPUPMENU_REGISTRATION( ScResId(RID_POPUP_DRAWTEXT
) );
89 SFX_CHILDWINDOW_REGISTRATION( ScGetFontWorkId() );
92 TYPEINIT1( ScDrawTextObjectBar
, SfxShell
);
96 // abschalten der nicht erwuenschten Acceleratoren:
98 void ScDrawTextObjectBar::StateDisableItems( SfxItemSet
&rSet
)
100 SfxWhichIter
aIter(rSet
);
101 sal_uInt16 nWhich
= aIter
.FirstWhich();
105 rSet
.DisableItem( nWhich
);
106 nWhich
= aIter
.NextWhich();
110 ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData
* pData
) :
111 SfxShell(pData
->GetViewShell()),
114 bPastePossible(false)
116 SetPool( pViewData
->GetScDrawView()->GetDefaultAttr().GetPool() );
118 // UndoManager wird beim Umschalten in den Edit-Modus umgesetzt...
119 ::svl::IUndoManager
* pMgr
= pViewData
->GetSfxDocShell()->GetUndoManager();
120 SetUndoManager( pMgr
);
121 if ( !pViewData
->GetDocument()->IsUndoEnabled() )
123 pMgr
->SetMaxUndoActionCount( 0 );
126 SetHelpId( HID_SCSHELL_DRTXTOB
);
127 SetName(OUString("DrawText"));
128 SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawText
));
131 ScDrawTextObjectBar::~ScDrawTextObjectBar()
135 pClipEvtLstnr
->AddRemoveListener( pViewData
->GetActiveWin(), false );
137 // The listener may just now be waiting for the SolarMutex and call the link
138 // afterwards, in spite of RemoveListener. So the link has to be reset, too.
139 pClipEvtLstnr
->ClearCallbackLink();
141 pClipEvtLstnr
->release();
145 //========================================================================
149 //========================================================================
151 void ScDrawTextObjectBar::Execute( SfxRequest
&rReq
)
153 ScDrawView
* pView
= pViewData
->GetScDrawView();
154 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
155 Outliner
* pOutliner
= pView
->GetTextEditOutliner();
157 if (!pOutView
|| !pOutliner
)
159 ExecuteGlobal( rReq
); // auf ganze Objekte
163 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
164 sal_uInt16 nSlot
= rReq
.GetSlot();
176 pOutView
->PasteSpecial();
179 case SID_CLIPBOARD_FORMAT_ITEMS
:
181 sal_uLong nFormat
= 0;
182 const SfxPoolItem
* pItem
;
184 pReqArgs
->GetItemState(nSlot
, sal_True
, &pItem
) == SFX_ITEM_SET
&&
185 pItem
->ISA(SfxUInt32Item
) )
187 nFormat
= ((const SfxUInt32Item
*)pItem
)->GetValue();
192 if (nFormat
== SOT_FORMAT_STRING
)
195 pOutView
->PasteSpecial();
200 case SID_PASTE_SPECIAL
:
201 ExecutePasteContents( rReq
);
206 sal_Int32 nCount
= pOutliner
->GetParagraphCount();
207 ESelection
aSel( 0,0,nCount
,0 );
208 pOutView
->SetSelection( aSel
);
214 const SvxFontItem
& rItem
= (const SvxFontItem
&)
215 pOutView
->GetAttribs().Get(EE_CHAR_FONTINFO
);
218 SvxFontItem
aNewItem( EE_CHAR_FONTINFO
);
220 const SfxItemSet
*pArgs
= rReq
.GetArgs();
221 const SfxPoolItem
* pItem
= 0;
223 pArgs
->GetItemState(GetPool().GetWhich(SID_CHARMAP
), false, &pItem
);
227 aString
= ((const SfxStringItem
*)pItem
)->GetValue();
228 const SfxPoolItem
* pFtItem
= NULL
;
229 pArgs
->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR
), false, &pFtItem
);
230 const SfxStringItem
* pFontItem
= PTR_CAST( SfxStringItem
, pFtItem
);
233 OUString
aFontName(pFontItem
->GetValue());
234 Font
aFont(aFontName
, Size(1,1)); // Size nur wg. CTOR
235 aNewItem
= SvxFontItem( aFont
.GetFamily(), aFont
.GetName(),
236 aFont
.GetStyleName(), aFont
.GetPitch(),
237 aFont
.GetCharSet(), ATTR_FONT
);
243 ScViewUtil::ExecuteCharMap( rItem
, *pViewData
->GetViewShell()->GetViewFrame(), aNewItem
, aString
);
245 if ( !aString
.isEmpty() )
247 SfxItemSet
aSet( pOutliner
->GetEmptyItemSet() );
248 aSet
.Put( aNewItem
);
249 // SetAttribs an der View selektiert ein Wort, wenn nichts selektiert ist
250 pOutView
->GetOutliner()->QuickSetAttribs( aSet
, pOutView
->GetSelection() );
251 pOutView
->InsertText(aString
);
254 Invalidate( SID_ATTR_CHAR_FONT
);
258 case SID_HYPERLINK_SETLINK
:
261 const SfxPoolItem
* pItem
;
262 if ( pReqArgs
->GetItemState( SID_HYPERLINK_SETLINK
, sal_True
, &pItem
) == SFX_ITEM_SET
)
264 const SvxHyperlinkItem
* pHyper
= (const SvxHyperlinkItem
*) pItem
;
265 const OUString
& rName
= pHyper
->GetName();
266 const OUString
& rURL
= pHyper
->GetURL();
267 const OUString
& rTarget
= pHyper
->GetTargetFrame();
268 SvxLinkInsertMode eMode
= pHyper
->GetInsertMode();
270 sal_Bool bDone
= false;
271 if ( pOutView
&& ( eMode
== HLINK_DEFAULT
|| eMode
== HLINK_FIELD
) )
273 const SvxFieldItem
* pFieldItem
= pOutView
->GetFieldAtSelection();
276 const SvxFieldData
* pField
= pFieldItem
->GetField();
277 if ( pField
&& pField
->ISA(SvxURLField
) )
279 // altes Feld selektieren
281 ESelection aSel
= pOutView
->GetSelection();
283 aSel
.nEndPara
= aSel
.nStartPara
;
284 aSel
.nEndPos
= aSel
.nStartPos
+ 1;
285 pOutView
->SetSelection( aSel
);
289 // neues Feld einfuegen
291 SvxURLField
aURLField( rURL
, rName
, SVXURLFORMAT_REPR
);
292 aURLField
.SetTargetFrame( rTarget
);
293 SvxFieldItem
aURLItem( aURLField
, EE_FEATURE_FIELD
);
294 pOutView
->InsertField( aURLItem
);
298 ESelection aSel
= pOutView
->GetSelection();
299 if ( aSel
.nStartPos
== aSel
.nEndPos
&& aSel
.nStartPos
> 0 )
301 // Cursor is behind the inserted field -> extend selection to the left
304 pOutView
->SetSelection( aSel
);
311 ExecuteGlobal( rReq
); // normal an der View
313 // InsertURL an der ViewShell schaltet bei "Text" die DrawShell ab !!!
318 case SID_OPEN_HYPERLINK
:
322 const SvxFieldItem
* pFieldItem
= pOutView
->GetFieldAtSelection();
325 const SvxFieldData
* pField
= pFieldItem
->GetField();
326 if( pField
&& pField
->ISA( SvxURLField
) )
328 const SvxURLField
* pURLField
= static_cast< const SvxURLField
* >( pField
);
329 ScGlobal::OpenURL( pURLField
->GetURL(), pURLField
->GetTargetFrame() );
336 case SID_ENABLE_HYPHENATION
:
337 case SID_TEXTDIRECTION_LEFT_TO_RIGHT
:
338 case SID_TEXTDIRECTION_TOP_TO_BOTTOM
:
339 pView
->ScEndTextEdit(); // end text edit before switching direction
340 ExecuteGlobal( rReq
);
341 // restore consistent state between shells and functions:
342 pViewData
->GetDispatcher().Execute(SID_OBJECT_SELECT
, SFX_CALLMODE_SLOT
| SFX_CALLMODE_RECORD
);
347 OUString aReplaceText
;
348 SFX_REQUEST_ARG( rReq
, pItem2
, SfxStringItem
, SID_THES
, false );
350 aReplaceText
= pItem2
->GetValue();
351 if (!aReplaceText
.isEmpty())
352 ReplaceTextWithSynonym( pOutView
->GetEditView(), aReplaceText
);
358 pOutView
->StartThesaurus();
365 void ScDrawTextObjectBar::GetState( SfxItemSet
& rSet
)
367 SfxViewFrame
* pViewFrm
= pViewData
->GetViewShell()->GetViewFrame();
368 sal_Bool bHasFontWork
= pViewFrm
->HasChildWindow(SID_FONTWORK
);
369 sal_Bool bDisableFontWork
= false;
373 // #i21255# notes now support rich text formatting (#i74140# but not fontwork)
374 bDisableFontWork
= sal_True
;
377 if ( bDisableFontWork
)
378 rSet
.DisableItem( SID_FONTWORK
);
380 rSet
.Put(SfxBoolItem(SID_FONTWORK
, bHasFontWork
));
382 if ( rSet
.GetItemState( SID_HYPERLINK_GETLINK
) != SFX_ITEM_UNKNOWN
)
384 SvxHyperlinkItem aHLinkItem
;
385 SdrView
* pView
= pViewData
->GetScDrawView();
386 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
389 sal_Bool bField
= false;
390 const SvxFieldItem
* pFieldItem
= pOutView
->GetFieldAtSelection();
393 const SvxFieldData
* pField
= pFieldItem
->GetField();
394 if ( pField
&& pField
->ISA(SvxURLField
) )
396 const SvxURLField
* pURLField
= (const SvxURLField
*) pField
;
397 aHLinkItem
.SetName( pURLField
->GetRepresentation() );
398 aHLinkItem
.SetURL( pURLField
->GetURL() );
399 aHLinkItem
.SetTargetFrame( pURLField
->GetTargetFrame() );
405 // use selected text as name for urls
406 OUString sReturn
= pOutView
->GetSelected();
407 sal_Int32 nLen
= std::min
<sal_Int32
>(sReturn
.getLength(), 255);
408 sReturn
= sReturn
.copy(0, nLen
);
409 aHLinkItem
.SetName(comphelper::string::stripEnd(sReturn
, ' '));
412 rSet
.Put(aHLinkItem
);
415 if ( rSet
.GetItemState( SID_OPEN_HYPERLINK
) != SFX_ITEM_UNKNOWN
)
417 SdrView
* pView
= pViewData
->GetScDrawView();
418 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
419 bool bEnable
= false;
422 const SvxFieldItem
* pFieldItem
= pOutView
->GetFieldAtSelection();
425 const SvxFieldData
* pField
= pFieldItem
->GetField();
426 bEnable
= pField
&& pField
->ISA( SvxURLField
);
430 rSet
.DisableItem( SID_OPEN_HYPERLINK
);
433 if( rSet
.GetItemState( SID_TRANSLITERATE_HALFWIDTH
) != SFX_ITEM_UNKNOWN
)
434 ScViewUtil::HideDisabledSlot( rSet
, pViewFrm
->GetBindings(), SID_TRANSLITERATE_HALFWIDTH
);
435 if( rSet
.GetItemState( SID_TRANSLITERATE_FULLWIDTH
) != SFX_ITEM_UNKNOWN
)
436 ScViewUtil::HideDisabledSlot( rSet
, pViewFrm
->GetBindings(), SID_TRANSLITERATE_FULLWIDTH
);
437 if( rSet
.GetItemState( SID_TRANSLITERATE_HIRAGANA
) != SFX_ITEM_UNKNOWN
)
438 ScViewUtil::HideDisabledSlot( rSet
, pViewFrm
->GetBindings(), SID_TRANSLITERATE_HIRAGANA
);
439 if( rSet
.GetItemState( SID_TRANSLITERATE_KATAGANA
) != SFX_ITEM_UNKNOWN
)
440 ScViewUtil::HideDisabledSlot( rSet
, pViewFrm
->GetBindings(), SID_TRANSLITERATE_KATAGANA
);
442 if ( rSet
.GetItemState( SID_ENABLE_HYPHENATION
) != SFX_ITEM_UNKNOWN
)
444 SdrView
* pView
= pViewData
->GetScDrawView();
445 SfxItemSet
aAttrs( pView
->GetModel()->GetItemPool() );
446 pView
->GetAttributes( aAttrs
);
447 if( aAttrs
.GetItemState( EE_PARA_HYPHENATE
) >= SFX_ITEM_AVAILABLE
)
449 sal_Bool bValue
= ( (const SfxBoolItem
&) aAttrs
.Get( EE_PARA_HYPHENATE
) ).GetValue();
450 rSet
.Put( SfxBoolItem( SID_ENABLE_HYPHENATION
, bValue
) );
454 if ( rSet
.GetItemState( SID_THES
) != SFX_ITEM_UNKNOWN
||
455 rSet
.GetItemState( SID_THESAURUS
) != SFX_ITEM_UNKNOWN
)
457 SdrView
* pView
= pViewData
->GetScDrawView();
458 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
461 LanguageType nLang
= LANGUAGE_NONE
;
462 bool bIsLookUpWord
= false;
465 EditView
& rEditView
= pOutView
->GetEditView();
466 bIsLookUpWord
= GetStatusValueForThesaurusFromContext( aStatusVal
, nLang
, rEditView
);
468 rSet
.Put( SfxStringItem( SID_THES
, aStatusVal
) );
470 // disable thesaurus main menu and context menu entry if there is nothing to look up
471 sal_Bool bCanDoThesaurus
= ScModule::HasThesaurusLanguage( nLang
);
472 if (!bIsLookUpWord
|| !bCanDoThesaurus
)
473 rSet
.DisableItem( SID_THES
);
474 if (!bCanDoThesaurus
)
475 rSet
.DisableItem( SID_THESAURUS
);
479 IMPL_LINK( ScDrawTextObjectBar
, ClipboardChanged
, TransferableDataHelper
*, pDataHelper
)
483 bPastePossible
= ( pDataHelper
->HasFormat( SOT_FORMAT_STRING
) || pDataHelper
->HasFormat( SOT_FORMAT_RTF
) );
485 SfxBindings
& rBindings
= pViewData
->GetBindings();
486 rBindings
.Invalidate( SID_PASTE
);
487 rBindings
.Invalidate( SID_PASTE_SPECIAL
);
488 rBindings
.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS
);
493 void ScDrawTextObjectBar::GetClipState( SfxItemSet
& rSet
)
495 SdrView
* pView
= pViewData
->GetScDrawView();
496 if ( !pView
->GetTextEditOutlinerView() )
498 GetGlobalClipState( rSet
);
502 if ( !pClipEvtLstnr
)
505 pClipEvtLstnr
= new TransferableClipboardListener( LINK( this, ScDrawTextObjectBar
, ClipboardChanged
) );
506 pClipEvtLstnr
->acquire();
507 Window
* pWin
= pViewData
->GetActiveWin();
508 pClipEvtLstnr
->AddRemoveListener( pWin
, sal_True
);
511 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData
->GetActiveWin() ) );
512 bPastePossible
= ( aDataHelper
.HasFormat( SOT_FORMAT_STRING
) || aDataHelper
.HasFormat( SOT_FORMAT_RTF
) );
515 SfxWhichIter
aIter( rSet
);
516 sal_uInt16 nWhich
= aIter
.FirstWhich();
522 case SID_PASTE_SPECIAL
:
523 if( !bPastePossible
)
524 rSet
.DisableItem( nWhich
);
526 case SID_CLIPBOARD_FORMAT_ITEMS
:
527 if ( bPastePossible
)
529 SvxClipboardFmtItem
aFormats( SID_CLIPBOARD_FORMAT_ITEMS
);
530 TransferableDataHelper
aDataHelper(
531 TransferableDataHelper::CreateFromSystemClipboard( pViewData
->GetActiveWin() ) );
533 if ( aDataHelper
.HasFormat( SOT_FORMAT_STRING
) )
534 aFormats
.AddClipbrdFormat( SOT_FORMAT_STRING
);
535 if ( aDataHelper
.HasFormat( SOT_FORMAT_RTF
) )
536 aFormats
.AddClipbrdFormat( SOT_FORMAT_RTF
);
538 rSet
.Put( aFormats
);
541 rSet
.DisableItem( nWhich
);
544 nWhich
= aIter
.NextWhich();
548 //========================================================================
552 //========================================================================
554 void ScDrawTextObjectBar::ExecuteToggle( SfxRequest
&rReq
)
558 SdrView
* pView
= pViewData
->GetScDrawView();
560 sal_uInt16 nSlot
= rReq
.GetSlot();
562 SfxItemSet
aSet( pView
->GetDefaultAttr() );
564 SfxItemSet
aViewAttr(pView
->GetModel()->GetItemPool());
565 pView
->GetAttributes(aViewAttr
);
568 FontUnderline eOld
= ((const SvxUnderlineItem
&) aViewAttr
.
569 Get(EE_CHAR_UNDERLINE
)).GetLineStyle();
570 FontUnderline eNew
= eOld
;
573 case SID_ULINE_VAL_NONE
:
574 eNew
= UNDERLINE_NONE
;
576 case SID_ULINE_VAL_SINGLE
:
577 eNew
= ( eOld
== UNDERLINE_SINGLE
) ? UNDERLINE_NONE
: UNDERLINE_SINGLE
;
579 case SID_ULINE_VAL_DOUBLE
:
580 eNew
= ( eOld
== UNDERLINE_DOUBLE
) ? UNDERLINE_NONE
: UNDERLINE_DOUBLE
;
582 case SID_ULINE_VAL_DOTTED
:
583 eNew
= ( eOld
== UNDERLINE_DOTTED
) ? UNDERLINE_NONE
: UNDERLINE_DOTTED
;
588 aSet
.Put( SvxUnderlineItem( eNew
, EE_CHAR_UNDERLINE
) );
590 pView
->SetAttributes( aSet
);
592 pViewData
->GetScDrawView()->InvalidateDrawTextAttrs();
595 static void lcl_RemoveFields( OutlinerView
& rOutView
)
597 //! Outliner should have RemoveFields with a selection
599 Outliner
* pOutliner
= rOutView
.GetOutliner();
600 if (!pOutliner
) return;
602 ESelection aOldSel
= rOutView
.GetSelection();
603 ESelection aSel
= aOldSel
;
605 xub_StrLen nNewEnd
= aSel
.nEndPos
;
607 sal_Bool bUpdate
= pOutliner
->GetUpdateMode();
608 sal_Bool bChanged
= false;
610 //! GetPortions and GetAttribs should be const!
611 EditEngine
& rEditEng
= (EditEngine
&)pOutliner
->GetEditEngine();
613 sal_Int32 nParCount
= pOutliner
->GetParagraphCount();
614 for (sal_Int32 nPar
=0; nPar
<nParCount
; nPar
++)
615 if ( nPar
>= aSel
.nStartPara
&& nPar
<= aSel
.nEndPara
)
617 std::vector
<sal_uInt16
> aPortions
;
618 rEditEng
.GetPortions( nPar
, aPortions
);
619 //! GetPortions should use xub_StrLen instead of USHORT
621 for ( size_t nPos
= aPortions
.size(); nPos
; )
624 sal_uInt16 nEnd
= aPortions
[ nPos
];
625 sal_uInt16 nStart
= nPos
? aPortions
[ nPos
- 1 ] : 0;
626 // fields are single characters
627 if ( nEnd
== nStart
+1 &&
628 ( nPar
> aSel
.nStartPara
|| nStart
>= aSel
.nStartPos
) &&
629 ( nPar
< aSel
.nEndPara
|| nEnd
<= aSel
.nEndPos
) )
631 ESelection
aFieldSel( nPar
, nStart
, nPar
, nEnd
);
632 SfxItemSet aSet
= rEditEng
.GetAttribs( aFieldSel
);
633 if ( aSet
.GetItemState( EE_FEATURE_FIELD
) == SFX_ITEM_ON
)
638 pOutliner
->SetUpdateMode( false );
639 OUString aName
= ScGlobal::GetRscString( STR_UNDO_DELETECONTENTS
);
640 pOutliner
->GetUndoManager().EnterListAction( aName
, aName
);
644 OUString aFieldText
= rEditEng
.GetText( aFieldSel
);
645 pOutliner
->QuickInsertText( aFieldText
, aFieldSel
);
646 if ( nPar
== aSel
.nEndPara
)
648 nNewEnd
= sal::static_int_cast
<xub_StrLen
>( nNewEnd
+ aFieldText
.getLength() );
656 if (bUpdate
&& bChanged
)
658 pOutliner
->GetUndoManager().LeaveListAction();
659 pOutliner
->SetUpdateMode( sal_True
);
662 if ( aOldSel
.IsEqual( aSel
) ) // aSel is adjusted
663 aOldSel
.nEndPos
= nNewEnd
;
665 aOldSel
.nStartPos
= nNewEnd
; // if aOldSel is backwards
666 rOutView
.SetSelection( aOldSel
);
669 void ScDrawTextObjectBar::ExecuteAttr( SfxRequest
&rReq
)
671 SdrView
* pView
= pViewData
->GetScDrawView();
672 const SfxItemSet
* pArgs
= rReq
.GetArgs();
673 sal_uInt16 nSlot
= rReq
.GetSlot();
675 sal_Bool bArgsInReq
= ( pArgs
!= NULL
);
678 SfxItemSet
aEditAttr(pView
->GetModel()->GetItemPool());
679 pView
->GetAttributes(aEditAttr
);
680 SfxItemSet
aNewAttr( *aEditAttr
.GetPool(), aEditAttr
.GetRanges() );
681 sal_Bool bDone
= sal_True
;
685 case SID_TEXT_STANDARD
: // Harte Textattributierung loeschen
687 OutlinerView
* pOutView
= pView
->IsTextEdit() ?
688 pView
->GetTextEditOutlinerView() : NULL
;
690 pOutView
->Paint( Rectangle() );
692 SfxItemSet
aEmptyAttr( *aEditAttr
.GetPool(), EE_ITEMS_START
, EE_ITEMS_END
);
693 pView
->SetAttributes( aEmptyAttr
, sal_True
);
697 lcl_RemoveFields( *pOutView
);
698 pOutView
->ShowCursor();
701 rReq
.Done( aEmptyAttr
);
702 pViewData
->GetScDrawView()->InvalidateDrawTextAttrs();
703 bDone
= false; // bereits hier passiert
707 case SID_CHAR_DLG_EFFECT
:
708 case SID_CHAR_DLG
: // Dialog-Button
709 case SID_ATTR_CHAR_FONT
: // Controller nicht angezeigt
710 case SID_ATTR_CHAR_FONTHEIGHT
:
711 bDone
= ExecuteCharDlg( aEditAttr
, aNewAttr
, nSlot
);
715 bDone
= ExecuteParaDlg( aEditAttr
, aNewAttr
);
718 case SID_ATTR_CHAR_WEIGHT
:
719 aNewAttr
.Put( (const SvxWeightItem
&)aEditAttr
.Get( EE_CHAR_WEIGHT
) );
722 case SID_ATTR_CHAR_POSTURE
:
723 aNewAttr
.Put( (const SvxPostureItem
&)aEditAttr
.Get( EE_CHAR_ITALIC
) );
726 case SID_ATTR_CHAR_UNDERLINE
:
727 aNewAttr
.Put( (const SvxUnderlineItem
&)aEditAttr
.Get( EE_CHAR_UNDERLINE
) );
730 case SID_ATTR_CHAR_OVERLINE
:
731 aNewAttr
.Put( (const SvxOverlineItem
&)aEditAttr
.Get( EE_CHAR_OVERLINE
) );
734 case SID_ATTR_CHAR_CONTOUR
:
735 aNewAttr
.Put( (const SvxContourItem
&)aEditAttr
.Get( EE_CHAR_OUTLINE
) );
738 case SID_ATTR_CHAR_SHADOWED
:
739 aNewAttr
.Put( (const SvxShadowedItem
&)aEditAttr
.Get( EE_CHAR_SHADOW
) );
742 case SID_ATTR_CHAR_STRIKEOUT
:
743 aNewAttr
.Put( (const SvxCrossedOutItem
&)aEditAttr
.Get( EE_CHAR_STRIKEOUT
) );
747 case SID_ALIGN_ANY_LEFT
:
748 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_LEFT
, EE_PARA_JUST
) );
751 case SID_ALIGNCENTERHOR
:
752 case SID_ALIGN_ANY_HCENTER
:
753 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_CENTER
, EE_PARA_JUST
) );
757 case SID_ALIGN_ANY_RIGHT
:
758 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_RIGHT
, EE_PARA_JUST
) );
762 case SID_ALIGN_ANY_JUSTIFIED
:
763 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_BLOCK
, EE_PARA_JUST
) );
766 case SID_ATTR_PARA_LINESPACE_10
:
768 SvxLineSpacingItem
aItem( SVX_LINESPACE_ONE_LINE
, EE_PARA_SBL
);
769 aItem
.SetPropLineSpace( 100 );
770 aNewAttr
.Put( aItem
);
774 case SID_ATTR_PARA_LINESPACE_15
:
776 SvxLineSpacingItem
aItem( SVX_LINESPACE_ONE_POINT_FIVE_LINES
, EE_PARA_SBL
);
777 aItem
.SetPropLineSpace( 150 );
778 aNewAttr
.Put( aItem
);
782 case SID_ATTR_PARA_LINESPACE_20
:
784 SvxLineSpacingItem
aItem( SVX_LINESPACE_TWO_LINES
, EE_PARA_SBL
);
785 aItem
.SetPropLineSpace( 200 );
786 aNewAttr
.Put( aItem
);
790 case SID_SET_SUPER_SCRIPT
:
792 SvxEscapementItem
aItem(EE_CHAR_ESCAPEMENT
);
793 SvxEscapement eEsc
= (SvxEscapement
) ( (const SvxEscapementItem
&)
794 aEditAttr
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
796 if( eEsc
== SVX_ESCAPEMENT_SUPERSCRIPT
)
797 aItem
.SetEscapement( SVX_ESCAPEMENT_OFF
);
799 aItem
.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT
);
800 aNewAttr
.Put( aItem
);
803 case SID_SET_SUB_SCRIPT
:
805 SvxEscapementItem
aItem(EE_CHAR_ESCAPEMENT
);
806 SvxEscapement eEsc
= (SvxEscapement
) ( (const SvxEscapementItem
&)
807 aEditAttr
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
809 if( eEsc
== SVX_ESCAPEMENT_SUBSCRIPT
)
810 aItem
.SetEscapement( SVX_ESCAPEMENT_OFF
);
812 aItem
.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT
);
813 aNewAttr
.Put( aItem
);
817 case SID_DRAWTEXT_ATTR_DLG
:
819 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
820 SfxAbstractTabDialog
*pDlg
= pFact
->CreateTextTabDialog( pViewData
->GetDialogParent(), &aEditAttr
, pView
);
822 bDone
= ( RET_OK
== pDlg
->Execute() );
825 aNewAttr
.Put( *pDlg
->GetOutputItemSet() );
829 SfxBindings
& rBindings
= pViewData
->GetBindings();
830 rBindings
.Invalidate( SID_TABLE_VERT_NONE
);
831 rBindings
.Invalidate( SID_TABLE_VERT_CENTER
);
832 rBindings
.Invalidate( SID_TABLE_VERT_BOTTOM
);
837 if ( bDone
) // wurden Attribute geaendert?
839 rReq
.Done( aNewAttr
);
840 pArgs
= rReq
.GetArgs();
847 ( nSlot
== SID_ATTR_CHAR_FONT
|| nSlot
== SID_ATTR_CHAR_FONTHEIGHT
||
848 nSlot
== SID_ATTR_CHAR_WEIGHT
|| nSlot
== SID_ATTR_CHAR_POSTURE
) )
850 // font items from toolbox controller have to be applied for the right script type
852 // #i78017 establish the same behaviour as in Writer
853 sal_uInt16 nScript
= SCRIPTTYPE_LATIN
| SCRIPTTYPE_ASIAN
| SCRIPTTYPE_COMPLEX
;
854 if (nSlot
== SID_ATTR_CHAR_FONT
)
855 nScript
= pView
->GetScriptType();
857 SfxItemPool
& rPool
= GetPool();
858 SvxScriptSetItem
aSetItem( nSlot
, rPool
);
859 sal_uInt16 nWhich
= rPool
.GetWhich( nSlot
);
860 aSetItem
.PutItemForScriptType( nScript
, pArgs
->Get( nWhich
) );
862 pView
->SetAttributes( aSetItem
.GetItemSet() );
864 else if( nSlot
== SID_ATTR_PARA_LRSPACE
)
866 sal_uInt16 nId
= SID_ATTR_PARA_LRSPACE
;
867 const SvxLRSpaceItem
& rItem
= (const SvxLRSpaceItem
&)
869 SfxItemSet
aEditAttr( GetPool(), EE_PARA_LRSPACE
, EE_PARA_LRSPACE
);
870 nId
= EE_PARA_LRSPACE
;
871 SvxLRSpaceItem
aLRSpaceItem( rItem
.GetLeft(),
872 rItem
.GetRight(), rItem
.GetTxtLeft(),
873 rItem
.GetTxtFirstLineOfst(), nId
);
874 aEditAttr
.Put( aLRSpaceItem
);
875 // rReq.Done( aEditAttr );
876 // pArgs = rReq.GetArgs();
877 // pView->SetAttributes( *pArgs );
878 pView
->SetAttributes( aEditAttr
);
879 // Invalidate(SID_ATTR_PARA_LRSPACE);
881 else if( nSlot
== SID_ATTR_PARA_LINESPACE
)
883 SvxLineSpacingItem aLineSpaceItem
= (const SvxLineSpacingItem
&)pArgs
->Get(
884 GetPool().GetWhich(nSlot
));
885 SfxItemSet
aEditAttr( GetPool(), EE_PARA_SBL
, EE_PARA_SBL
);
886 aEditAttr
.Put( aLineSpaceItem
);
887 // rReq.Done( aEditAttr );
888 // pArgs = rReq.GetArgs();
889 // pView->SetAttributes( *pArgs );
890 pView
->SetAttributes( aEditAttr
);
891 // Invalidate(SID_ATTR_PARA_LINESPACE);
893 else if( nSlot
== SID_ATTR_PARA_ULSPACE
)
895 SvxULSpaceItem aULSpaceItem
= (const SvxULSpaceItem
&)pArgs
->Get(
896 GetPool().GetWhich(nSlot
));
897 SfxItemSet
aEditAttr( GetPool(), EE_PARA_ULSPACE
, EE_PARA_ULSPACE
);
898 aULSpaceItem
.SetWhich(EE_PARA_ULSPACE
);
899 aEditAttr
.Put( aULSpaceItem
);
900 // rReq.Done( aEditAttr );
901 // pArgs = rReq.GetArgs();
902 // pView->SetAttributes( *pArgs );
903 pView
->SetAttributes( aEditAttr
);
904 // Invalidate(SID_ATTR_PARA_ULSPACE);
906 else if(nSlot
== SID_SET_SUPER_SCRIPT
)
908 SfxItemSet
aEditAttr(pView
->GetModel()->GetItemPool());
909 pView
->GetAttributes(aEditAttr
);
910 SfxItemSet
aNewAttr( *aEditAttr
.GetPool(), aEditAttr
.GetRanges() );
912 SvxEscapementItem
aItem(EE_CHAR_ESCAPEMENT
);
913 SvxEscapement eEsc
= (SvxEscapement
) ( (const SvxEscapementItem
&)
914 aEditAttr
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
916 if( eEsc
== SVX_ESCAPEMENT_SUPERSCRIPT
)
917 aItem
.SetEscapement( SVX_ESCAPEMENT_OFF
);
919 aItem
.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT
);
920 aNewAttr
.Put( aItem
);
921 pView
->SetAttributes( aNewAttr
);
923 else if( nSlot
== SID_SET_SUB_SCRIPT
)
925 SfxItemSet
aEditAttr(pView
->GetModel()->GetItemPool());
926 pView
->GetAttributes(aEditAttr
);
927 SfxItemSet
aNewAttr( *aEditAttr
.GetPool(), aEditAttr
.GetRanges() );
929 SvxEscapementItem
aItem(EE_CHAR_ESCAPEMENT
);
930 SvxEscapement eEsc
= (SvxEscapement
) ( (const SvxEscapementItem
&)
931 aEditAttr
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
933 if( eEsc
== SVX_ESCAPEMENT_SUBSCRIPT
)
934 aItem
.SetEscapement( SVX_ESCAPEMENT_OFF
);
936 aItem
.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT
);
937 aNewAttr
.Put( aItem
);
938 pView
->SetAttributes( aNewAttr
);
941 else if (bArgsInReq
&&
942 ( nSlot
== SID_TABLE_VERT_NONE
|| nSlot
== SID_TABLE_VERT_CENTER
||
943 nSlot
== SID_TABLE_VERT_BOTTOM
) )
945 SdrTextVertAdjust eTVA
= SDRTEXTVERTADJUST_TOP
;
946 if (nSlot
== SID_TABLE_VERT_CENTER
)
947 eTVA
= SDRTEXTVERTADJUST_CENTER
;
948 else if (nSlot
== SID_TABLE_VERT_BOTTOM
)
949 eTVA
= SDRTEXTVERTADJUST_BOTTOM
;
951 SfxItemSet
aEditAttr(pView
->GetModel()->GetItemPool());
952 SfxItemSet
aNewAttr( *aEditAttr
.GetPool(), aEditAttr
.GetRanges() );
953 aNewAttr
.Put(SdrTextVertAdjustItem(eTVA
));
954 pView
->SetAttributes(aNewAttr
);
956 else if (bArgsInReq
&&
957 (nSlot
== SID_ATTR_PARA_ADJUST_LEFT
|| nSlot
== SID_ATTR_PARA_ADJUST_CENTER
|| nSlot
== SID_ATTR_PARA_ADJUST_RIGHT
|| nSlot
== SID_ATTR_PARA_ADJUST_BLOCK
))
959 SfxItemSet
aEditAttr(pView
->GetModel()->GetItemPool());
960 SfxItemSet
aNewAttr( *aEditAttr
.GetPool(), aEditAttr
.GetRanges() );
963 case SID_ATTR_PARA_ADJUST_LEFT
:
964 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_LEFT
, EE_PARA_JUST
) );
966 case SID_ATTR_PARA_ADJUST_CENTER
:
967 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_CENTER
, EE_PARA_JUST
) );
969 case SID_ATTR_PARA_ADJUST_RIGHT
:
970 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_RIGHT
, EE_PARA_JUST
) );
972 case SID_ATTR_PARA_ADJUST_BLOCK
:
973 aNewAttr
.Put( SvxAdjustItem( SVX_ADJUST_BLOCK
, EE_PARA_JUST
) );
976 pView
->SetAttributes(aNewAttr
);
982 pView
->SetAttributes( *pArgs
);
984 pViewData
->GetScDrawView()->InvalidateDrawTextAttrs();
988 void ScDrawTextObjectBar::GetAttrState( SfxItemSet
& rDestSet
)
992 // issue 21255 - Notes now support rich text formatting.
995 SvtLanguageOptions aLangOpt
;
996 sal_Bool bDisableCTLFont
= !aLangOpt
.IsCTLFontEnabled();
997 sal_Bool bDisableVerticalText
= !aLangOpt
.IsVerticalTextEnabled();
999 SdrView
* pView
= pViewData
->GetScDrawView();
1000 SfxItemSet
aAttrSet(pView
->GetModel()->GetItemPool());
1001 pView
->GetAttributes(aAttrSet
);
1003 // direkte Attribute
1005 rDestSet
.Put( aAttrSet
);
1007 // choose font info according to selection script type
1009 sal_uInt16 nScript
= pView
->GetScriptType();
1011 // #i55929# input-language-dependent script type (depends on input language if nothing selected)
1012 sal_uInt16 nInputScript
= nScript
;
1013 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
1014 if (pOutView
&& !pOutView
->GetSelection().HasRange())
1016 LanguageType nInputLang
= pViewData
->GetActiveWin()->GetInputLanguage();
1017 if (nInputLang
!= LANGUAGE_DONTKNOW
&& nInputLang
!= LANGUAGE_SYSTEM
)
1018 nInputScript
= SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang
);
1021 // #i55929# according to spec, nInputScript is used for font and font height only
1022 if ( rDestSet
.GetItemState( EE_CHAR_FONTINFO
) != SFX_ITEM_UNKNOWN
)
1023 ScViewUtil::PutItemScript( rDestSet
, aAttrSet
, EE_CHAR_FONTINFO
, nInputScript
);
1024 if ( rDestSet
.GetItemState( EE_CHAR_FONTHEIGHT
) != SFX_ITEM_UNKNOWN
)
1025 ScViewUtil::PutItemScript( rDestSet
, aAttrSet
, EE_CHAR_FONTHEIGHT
, nInputScript
);
1026 if ( rDestSet
.GetItemState( EE_CHAR_WEIGHT
) != SFX_ITEM_UNKNOWN
)
1027 ScViewUtil::PutItemScript( rDestSet
, aAttrSet
, EE_CHAR_WEIGHT
, nScript
);
1028 if ( rDestSet
.GetItemState( EE_CHAR_ITALIC
) != SFX_ITEM_UNKNOWN
)
1029 ScViewUtil::PutItemScript( rDestSet
, aAttrSet
, EE_CHAR_ITALIC
, nScript
);
1032 SvxAdjust eAdj
= ((const SvxAdjustItem
&)aAttrSet
.Get(EE_PARA_JUST
)).GetAdjust();
1035 case SVX_ADJUST_LEFT
:
1037 rDestSet
.Put( SfxBoolItem( SID_ALIGNLEFT
, sal_True
) );
1038 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT
, sal_True
) );
1041 case SVX_ADJUST_CENTER
:
1043 rDestSet
.Put( SfxBoolItem( SID_ALIGNCENTERHOR
, sal_True
) );
1044 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER
, sal_True
) );
1047 case SVX_ADJUST_RIGHT
:
1049 rDestSet
.Put( SfxBoolItem( SID_ALIGNRIGHT
, sal_True
) );
1050 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT
, sal_True
) );
1053 case SVX_ADJUST_BLOCK
:
1055 rDestSet
.Put( SfxBoolItem( SID_ALIGNBLOCK
, sal_True
) );
1056 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK
, sal_True
) );
1061 // added to avoid warnings
1064 // pseudo slots for Format menu
1065 rDestSet
.Put( SfxBoolItem( SID_ALIGN_ANY_LEFT
, eAdj
== SVX_ADJUST_LEFT
) );
1066 rDestSet
.Put( SfxBoolItem( SID_ALIGN_ANY_HCENTER
, eAdj
== SVX_ADJUST_CENTER
) );
1067 rDestSet
.Put( SfxBoolItem( SID_ALIGN_ANY_RIGHT
, eAdj
== SVX_ADJUST_RIGHT
) );
1068 rDestSet
.Put( SfxBoolItem( SID_ALIGN_ANY_JUSTIFIED
, eAdj
== SVX_ADJUST_BLOCK
) );
1070 SvxLRSpaceItem aLR
= ((const SvxLRSpaceItem
&)aAttrSet
.Get( EE_PARA_LRSPACE
));
1071 aLR
.SetWhich(SID_ATTR_PARA_LRSPACE
);
1073 Invalidate( SID_ATTR_PARA_LRSPACE
);
1074 SfxItemState eState
= aAttrSet
.GetItemState( EE_PARA_LRSPACE
);
1075 if ( eState
== SFX_ITEM_DONTCARE
)
1076 rDestSet
.InvalidateItem(SID_ATTR_PARA_LRSPACE
);
1077 //xuxu for Line Space
1078 SvxLineSpacingItem aLineSP
= ((const SvxLineSpacingItem
&)aAttrSet
.
1079 Get( EE_PARA_SBL
));
1080 aLineSP
.SetWhich(SID_ATTR_PARA_LINESPACE
);
1081 rDestSet
.Put(aLineSP
);
1082 Invalidate(SID_ATTR_PARA_LINESPACE
);
1083 eState
= aAttrSet
.GetItemState( EE_PARA_SBL
);
1084 if ( eState
== SFX_ITEM_DONTCARE
)
1085 rDestSet
.InvalidateItem(SID_ATTR_PARA_LINESPACE
);
1087 SvxULSpaceItem aULSP
= ((const SvxULSpaceItem
&)aAttrSet
.
1088 Get( EE_PARA_ULSPACE
));
1089 aULSP
.SetWhich(SID_ATTR_PARA_ULSPACE
);
1090 rDestSet
.Put(aULSP
);
1091 Invalidate(SID_ATTR_PARA_ULSPACE
);
1092 eState
= aAttrSet
.GetItemState( EE_PARA_ULSPACE
);
1093 if ( eState
== SFX_ITEM_DONTCARE
)
1094 rDestSet
.InvalidateItem(SID_ATTR_PARA_ULSPACE
);
1098 sal_uInt16 nLineSpace
= (sal_uInt16
)
1099 ((const SvxLineSpacingItem
&)aAttrSet
.
1100 Get( EE_PARA_SBL
)).GetPropLineSpace();
1101 switch( nLineSpace
)
1104 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_10
, sal_True
) );
1107 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_15
, sal_True
) );
1110 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_20
, sal_True
) );
1114 // hoch-/tiefgestellt
1116 SvxEscapement eEsc
= (SvxEscapement
) ( (const SvxEscapementItem
&)
1117 aAttrSet
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
1118 if( eEsc
== SVX_ESCAPEMENT_SUPERSCRIPT
)
1119 rDestSet
.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT
, sal_True
) );
1120 else if( eEsc
== SVX_ESCAPEMENT_SUBSCRIPT
)
1121 rDestSet
.Put( SfxBoolItem( SID_SET_SUB_SCRIPT
, sal_True
) );
1125 eState
= aAttrSet
.GetItemState( EE_CHAR_UNDERLINE
, sal_True
);
1126 if ( eState
== SFX_ITEM_DONTCARE
)
1128 rDestSet
.InvalidateItem( SID_ULINE_VAL_NONE
);
1129 rDestSet
.InvalidateItem( SID_ULINE_VAL_SINGLE
);
1130 rDestSet
.InvalidateItem( SID_ULINE_VAL_DOUBLE
);
1131 rDestSet
.InvalidateItem( SID_ULINE_VAL_DOTTED
);
1135 FontUnderline eUnderline
= ((const SvxUnderlineItem
&)
1136 aAttrSet
.Get(EE_CHAR_UNDERLINE
)).GetLineStyle();
1137 sal_uInt16 nId
= SID_ULINE_VAL_NONE
;
1140 case UNDERLINE_SINGLE
: nId
= SID_ULINE_VAL_SINGLE
; break;
1141 case UNDERLINE_DOUBLE
: nId
= SID_ULINE_VAL_DOUBLE
; break;
1142 case UNDERLINE_DOTTED
: nId
= SID_ULINE_VAL_DOTTED
; break;
1146 rDestSet
.Put( SfxBoolItem( nId
, sal_True
) );
1149 // horizontal / vertical
1151 sal_Bool bLeftToRight
= sal_True
;
1153 SdrOutliner
* pOutl
= pView
->GetTextEditOutliner();
1156 if( pOutl
->IsVertical() )
1157 bLeftToRight
= false;
1160 bLeftToRight
= ( (const SvxWritingModeItem
&) aAttrSet
.Get( SDRATTR_TEXTDIRECTION
) ).GetValue() == com::sun::star::text::WritingMode_LR_TB
;
1162 if ( bDisableVerticalText
)
1164 rDestSet
.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT
);
1165 rDestSet
.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM
);
1169 rDestSet
.Put( SfxBoolItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT
, bLeftToRight
) );
1170 rDestSet
.Put( SfxBoolItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM
, !bLeftToRight
) );
1173 // left-to-right or right-to-left
1175 if ( !bLeftToRight
|| bDisableCTLFont
)
1177 // disabled if vertical
1178 rDestSet
.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT
);
1179 rDestSet
.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT
);
1181 else if ( aAttrSet
.GetItemState( EE_PARA_WRITINGDIR
) == SFX_ITEM_DONTCARE
)
1183 rDestSet
.InvalidateItem( SID_ATTR_PARA_LEFT_TO_RIGHT
);
1184 rDestSet
.InvalidateItem( SID_ATTR_PARA_RIGHT_TO_LEFT
);
1188 SvxFrameDirection eAttrDir
= (SvxFrameDirection
)((const SvxFrameDirectionItem
&)
1189 aAttrSet
.Get( EE_PARA_WRITINGDIR
)).GetValue();
1190 if ( eAttrDir
== FRMDIR_ENVIRONMENT
)
1192 // get "environment" direction from page style
1193 if ( pViewData
->GetDocument()->GetEditTextDirection( pViewData
->GetTabNo() ) == EE_HTEXTDIR_R2L
)
1194 eAttrDir
= FRMDIR_HORI_RIGHT_TOP
;
1196 eAttrDir
= FRMDIR_HORI_LEFT_TOP
;
1198 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT
, ( eAttrDir
== FRMDIR_HORI_LEFT_TOP
) ) );
1199 rDestSet
.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT
, ( eAttrDir
== FRMDIR_HORI_RIGHT_TOP
) ) );
1203 void ScDrawTextObjectBar::ExecuteTrans( SfxRequest
& rReq
)
1205 sal_Int32 nType
= ScViewUtil::GetTransliterationType( rReq
.GetSlot() );
1208 ScDrawView
* pView
= pViewData
->GetScDrawView();
1209 OutlinerView
* pOutView
= pView
->GetTextEditOutlinerView();
1212 // change selected text in object
1213 pOutView
->TransliterateText( nType
);
1217 //! apply to whole objects?
1222 void ScDrawTextObjectBar::GetStatePropPanelAttr(SfxItemSet
&rSet
)
1224 SfxWhichIter
aIter( rSet
);
1225 sal_uInt16 nWhich
= aIter
.FirstWhich();
1227 SdrView
* pView
= pViewData
->GetScDrawView();
1229 SfxItemSet
aEditAttr(pView
->GetModel()->GetItemPool());
1230 pView
->GetAttributes(aEditAttr
);
1231 //SfxItemSet aAttrs( *aEditAttr.GetPool(), aEditAttr.GetRanges() );
1235 sal_uInt16 nSlotId
= SfxItemPool::IsWhich(nWhich
)
1236 ? GetPool().GetSlotId(nWhich
)
1240 case SID_TABLE_VERT_NONE
:
1241 case SID_TABLE_VERT_CENTER
:
1242 case SID_TABLE_VERT_BOTTOM
:
1243 sal_Bool bContour
= sal_False
;
1244 SfxItemState eConState
= aEditAttr
.GetItemState( SDRATTR_TEXT_CONTOURFRAME
);
1245 if( eConState
!= SFX_ITEM_DONTCARE
)
1247 bContour
= ( ( const SdrTextContourFrameItem
& )aEditAttr
.Get( SDRATTR_TEXT_CONTOURFRAME
) ).GetValue();
1249 if (bContour
) break;
1251 SfxItemState eVState
= aEditAttr
.GetItemState( SDRATTR_TEXT_VERTADJUST
);
1252 //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
1254 //if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState)
1255 if(SFX_ITEM_DONTCARE
!= eVState
)
1257 SdrTextVertAdjust eTVA
= (SdrTextVertAdjust
)((const SdrTextVertAdjustItem
&)aEditAttr
.Get(SDRATTR_TEXT_VERTADJUST
)).GetValue();
1258 sal_Bool bSet
= nSlotId
== (SID_TABLE_VERT_NONE
&& eTVA
== SDRTEXTVERTADJUST_TOP
) ||
1259 (nSlotId
== SID_TABLE_VERT_CENTER
&& eTVA
== SDRTEXTVERTADJUST_CENTER
) ||
1260 (nSlotId
== SID_TABLE_VERT_BOTTOM
&& eTVA
== SDRTEXTVERTADJUST_BOTTOM
);
1261 rSet
.Put(SfxBoolItem(nSlotId
, bSet
));
1265 rSet
.Put(SfxBoolItem(nSlotId
, sal_False
));
1269 nWhich
= aIter
.NextWhich();
1273 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */