15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file
55b190011SAndrew Rist * distributed with this work for additional information
65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file
75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist * "License"); you may not use this file except in compliance
95b190011SAndrew Rist * with the License. You may obtain a copy of the License at
105b190011SAndrew Rist *
115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist *
135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist * software distributed under the License is distributed on an
155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist * KIND, either express or implied. See the License for the
175b190011SAndrew Rist * specific language governing permissions and limitations
185b190011SAndrew Rist * under the License.
195b190011SAndrew Rist *
205b190011SAndrew Rist *************************************************************/
215b190011SAndrew Rist
225b190011SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "TextObjectBar.hxx"
28cdf0e10cSrcweir
29cdf0e10cSrcweir
30cdf0e10cSrcweir #include <svx/svxids.hrc>
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include <editeng/editview.hxx>
33cdf0e10cSrcweir #include <editeng/editeng.hxx>
34cdf0e10cSrcweir #include <editeng/unolingu.hxx>
35cdf0e10cSrcweir #include <editeng/outliner.hxx>
36cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
37cdf0e10cSrcweir #include <editeng/lspcitem.hxx>
38cdf0e10cSrcweir #include <editeng/adjitem.hxx>
39cdf0e10cSrcweir #include <vcl/vclenum.hxx>
40cdf0e10cSrcweir #include <sfx2/app.hxx>
41cdf0e10cSrcweir #include <svl/whiter.hxx>
42cdf0e10cSrcweir #include <svl/itempool.hxx>
43cdf0e10cSrcweir #include <svl/style.hxx>
44cdf0e10cSrcweir #include <sfx2/tplpitem.hxx>
45cdf0e10cSrcweir #include <sfx2/request.hxx>
46cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
47cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
48cdf0e10cSrcweir #include <editeng/escpitem.hxx>
49cdf0e10cSrcweir #include <editeng/wghtitem.hxx>
50cdf0e10cSrcweir #include <editeng/postitem.hxx>
51cdf0e10cSrcweir #include <editeng/udlnitem.hxx>
52cdf0e10cSrcweir #include <editeng/crsditem.hxx>
53cdf0e10cSrcweir #include <editeng/cntritem.hxx>
54cdf0e10cSrcweir #include <editeng/shdditem.hxx>
55cdf0e10cSrcweir #include <svx/xtable.hxx>
56cdf0e10cSrcweir #include <svx/svdobj.hxx>
57cdf0e10cSrcweir #include <editeng/outlobj.hxx>
58cdf0e10cSrcweir #include <editeng/flstitem.hxx>
59cdf0e10cSrcweir #include <editeng/editeng.hxx>
60cdf0e10cSrcweir #include <svl/intitem.hxx>
61cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx>
62cdf0e10cSrcweir #include <svx/svdoutl.hxx>
63cdf0e10cSrcweir #include <editeng/writingmodeitem.hxx>
64cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
65cdf0e10cSrcweir #include <svl/itemiter.hxx>
66cdf0e10cSrcweir
67cdf0e10cSrcweir
68cdf0e10cSrcweir #include "app.hrc"
69cdf0e10cSrcweir
70cdf0e10cSrcweir #include "eetext.hxx"
71cdf0e10cSrcweir #include "ViewShell.hxx"
72cdf0e10cSrcweir #include "drawview.hxx"
73cdf0e10cSrcweir #include "drawdoc.hxx"
74cdf0e10cSrcweir #include "OutlineView.hxx"
75cdf0e10cSrcweir #include "Window.hxx"
76cdf0e10cSrcweir #include "futempl.hxx"
77cdf0e10cSrcweir #include "DrawDocShell.hxx"
78cdf0e10cSrcweir #include "Outliner.hxx"
79cdf0e10cSrcweir #include "futext.hxx"
80cdf0e10cSrcweir
81cdf0e10cSrcweir namespace sd {
82cdf0e10cSrcweir
83cdf0e10cSrcweir /*************************************************************************
84cdf0e10cSrcweir |*
85cdf0e10cSrcweir |* Bearbeitung der SfxRequests
86cdf0e10cSrcweir |*
87cdf0e10cSrcweir \************************************************************************/
88cdf0e10cSrcweir
Execute(SfxRequest & rReq)89cdf0e10cSrcweir void TextObjectBar::Execute( SfxRequest &rReq )
90cdf0e10cSrcweir {
91cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs();
92cdf0e10cSrcweir const SfxPoolItem* pPoolItem = NULL;
93cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot();
94cdf0e10cSrcweir sal_Bool bOutlineMode = sal_False;
95cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
96cdf0e10cSrcweir
97cdf0e10cSrcweir std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
98cdf0e10cSrcweir
99cdf0e10cSrcweir if (mpView->ISA(OutlineView))
100cdf0e10cSrcweir {
101cdf0e10cSrcweir bOutlineMode = sal_True;
102cdf0e10cSrcweir pOLV = static_cast<OutlineView*>(mpView)
103cdf0e10cSrcweir ->GetViewByWindow(mpViewShell->GetActiveWindow());
104cdf0e10cSrcweir
105cdf0e10cSrcweir aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
106cdf0e10cSrcweir }
107cdf0e10cSrcweir
108cdf0e10cSrcweir switch (nSlot)
109cdf0e10cSrcweir {
110cdf0e10cSrcweir case SID_STYLE_APPLY:
111cdf0e10cSrcweir {
112cdf0e10cSrcweir if( pArgs )
113cdf0e10cSrcweir {
114cdf0e10cSrcweir SdDrawDocument* pDoc = mpView->GetDoc();
115cdf0e10cSrcweir OSL_ASSERT (mpViewShell->GetViewShell()!=NULL);
116cdf0e10cSrcweir FunctionReference xFunc( FuTemplate::Create( mpViewShell, static_cast< ::sd::Window*>( mpViewShell->GetViewShell()->GetWindow()), mpView, pDoc, rReq ) );
117cdf0e10cSrcweir
118cdf0e10cSrcweir if(xFunc.is())
119cdf0e10cSrcweir {
120cdf0e10cSrcweir xFunc->Activate();
121cdf0e10cSrcweir xFunc->Deactivate();
122cdf0e10cSrcweir
123cdf0e10cSrcweir if( rReq.GetSlot() == SID_STYLE_APPLY )
124cdf0e10cSrcweir {
125cdf0e10cSrcweir if( mpViewShell && mpViewShell->GetViewFrame() )
126cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY );
127cdf0e10cSrcweir }
128cdf0e10cSrcweir }
129cdf0e10cSrcweir }
130cdf0e10cSrcweir else
131cdf0e10cSrcweir {
132cdf0e10cSrcweir if( mpViewShell && mpViewShell->GetViewFrame() )
133cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER, SFX_CALLMODE_ASYNCHRON );
134cdf0e10cSrcweir }
135cdf0e10cSrcweir
136cdf0e10cSrcweir rReq.Done();
137cdf0e10cSrcweir }
138cdf0e10cSrcweir break;
139cdf0e10cSrcweir
140cdf0e10cSrcweir case SID_PARASPACE_INCREASE:
141cdf0e10cSrcweir case SID_PARASPACE_DECREASE:
142cdf0e10cSrcweir {
143cdf0e10cSrcweir if( pOLV )
144cdf0e10cSrcweir {
145cdf0e10cSrcweir ESelection aSel = pOLV->GetSelection();
146cdf0e10cSrcweir aSel.Adjust();
147cdf0e10cSrcweir sal_uLong nStartPara = aSel.nStartPara;
148cdf0e10cSrcweir sal_uLong nEndPara = aSel.nEndPara;
149cdf0e10cSrcweir if( !aSel.HasRange() )
150cdf0e10cSrcweir {
151cdf0e10cSrcweir nStartPara = 0;
152cdf0e10cSrcweir nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
153cdf0e10cSrcweir }
154cdf0e10cSrcweir for( sal_uLong nPara = nStartPara; nPara <= nEndPara; nPara++ )
155cdf0e10cSrcweir {
156cdf0e10cSrcweir SfxStyleSheet* pStyleSheet = NULL;
157cdf0e10cSrcweir if (pOLV->GetOutliner() != NULL)
158cdf0e10cSrcweir pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara);
159cdf0e10cSrcweir if (pStyleSheet != NULL)
160cdf0e10cSrcweir {
161cdf0e10cSrcweir SfxItemSet aAttr( pStyleSheet->GetItemSet() );
162cdf0e10cSrcweir SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( (sal_uInt16) nPara ) );
163cdf0e10cSrcweir aAttr.Put( aTmpSet, sal_False ); // sal_False= InvalidItems nicht als Default, sondern als "Loecher" betrachten
164cdf0e10cSrcweir const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aAttr.Get( EE_PARA_ULSPACE );
165cdf0e10cSrcweir SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone();
166cdf0e10cSrcweir
167cdf0e10cSrcweir long nUpper = pNewItem->GetUpper();
168cdf0e10cSrcweir if( nSlot == SID_PARASPACE_INCREASE )
169cdf0e10cSrcweir nUpper += 100;
170cdf0e10cSrcweir else
171cdf0e10cSrcweir {
172cdf0e10cSrcweir nUpper -= 100;
173cdf0e10cSrcweir nUpper = Max( (long) nUpper, 0L );
174cdf0e10cSrcweir }
175cdf0e10cSrcweir pNewItem->SetUpper( (sal_uInt16) nUpper );
176cdf0e10cSrcweir
177cdf0e10cSrcweir long nLower = pNewItem->GetLower();
178cdf0e10cSrcweir if( nSlot == SID_PARASPACE_INCREASE )
179cdf0e10cSrcweir nLower += 100;
180cdf0e10cSrcweir else
181cdf0e10cSrcweir {
182cdf0e10cSrcweir nLower -= 100;
183cdf0e10cSrcweir nLower = Max( (long) nLower, 0L );
184cdf0e10cSrcweir }
185cdf0e10cSrcweir pNewItem->SetLower( (sal_uInt16) nLower );
186cdf0e10cSrcweir
187cdf0e10cSrcweir SfxItemSet aNewAttrs( aAttr );
188cdf0e10cSrcweir aNewAttrs.Put( *pNewItem );
189cdf0e10cSrcweir delete pNewItem;
190cdf0e10cSrcweir pOLV->GetOutliner()->SetParaAttribs( (sal_uInt16)nPara, aNewAttrs );
191cdf0e10cSrcweir }
192cdf0e10cSrcweir }
193cdf0e10cSrcweir }
194cdf0e10cSrcweir else
195cdf0e10cSrcweir {
196cdf0e10cSrcweir // Der folgende Code kann enabled werden, wenn ich von
197cdf0e10cSrcweir // JOE einen richtigen Status (DontCare) bekomme;
198cdf0e10cSrcweir
199cdf0e10cSrcweir // Wird enabled, obwohl es nicht richtig funktioniert (s.o.)
200cdf0e10cSrcweir SfxItemSet aEditAttr( mpView->GetDoc()->GetPool() );
201cdf0e10cSrcweir mpView->GetAttributes( aEditAttr );
202cdf0e10cSrcweir if( aEditAttr.GetItemState( EE_PARA_ULSPACE ) >= SFX_ITEM_AVAILABLE )
203cdf0e10cSrcweir {
204cdf0e10cSrcweir SfxItemSet aNewAttrs(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
205cdf0e10cSrcweir const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE );
206cdf0e10cSrcweir SvxULSpaceItem* pNewItem = (SvxULSpaceItem*) rItem.Clone();
207cdf0e10cSrcweir long nUpper = pNewItem->GetUpper();
208cdf0e10cSrcweir
209cdf0e10cSrcweir if( nSlot == SID_PARASPACE_INCREASE )
210cdf0e10cSrcweir nUpper += 100;
211cdf0e10cSrcweir else
212cdf0e10cSrcweir {
213cdf0e10cSrcweir nUpper -= 100;
214cdf0e10cSrcweir nUpper = Max( (long) nUpper, 0L );
215cdf0e10cSrcweir }
216cdf0e10cSrcweir pNewItem->SetUpper( (sal_uInt16) nUpper );
217cdf0e10cSrcweir
218cdf0e10cSrcweir long nLower = pNewItem->GetLower();
219cdf0e10cSrcweir if( nSlot == SID_PARASPACE_INCREASE )
220cdf0e10cSrcweir nLower += 100;
221cdf0e10cSrcweir else
222cdf0e10cSrcweir {
223cdf0e10cSrcweir nLower -= 100;
224cdf0e10cSrcweir nLower = Max( (long) nLower, 0L );
225cdf0e10cSrcweir }
226cdf0e10cSrcweir pNewItem->SetLower( (sal_uInt16) nLower );
227cdf0e10cSrcweir
228cdf0e10cSrcweir aNewAttrs.Put( *pNewItem );
229cdf0e10cSrcweir delete pNewItem;
230cdf0e10cSrcweir
231cdf0e10cSrcweir mpView->SetAttributes( aNewAttrs );
232cdf0e10cSrcweir }
233cdf0e10cSrcweir }
234cdf0e10cSrcweir rReq.Done();
235cdf0e10cSrcweir
236cdf0e10cSrcweir Invalidate();
237cdf0e10cSrcweir // Um die Preview (im Gliederungsmodus) zu aktualisieren muss
238cdf0e10cSrcweir // der Slot invalidiert werden:
239cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
240cdf0e10cSrcweir }
241cdf0e10cSrcweir break;
242cdf0e10cSrcweir
243cdf0e10cSrcweir case SID_OUTLINE_LEFT:
244cdf0e10cSrcweir {
245cdf0e10cSrcweir if (pOLV)
246cdf0e10cSrcweir {
247cdf0e10cSrcweir pOLV->AdjustDepth( -1 );
248cdf0e10cSrcweir
249cdf0e10cSrcweir // Ensure bold/italic etc. icon state updates
250cdf0e10cSrcweir Invalidate();
251cdf0e10cSrcweir // #96551# trigger preview refresh
252cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
253cdf0e10cSrcweir }
254cdf0e10cSrcweir rReq.Done();
255cdf0e10cSrcweir }
256cdf0e10cSrcweir break;
257cdf0e10cSrcweir
258cdf0e10cSrcweir case SID_OUTLINE_RIGHT:
259cdf0e10cSrcweir {
260cdf0e10cSrcweir if (pOLV)
261cdf0e10cSrcweir {
262cdf0e10cSrcweir pOLV->AdjustDepth( 1 );
263cdf0e10cSrcweir
264cdf0e10cSrcweir // Ensure bold/italic etc. icon state updates
265cdf0e10cSrcweir Invalidate();
266cdf0e10cSrcweir // #96551# trigger preview refresh
267cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
268cdf0e10cSrcweir }
269cdf0e10cSrcweir rReq.Done();
270cdf0e10cSrcweir }
271cdf0e10cSrcweir break;
272cdf0e10cSrcweir
273766ce4d0SZheng Fan case SID_ATTR_PARA_LRSPACE:
274766ce4d0SZheng Fan {
275766ce4d0SZheng Fan sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE;
276766ce4d0SZheng Fan SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get(
277766ce4d0SZheng Fan GetPool().GetWhich(nSlot));
278766ce4d0SZheng Fan
279766ce4d0SZheng Fan SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
280766ce4d0SZheng Fan aLRSpace.SetWhich( EE_PARA_LRSPACE );
281766ce4d0SZheng Fan
282766ce4d0SZheng Fan aEditAttr.Put( aLRSpace );
283766ce4d0SZheng Fan mpView->SetAttributes( aEditAttr );
284766ce4d0SZheng Fan
285766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_LRSPACE);
286766ce4d0SZheng Fan }
287766ce4d0SZheng Fan break;
288766ce4d0SZheng Fan
289cdf0e10cSrcweir case SID_OUTLINE_UP:
290cdf0e10cSrcweir {
291cdf0e10cSrcweir if (pOLV)
292cdf0e10cSrcweir {
293cdf0e10cSrcweir pOLV->AdjustHeight( -1 );
294cdf0e10cSrcweir
295cdf0e10cSrcweir // #96551# trigger preview refresh
296cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
297cdf0e10cSrcweir }
298cdf0e10cSrcweir rReq.Done();
299cdf0e10cSrcweir }
300cdf0e10cSrcweir break;
301cdf0e10cSrcweir
302cdf0e10cSrcweir case SID_OUTLINE_DOWN:
303cdf0e10cSrcweir {
304cdf0e10cSrcweir if (pOLV)
305cdf0e10cSrcweir {
306cdf0e10cSrcweir pOLV->AdjustHeight( 1 );
307cdf0e10cSrcweir
308cdf0e10cSrcweir // #96551# trigger preview refresh
309cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
310cdf0e10cSrcweir }
311cdf0e10cSrcweir rReq.Done();
312cdf0e10cSrcweir }
313cdf0e10cSrcweir break;
314cdf0e10cSrcweir
315cdf0e10cSrcweir case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
316cdf0e10cSrcweir case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
317cdf0e10cSrcweir {
318cdf0e10cSrcweir mpView->SdrEndTextEdit();
319cdf0e10cSrcweir SfxItemSet aAttr( mpView->GetDoc()->GetPool(), SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, 0 );
320cdf0e10cSrcweir aAttr.Put( SvxWritingModeItem(
321cdf0e10cSrcweir nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
322cdf0e10cSrcweir com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL,
323cdf0e10cSrcweir SDRATTR_TEXTDIRECTION ) );
324cdf0e10cSrcweir rReq.Done( aAttr );
325cdf0e10cSrcweir mpView->SetAttributes( aAttr );
326cdf0e10cSrcweir Invalidate();
327cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
328cdf0e10cSrcweir }
329cdf0e10cSrcweir break;
330cdf0e10cSrcweir
331*af89ca6eSOliver-Rainer Wittmann case FN_NUM_BULLET_ON:
332cdf0e10cSrcweir if( pOLV )
333*af89ca6eSOliver-Rainer Wittmann pOLV->ToggleBullets();
334*af89ca6eSOliver-Rainer Wittmann break;
335cdf0e10cSrcweir
336cdf0e10cSrcweir case SID_GROW_FONT_SIZE:
337cdf0e10cSrcweir case SID_SHRINK_FONT_SIZE:
338cdf0e10cSrcweir {
339cdf0e10cSrcweir const SvxFontListItem* pFonts = (const SvxFontListItem*)mpViewShell->GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST );
340cdf0e10cSrcweir const FontList* pFontList = pFonts ? pFonts->GetFontList(): 0;
341cdf0e10cSrcweir if( pFontList )
342cdf0e10cSrcweir {
343cdf0e10cSrcweir FuText::ChangeFontSize( nSlot == SID_GROW_FONT_SIZE, pOLV, pFontList, mpView );
344cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
345cdf0e10cSrcweir }
346cdf0e10cSrcweir rReq.Done();
347cdf0e10cSrcweir }
348cdf0e10cSrcweir break;
349cdf0e10cSrcweir
350cdf0e10cSrcweir case SID_THES:
351cdf0e10cSrcweir {
352cdf0e10cSrcweir String aReplaceText;
353cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False );
354cdf0e10cSrcweir if (pItem2)
355cdf0e10cSrcweir aReplaceText = pItem2->GetValue();
356cdf0e10cSrcweir if (aReplaceText.Len() > 0)
357cdf0e10cSrcweir ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
358cdf0e10cSrcweir }
359cdf0e10cSrcweir break;
360cdf0e10cSrcweir
361cdf0e10cSrcweir default:
362cdf0e10cSrcweir {
363cdf0e10cSrcweir SfxItemSet aEditAttr( mpView->GetDoc()->GetPool() );
364cdf0e10cSrcweir mpView->GetAttributes( aEditAttr );
365cdf0e10cSrcweir SfxItemSet aNewAttr(*(aEditAttr.GetPool()), aEditAttr.GetRanges());
366cdf0e10cSrcweir
367cdf0e10cSrcweir if( !pArgs )
368cdf0e10cSrcweir {
369cdf0e10cSrcweir //aNewAttr.InvalidateAllItems(); <- Macht Probleme (#35465#)
370cdf0e10cSrcweir
371cdf0e10cSrcweir switch ( nSlot )
372cdf0e10cSrcweir {
373cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT:
374cdf0e10cSrcweir {
375cdf0e10cSrcweir FontWeight eFW = ( (const SvxWeightItem&) aEditAttr.
376cdf0e10cSrcweir Get( EE_CHAR_WEIGHT ) ).GetWeight();
377cdf0e10cSrcweir aNewAttr.Put( SvxWeightItem( eFW == WEIGHT_NORMAL ?
378cdf0e10cSrcweir WEIGHT_BOLD : WEIGHT_NORMAL,
379cdf0e10cSrcweir EE_CHAR_WEIGHT ) );
380cdf0e10cSrcweir }
381cdf0e10cSrcweir break;
382cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE:
383cdf0e10cSrcweir {
384cdf0e10cSrcweir FontItalic eFI = ( (const SvxPostureItem&) aEditAttr.
385cdf0e10cSrcweir Get( EE_CHAR_ITALIC ) ).GetPosture();
386cdf0e10cSrcweir aNewAttr.Put( SvxPostureItem( eFI == ITALIC_NORMAL ?
387cdf0e10cSrcweir ITALIC_NONE : ITALIC_NORMAL,
388cdf0e10cSrcweir EE_CHAR_ITALIC ) );
389cdf0e10cSrcweir }
390cdf0e10cSrcweir break;
391cdf0e10cSrcweir case SID_ATTR_CHAR_UNDERLINE:
392cdf0e10cSrcweir {
393cdf0e10cSrcweir FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.
394cdf0e10cSrcweir Get( EE_CHAR_UNDERLINE ) ).GetLineStyle();
395cdf0e10cSrcweir aNewAttr.Put( SvxUnderlineItem( eFU == UNDERLINE_SINGLE ?
396cdf0e10cSrcweir UNDERLINE_NONE : UNDERLINE_SINGLE,
397cdf0e10cSrcweir EE_CHAR_UNDERLINE ) );
398cdf0e10cSrcweir }
399cdf0e10cSrcweir break;
400cdf0e10cSrcweir case SID_ATTR_CHAR_OVERLINE:
401cdf0e10cSrcweir {
402cdf0e10cSrcweir FontUnderline eFO = ( (const SvxOverlineItem&) aEditAttr.
403cdf0e10cSrcweir Get( EE_CHAR_OVERLINE ) ).GetLineStyle();
404cdf0e10cSrcweir aNewAttr.Put( SvxOverlineItem( eFO == UNDERLINE_SINGLE ?
405cdf0e10cSrcweir UNDERLINE_NONE : UNDERLINE_SINGLE,
406cdf0e10cSrcweir EE_CHAR_OVERLINE ) );
407cdf0e10cSrcweir }
408cdf0e10cSrcweir break;
409cdf0e10cSrcweir case SID_ATTR_CHAR_CONTOUR:
410cdf0e10cSrcweir {
411cdf0e10cSrcweir aNewAttr.Put( SvxContourItem( !( (const SvxContourItem&) aEditAttr.
412cdf0e10cSrcweir Get( EE_CHAR_OUTLINE ) ).GetValue(), EE_CHAR_OUTLINE ) );
413cdf0e10cSrcweir }
414cdf0e10cSrcweir break;
415cdf0e10cSrcweir case SID_ATTR_CHAR_SHADOWED:
416cdf0e10cSrcweir {
417cdf0e10cSrcweir aNewAttr.Put( SvxShadowedItem( !( (const SvxShadowedItem&) aEditAttr.
418cdf0e10cSrcweir Get( EE_CHAR_SHADOW ) ).GetValue(), EE_CHAR_SHADOW ) );
419cdf0e10cSrcweir }
420cdf0e10cSrcweir break;
421cdf0e10cSrcweir case SID_ATTR_CHAR_STRIKEOUT:
422cdf0e10cSrcweir {
423cdf0e10cSrcweir FontStrikeout eFSO = ( ( (const SvxCrossedOutItem&) aEditAttr.
424cdf0e10cSrcweir Get( EE_CHAR_STRIKEOUT ) ).GetStrikeout() );
425cdf0e10cSrcweir aNewAttr.Put( SvxCrossedOutItem( eFSO == STRIKEOUT_SINGLE ?
426cdf0e10cSrcweir STRIKEOUT_NONE : STRIKEOUT_SINGLE, EE_CHAR_STRIKEOUT ) );
427cdf0e10cSrcweir }
428cdf0e10cSrcweir break;
429cdf0e10cSrcweir
430cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_LEFT:
431cdf0e10cSrcweir {
432cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
433cdf0e10cSrcweir }
434cdf0e10cSrcweir break;
435cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_CENTER:
436cdf0e10cSrcweir {
437cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
438cdf0e10cSrcweir }
439cdf0e10cSrcweir break;
440cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_RIGHT:
441cdf0e10cSrcweir {
442cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
443cdf0e10cSrcweir }
444cdf0e10cSrcweir break;
445cdf0e10cSrcweir case SID_ATTR_PARA_ADJUST_BLOCK:
446cdf0e10cSrcweir {
447cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) );
448cdf0e10cSrcweir }
449cdf0e10cSrcweir break;
450cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_10:
451cdf0e10cSrcweir {
452cdf0e10cSrcweir SvxLineSpacingItem aItem( SVX_LINESPACE_ONE_LINE, EE_PARA_SBL );
453cdf0e10cSrcweir aItem.SetPropLineSpace( 100 );
454cdf0e10cSrcweir aNewAttr.Put( aItem );
455cdf0e10cSrcweir }
456cdf0e10cSrcweir break;
457cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_15:
458cdf0e10cSrcweir {
459cdf0e10cSrcweir SvxLineSpacingItem aItem( SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL );
460cdf0e10cSrcweir aItem.SetPropLineSpace( 150 );
461cdf0e10cSrcweir aNewAttr.Put( aItem );
462cdf0e10cSrcweir }
463cdf0e10cSrcweir break;
464cdf0e10cSrcweir case SID_ATTR_PARA_LINESPACE_20:
465cdf0e10cSrcweir {
466cdf0e10cSrcweir SvxLineSpacingItem aItem( SVX_LINESPACE_TWO_LINES, EE_PARA_SBL );
467cdf0e10cSrcweir aItem.SetPropLineSpace( 200 );
468cdf0e10cSrcweir aNewAttr.Put( aItem );
469cdf0e10cSrcweir }
470cdf0e10cSrcweir break;
471cdf0e10cSrcweir case SID_SET_SUPER_SCRIPT:
472cdf0e10cSrcweir {
473cdf0e10cSrcweir SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
474cdf0e10cSrcweir SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
475cdf0e10cSrcweir aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
476cdf0e10cSrcweir
477cdf0e10cSrcweir if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
478cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
479cdf0e10cSrcweir else
480cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
481cdf0e10cSrcweir aNewAttr.Put( aItem );
482cdf0e10cSrcweir }
483cdf0e10cSrcweir break;
484cdf0e10cSrcweir case SID_SET_SUB_SCRIPT:
485cdf0e10cSrcweir {
486cdf0e10cSrcweir SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT );
487cdf0e10cSrcweir SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
488cdf0e10cSrcweir aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
489cdf0e10cSrcweir
490cdf0e10cSrcweir if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
491cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
492cdf0e10cSrcweir else
493cdf0e10cSrcweir aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
494cdf0e10cSrcweir aNewAttr.Put( aItem );
495cdf0e10cSrcweir }
496cdf0e10cSrcweir break;
497cdf0e10cSrcweir
498cdf0e10cSrcweir // Attribute fuer die TextObjectBar
499cdf0e10cSrcweir case SID_ATTR_CHAR_FONT:
500cdf0e10cSrcweir {
501cdf0e10cSrcweir if( pArgs )
502cdf0e10cSrcweir {
503cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_FONTINFO, sal_True, &pPoolItem ) )
504cdf0e10cSrcweir aNewAttr.Put( *pPoolItem );
505cdf0e10cSrcweir }
506cdf0e10cSrcweir else
507cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->
508cdf0e10cSrcweir Execute( SID_CHAR_DLG, SFX_CALLMODE_ASYNCHRON );
509cdf0e10cSrcweir }
510cdf0e10cSrcweir break;
511cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT:
512cdf0e10cSrcweir {
513cdf0e10cSrcweir if( pArgs )
514cdf0e10cSrcweir {
515cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_FONTHEIGHT, sal_True, &pPoolItem ) )
516cdf0e10cSrcweir aNewAttr.Put( *pPoolItem );
517cdf0e10cSrcweir }
518cdf0e10cSrcweir else
519cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->
520cdf0e10cSrcweir Execute( SID_CHAR_DLG, SFX_CALLMODE_ASYNCHRON );
521cdf0e10cSrcweir }
522cdf0e10cSrcweir break;
523cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR:
524cdf0e10cSrcweir {
525cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( EE_CHAR_COLOR, sal_True, &pPoolItem ) )
526cdf0e10cSrcweir aNewAttr.Put( *pPoolItem );
527cdf0e10cSrcweir }
528cdf0e10cSrcweir break;
529cdf0e10cSrcweir /* #i35937#
530cdf0e10cSrcweir case FN_NUM_BULLET_ON:
531cdf0e10cSrcweir {
532cdf0e10cSrcweir if (aEditAttr.GetItemState(EE_PARA_BULLETSTATE) == SFX_ITEM_ON)
533cdf0e10cSrcweir {
534cdf0e10cSrcweir SfxUInt16Item aBulletState((const SfxUInt16Item&) aEditAttr.Get(EE_PARA_BULLETSTATE));
535cdf0e10cSrcweir
536cdf0e10cSrcweir if (aBulletState.GetValue() != 0)
537cdf0e10cSrcweir {
538cdf0e10cSrcweir // Ausschalten
539cdf0e10cSrcweir aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 0));
540cdf0e10cSrcweir }
541cdf0e10cSrcweir else
542cdf0e10cSrcweir {
543cdf0e10cSrcweir // Einschalten
544cdf0e10cSrcweir aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 1));
545cdf0e10cSrcweir }
546cdf0e10cSrcweir }
547cdf0e10cSrcweir else
548cdf0e10cSrcweir {
549cdf0e10cSrcweir // Einschalten
550cdf0e10cSrcweir aNewAttr.Put(SfxUInt16Item(EE_PARA_BULLETSTATE, 1));
551cdf0e10cSrcweir }
552cdf0e10cSrcweir }
553cdf0e10cSrcweir break;
554cdf0e10cSrcweir */
555cdf0e10cSrcweir }
556cdf0e10cSrcweir
557cdf0e10cSrcweir rReq.Done( aNewAttr );
558cdf0e10cSrcweir pArgs = rReq.GetArgs();
559cdf0e10cSrcweir }
560cdf0e10cSrcweir else if ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT ||
561cdf0e10cSrcweir nSlot == SID_ATTR_PARA_RIGHT_TO_LEFT )
562cdf0e10cSrcweir {
563cdf0e10cSrcweir sal_Bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
564cdf0e10cSrcweir
565cdf0e10cSrcweir sal_uInt16 nAdjust = SVX_ADJUST_LEFT;
566cdf0e10cSrcweir if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, sal_True, &pPoolItem ) )
567cdf0e10cSrcweir nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue();
568cdf0e10cSrcweir
569cdf0e10cSrcweir if( bLeftToRight )
570cdf0e10cSrcweir {
571cdf0e10cSrcweir aNewAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
572cdf0e10cSrcweir if( nAdjust == SVX_ADJUST_RIGHT )
573cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
574cdf0e10cSrcweir }
575cdf0e10cSrcweir else
576cdf0e10cSrcweir {
577cdf0e10cSrcweir aNewAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
578cdf0e10cSrcweir if( nAdjust == SVX_ADJUST_LEFT )
579cdf0e10cSrcweir aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
580cdf0e10cSrcweir }
581cdf0e10cSrcweir
582cdf0e10cSrcweir rReq.Done( aNewAttr );
583cdf0e10cSrcweir pArgs = rReq.GetArgs();
584cdf0e10cSrcweir
585cdf0e10cSrcweir Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT );
586cdf0e10cSrcweir }
587cdf0e10cSrcweir else if ( nSlot == SID_ATTR_CHAR_FONT ||
588cdf0e10cSrcweir nSlot == SID_ATTR_CHAR_FONTHEIGHT ||
589cdf0e10cSrcweir nSlot == SID_ATTR_CHAR_POSTURE ||
590cdf0e10cSrcweir nSlot == SID_ATTR_CHAR_WEIGHT )
591cdf0e10cSrcweir {
592cdf0e10cSrcweir // #i78017 establish the same behaviour as in Writer
593cdf0e10cSrcweir sal_uInt16 nScriptType = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
594cdf0e10cSrcweir if (nSlot == SID_ATTR_CHAR_FONT)
595cdf0e10cSrcweir nScriptType = mpView->GetScriptType();
596cdf0e10cSrcweir
597cdf0e10cSrcweir SfxItemPool& rPool = mpView->GetDoc()->GetPool();
598cdf0e10cSrcweir SvxScriptSetItem aSvxScriptSetItem( nSlot, rPool );
599cdf0e10cSrcweir aSvxScriptSetItem.PutItemForScriptType( nScriptType, pArgs->Get( rPool.GetWhich( nSlot ) ) );
600cdf0e10cSrcweir aNewAttr.Put( aSvxScriptSetItem.GetItemSet() );
601cdf0e10cSrcweir rReq.Done( aNewAttr );
602cdf0e10cSrcweir pArgs = rReq.GetArgs();
603cdf0e10cSrcweir }
604766ce4d0SZheng Fan else if (nSlot == SID_ATTR_PARA_ADJUST_LEFT ||
605766ce4d0SZheng Fan nSlot == SID_ATTR_PARA_ADJUST_CENTER ||
606766ce4d0SZheng Fan nSlot == SID_ATTR_PARA_ADJUST_RIGHT ||
607766ce4d0SZheng Fan nSlot == SID_ATTR_PARA_ADJUST_BLOCK)
608766ce4d0SZheng Fan {
609766ce4d0SZheng Fan switch( nSlot )
610766ce4d0SZheng Fan {
611766ce4d0SZheng Fan case SID_ATTR_PARA_ADJUST_LEFT:
612766ce4d0SZheng Fan {
613766ce4d0SZheng Fan aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
614766ce4d0SZheng Fan }
615766ce4d0SZheng Fan break;
616766ce4d0SZheng Fan case SID_ATTR_PARA_ADJUST_CENTER:
617766ce4d0SZheng Fan {
618766ce4d0SZheng Fan aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
619766ce4d0SZheng Fan }
620766ce4d0SZheng Fan break;
621766ce4d0SZheng Fan case SID_ATTR_PARA_ADJUST_RIGHT:
622766ce4d0SZheng Fan {
623766ce4d0SZheng Fan aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
624766ce4d0SZheng Fan }
625766ce4d0SZheng Fan break;
626766ce4d0SZheng Fan case SID_ATTR_PARA_ADJUST_BLOCK:
627766ce4d0SZheng Fan {
628766ce4d0SZheng Fan aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) );
629766ce4d0SZheng Fan }
630766ce4d0SZheng Fan break;
631766ce4d0SZheng Fan }
632766ce4d0SZheng Fan rReq.Done( aNewAttr );
633766ce4d0SZheng Fan pArgs = rReq.GetArgs();
634766ce4d0SZheng Fan }
635766ce4d0SZheng Fan else if(nSlot == SID_ATTR_CHAR_KERNING)
636766ce4d0SZheng Fan {
637766ce4d0SZheng Fan aNewAttr.Put(pArgs->Get(pArgs->GetPool()->GetWhich(nSlot)));
638766ce4d0SZheng Fan rReq.Done( aNewAttr );
639766ce4d0SZheng Fan pArgs = rReq.GetArgs();
640766ce4d0SZheng Fan }
641766ce4d0SZheng Fan else if(nSlot == SID_SET_SUPER_SCRIPT )
642766ce4d0SZheng Fan {
643766ce4d0SZheng Fan SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
644766ce4d0SZheng Fan SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
645766ce4d0SZheng Fan aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
646766ce4d0SZheng Fan
647766ce4d0SZheng Fan if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
648766ce4d0SZheng Fan aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
649766ce4d0SZheng Fan else
650766ce4d0SZheng Fan aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
651766ce4d0SZheng Fan aNewAttr.Put( aItem );
652766ce4d0SZheng Fan rReq.Done( aNewAttr );
653766ce4d0SZheng Fan pArgs = rReq.GetArgs();
654766ce4d0SZheng Fan }
655766ce4d0SZheng Fan else if( nSlot == SID_SET_SUB_SCRIPT )
656766ce4d0SZheng Fan {
657766ce4d0SZheng Fan SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
658766ce4d0SZheng Fan SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
659766ce4d0SZheng Fan aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
660766ce4d0SZheng Fan
661766ce4d0SZheng Fan if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
662766ce4d0SZheng Fan aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
663766ce4d0SZheng Fan else
664766ce4d0SZheng Fan aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
665766ce4d0SZheng Fan aNewAttr.Put( aItem );
666766ce4d0SZheng Fan rReq.Done( aNewAttr );
667766ce4d0SZheng Fan pArgs = rReq.GetArgs();
668766ce4d0SZheng Fan }
669cdf0e10cSrcweir
670cdf0e10cSrcweir mpView->SetAttributes(*pArgs);
671cdf0e10cSrcweir
672cdf0e10cSrcweir // Aus Performance- und Erweiterungsgruenden wird
673cdf0e10cSrcweir // jetzt die komplette Shell invalidiert
674cdf0e10cSrcweir Invalidate();
675cdf0e10cSrcweir
676cdf0e10cSrcweir // Um die Preview (im Gliederungsmodus) zu aktualisieren muss
677cdf0e10cSrcweir // der Slot invalidiert werden:
678cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, sal_True, sal_False );
679cdf0e10cSrcweir }
680cdf0e10cSrcweir break;
681cdf0e10cSrcweir }
682cdf0e10cSrcweir
683cdf0e10cSrcweir Invalidate( SID_OUTLINE_LEFT );
684cdf0e10cSrcweir Invalidate( SID_OUTLINE_RIGHT );
685cdf0e10cSrcweir Invalidate( SID_OUTLINE_UP );
686cdf0e10cSrcweir Invalidate( SID_OUTLINE_DOWN );
687cdf0e10cSrcweir }
688cdf0e10cSrcweir
689cdf0e10cSrcweir } // end of namespace sd
690