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
10cdf0e10cSrcweir *
115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
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.
19cdf0e10cSrcweir *
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 #include <svx/svxids.hrc>
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include <i18npool/mslangid.hxx>
32cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
33cdf0e10cSrcweir #include <editeng/lspcitem.hxx>
34cdf0e10cSrcweir #include <editeng/adjitem.hxx>
35cdf0e10cSrcweir #include <editeng/editview.hxx>
36cdf0e10cSrcweir #include <editeng/editeng.hxx>
37cdf0e10cSrcweir #include <editeng/outliner.hxx>
38cdf0e10cSrcweir #include <editeng/unolingu.hxx>
39cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
40cdf0e10cSrcweir #include <editeng/lspcitem.hxx>
41cdf0e10cSrcweir #include <editeng/adjitem.hxx>
42*512ec161SZheng Fan #include <editeng/kernitem.hxx>
43cdf0e10cSrcweir #include <vcl/vclenum.hxx>
44cdf0e10cSrcweir #include <sfx2/app.hxx>
45cdf0e10cSrcweir #include <svl/whiter.hxx>
46cdf0e10cSrcweir #include <svl/itempool.hxx>
47cdf0e10cSrcweir #include <svl/stritem.hxx>
48cdf0e10cSrcweir #include <svl/style.hxx>
49cdf0e10cSrcweir #include <svl/languageoptions.hxx>
50cdf0e10cSrcweir #include <sfx2/tplpitem.hxx>
51cdf0e10cSrcweir #include <editeng/escpitem.hxx>
52cdf0e10cSrcweir #include <svx/svdoutl.hxx>
53cdf0e10cSrcweir #include <svl/intitem.hxx>
54cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx>
55cdf0e10cSrcweir #include <editeng/outlobj.hxx>
56cdf0e10cSrcweir #include <editeng/writingmodeitem.hxx>
57cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
58cdf0e10cSrcweir
59cdf0e10cSrcweir
60cdf0e10cSrcweir #include <sfx2/objface.hxx>
61cdf0e10cSrcweir
62cdf0e10cSrcweir #include "app.hrc"
63cdf0e10cSrcweir #include "glob.hrc"
64cdf0e10cSrcweir #include "res_bmp.hrc"
65cdf0e10cSrcweir
66cdf0e10cSrcweir #include "eetext.hxx"
67cdf0e10cSrcweir
68cdf0e10cSrcweir #include "drawdoc.hxx"
69cdf0e10cSrcweir #include "DrawViewShell.hxx"
70cdf0e10cSrcweir #include "OutlineViewShell.hxx"
71cdf0e10cSrcweir #include "ViewShellBase.hxx"
72cdf0e10cSrcweir #include "ToolBarManager.hxx"
73cdf0e10cSrcweir #include "futempl.hxx"
74cdf0e10cSrcweir #include "sdresid.hxx"
75cdf0e10cSrcweir #include "Window.hxx"
76cdf0e10cSrcweir #include "OutlineView.hxx"
77cdf0e10cSrcweir
78cdf0e10cSrcweir
79cdf0e10cSrcweir using namespace sd;
80cdf0e10cSrcweir using namespace ::com::sun::star;
81cdf0e10cSrcweir
82cdf0e10cSrcweir #define TextObjectBar
83cdf0e10cSrcweir #include "sdslots.hxx"
84cdf0e10cSrcweir
85cdf0e10cSrcweir namespace sd {
86cdf0e10cSrcweir
87cdf0e10cSrcweir /*************************************************************************
88cdf0e10cSrcweir |*
89cdf0e10cSrcweir |* Standardinterface deklarieren (Die Slotmap darf nicht leer sein, also
90cdf0e10cSrcweir |* tragen wir etwas ein, was hier (hoffentlich) nie vorkommt).
91cdf0e10cSrcweir |*
92cdf0e10cSrcweir \************************************************************************/
93cdf0e10cSrcweir
94cdf0e10cSrcweir
SFX_IMPL_INTERFACE(TextObjectBar,SfxShell,SdResId (STR_TEXTOBJECTBARSHELL))95cdf0e10cSrcweir SFX_IMPL_INTERFACE( TextObjectBar, SfxShell, SdResId(STR_TEXTOBJECTBARSHELL) )
96cdf0e10cSrcweir {
97cdf0e10cSrcweir }
98cdf0e10cSrcweir
99cdf0e10cSrcweir TYPEINIT1( TextObjectBar, SfxShell );
100cdf0e10cSrcweir
101cdf0e10cSrcweir /*************************************************************************
102cdf0e10cSrcweir |*
103cdf0e10cSrcweir |* Standard-Konstruktor
104cdf0e10cSrcweir |*
105cdf0e10cSrcweir \************************************************************************/
106cdf0e10cSrcweir
TextObjectBar(ViewShell * pSdViewSh,SfxItemPool & rItemPool,::sd::View * pSdView)107cdf0e10cSrcweir TextObjectBar::TextObjectBar (
108cdf0e10cSrcweir ViewShell* pSdViewSh,
109cdf0e10cSrcweir SfxItemPool& rItemPool,
110cdf0e10cSrcweir ::sd::View* pSdView )
111cdf0e10cSrcweir : SfxShell(pSdViewSh->GetViewShell()),
112cdf0e10cSrcweir mpViewShell( pSdViewSh ),
113cdf0e10cSrcweir mpView( pSdView )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir SetPool(&rItemPool);
116cdf0e10cSrcweir
117cdf0e10cSrcweir if( mpView )
118cdf0e10cSrcweir {
119cdf0e10cSrcweir OutlineView* pOutlinerView = dynamic_cast< OutlineView* >( mpView );
120cdf0e10cSrcweir if( pOutlinerView )
121cdf0e10cSrcweir {
122cdf0e10cSrcweir SetUndoManager(&pOutlinerView->GetOutliner()->GetUndoManager());
123cdf0e10cSrcweir }
124cdf0e10cSrcweir else
125cdf0e10cSrcweir {
126cdf0e10cSrcweir SdDrawDocument* pDoc = mpView->GetDoc();
127cdf0e10cSrcweir if( pDoc )
128cdf0e10cSrcweir {
129cdf0e10cSrcweir DrawDocShell* pDocShell = pDoc->GetDocSh();
130cdf0e10cSrcweir if( pDocShell )
131cdf0e10cSrcweir {
132cdf0e10cSrcweir SetUndoManager(pDocShell->GetUndoManager());
133cdf0e10cSrcweir DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( pSdViewSh );
134cdf0e10cSrcweir if ( pDrawViewShell )
135cdf0e10cSrcweir SetRepeatTarget(pSdView);
136cdf0e10cSrcweir }
137cdf0e10cSrcweir }
138cdf0e10cSrcweir }
139cdf0e10cSrcweir }
140cdf0e10cSrcweir
141cdf0e10cSrcweir SetName( String( RTL_CONSTASCII_USTRINGPARAM( "TextObjectBar" )));
142cdf0e10cSrcweir
143cdf0e10cSrcweir // SetHelpId( SD_IF_SDDRAWTEXTOBJECTBAR );
144cdf0e10cSrcweir }
145cdf0e10cSrcweir
146cdf0e10cSrcweir /*************************************************************************
147cdf0e10cSrcweir |*
148cdf0e10cSrcweir |* Destruktor
149cdf0e10cSrcweir |*
150cdf0e10cSrcweir \************************************************************************/
151cdf0e10cSrcweir
~TextObjectBar()152cdf0e10cSrcweir TextObjectBar::~TextObjectBar()
153cdf0e10cSrcweir {
154cdf0e10cSrcweir SetRepeatTarget(NULL);
155cdf0e10cSrcweir }
156cdf0e10cSrcweir
GetCharState(SfxItemSet & rSet)157*512ec161SZheng Fan void TextObjectBar::GetCharState( SfxItemSet& rSet )
158*512ec161SZheng Fan {
159*512ec161SZheng Fan SfxItemSet aCharAttrSet( mpView->GetDoc()->GetPool() );
160*512ec161SZheng Fan mpView->GetAttributes( aCharAttrSet );
161*512ec161SZheng Fan
162*512ec161SZheng Fan SfxItemSet aNewAttr( mpViewShell->GetPool(),EE_ITEMS_START,EE_ITEMS_END);
163*512ec161SZheng Fan
164*512ec161SZheng Fan aNewAttr.Put(aCharAttrSet, sal_False);
165*512ec161SZheng Fan rSet.Put(aNewAttr, sal_False);
166*512ec161SZheng Fan
167*512ec161SZheng Fan SvxKerningItem aKern = ( (const SvxKerningItem&) aCharAttrSet.Get( EE_CHAR_KERNING ) );
168*512ec161SZheng Fan //aKern.SetWhich(SID_ATTR_CHAR_KERNING);
169*512ec161SZheng Fan rSet.Put(aKern);
170*512ec161SZheng Fan
171*512ec161SZheng Fan SfxItemState eState = aCharAttrSet.GetItemState( EE_CHAR_KERNING, sal_True );
172*512ec161SZheng Fan if ( eState == SFX_ITEM_DONTCARE )
173*512ec161SZheng Fan {
174*512ec161SZheng Fan rSet.InvalidateItem(EE_CHAR_KERNING);
175*512ec161SZheng Fan }
176*512ec161SZheng Fan }
177*512ec161SZheng Fan
178cdf0e10cSrcweir /*************************************************************************
179cdf0e10cSrcweir |*
180cdf0e10cSrcweir |* Status der Attribut-Items
181cdf0e10cSrcweir |*
182cdf0e10cSrcweir \************************************************************************/
183cdf0e10cSrcweir
GetAttrState(SfxItemSet & rSet)184cdf0e10cSrcweir void TextObjectBar::GetAttrState( SfxItemSet& rSet )
185cdf0e10cSrcweir {
186cdf0e10cSrcweir SfxWhichIter aIter( rSet );
187cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich();
188cdf0e10cSrcweir sal_Bool bTemplate = sal_False;
189cdf0e10cSrcweir SfxItemSet aAttrSet( mpView->GetDoc()->GetPool() );
190cdf0e10cSrcweir SvtLanguageOptions aLangOpt;
191cdf0e10cSrcweir sal_Bool bDisableParagraphTextDirection = !aLangOpt.IsCTLFontEnabled();
192cdf0e10cSrcweir sal_Bool bDisableVerticalText = !aLangOpt.IsVerticalTextEnabled();
193cdf0e10cSrcweir
194cdf0e10cSrcweir mpView->GetAttributes( aAttrSet );
195cdf0e10cSrcweir
196cdf0e10cSrcweir while ( nWhich )
197cdf0e10cSrcweir {
198cdf0e10cSrcweir sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
199cdf0e10cSrcweir ? GetPool().GetSlotId(nWhich)
200cdf0e10cSrcweir : nWhich;
201cdf0e10cSrcweir
202cdf0e10cSrcweir switch ( nSlotId )
203cdf0e10cSrcweir {
204cdf0e10cSrcweir case SID_ATTR_CHAR_FONT:
205cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT:
206cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT:
207cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE:
208766ce4d0SZheng Fan case SID_ATTR_CHAR_SHADOWED:
209766ce4d0SZheng Fan case SID_ATTR_CHAR_STRIKEOUT:
210cdf0e10cSrcweir {
211cdf0e10cSrcweir SvxScriptSetItem aSetItem( nSlotId, GetPool() );
212cdf0e10cSrcweir aSetItem.GetItemSet().Put( aAttrSet, sal_False );
213cdf0e10cSrcweir
214cdf0e10cSrcweir sal_uInt16 nScriptType = mpView->GetScriptType();
215cdf0e10cSrcweir
216cdf0e10cSrcweir if( (nSlotId == SID_ATTR_CHAR_FONT) || (nSlotId == SID_ATTR_CHAR_FONTHEIGHT) )
217cdf0e10cSrcweir {
218cdf0e10cSrcweir // #42732# input language should be preferred over
219cdf0e10cSrcweir // current cursor position to detect script type
220cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
221cdf0e10cSrcweir
222cdf0e10cSrcweir if (mpView->ISA(OutlineView))
223cdf0e10cSrcweir {
224cdf0e10cSrcweir pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
225cdf0e10cSrcweir mpViewShell->GetActiveWindow());
226cdf0e10cSrcweir }
227cdf0e10cSrcweir
228cdf0e10cSrcweir if(pOLV && !pOLV->GetSelection().HasRange())
229cdf0e10cSrcweir {
230cdf0e10cSrcweir if( mpViewShell && mpViewShell->GetViewShell() && mpViewShell->GetViewShell()->GetWindow() )
231cdf0e10cSrcweir {
232cdf0e10cSrcweir LanguageType nInputLang = mpViewShell->GetViewShell()->GetWindow()->GetInputLanguage();
233cdf0e10cSrcweir if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
234cdf0e10cSrcweir nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
235cdf0e10cSrcweir }
236cdf0e10cSrcweir }
237cdf0e10cSrcweir }
238cdf0e10cSrcweir
239cdf0e10cSrcweir const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
240cdf0e10cSrcweir if( pI )
241cdf0e10cSrcweir aAttrSet.Put( *pI, nWhich );
242cdf0e10cSrcweir else
243cdf0e10cSrcweir aAttrSet.InvalidateItem( nWhich );
244cdf0e10cSrcweir }
245cdf0e10cSrcweir break;
246cdf0e10cSrcweir
247cdf0e10cSrcweir
248cdf0e10cSrcweir case SID_STYLE_APPLY:
249cdf0e10cSrcweir case SID_STYLE_FAMILY2:
250cdf0e10cSrcweir {
251cdf0e10cSrcweir SfxStyleSheet* pStyleSheet = mpView->GetStyleSheetFromMarked();
252cdf0e10cSrcweir if( pStyleSheet )
253cdf0e10cSrcweir rSet.Put( SfxTemplateItem( nWhich, pStyleSheet->GetName() ) );
254cdf0e10cSrcweir else
255cdf0e10cSrcweir {
256cdf0e10cSrcweir rSet.Put( SfxTemplateItem( nWhich, String() ) );
257cdf0e10cSrcweir }
258cdf0e10cSrcweir bTemplate = sal_True;
259cdf0e10cSrcweir }
260cdf0e10cSrcweir break;
261cdf0e10cSrcweir
262cdf0e10cSrcweir case SID_OUTLINE_LEFT:
263cdf0e10cSrcweir case SID_OUTLINE_RIGHT:
264cdf0e10cSrcweir case SID_OUTLINE_UP:
265cdf0e10cSrcweir case SID_OUTLINE_DOWN:
266cdf0e10cSrcweir {
267cdf0e10cSrcweir sal_Bool bDisableLeft = sal_True;
268cdf0e10cSrcweir sal_Bool bDisableRight = sal_True;
269cdf0e10cSrcweir sal_Bool bDisableUp = sal_True;
270cdf0e10cSrcweir sal_Bool bDisableDown = sal_True;
271cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
272cdf0e10cSrcweir
273cdf0e10cSrcweir if (mpView->ISA(OutlineView))
274cdf0e10cSrcweir {
275cdf0e10cSrcweir pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
276cdf0e10cSrcweir mpViewShell->GetActiveWindow());
277cdf0e10cSrcweir }
278cdf0e10cSrcweir
279cdf0e10cSrcweir sal_Bool bOutlineViewSh = mpViewShell->ISA(OutlineViewShell);
280cdf0e10cSrcweir
281cdf0e10cSrcweir if (pOLV &&
282cdf0e10cSrcweir ( pOLV->GetOutliner()->GetMode() == OUTLINERMODE_OUTLINEOBJECT || bOutlineViewSh ) )
283cdf0e10cSrcweir {
284cdf0e10cSrcweir // Outliner im Gliederungsmodus
285cdf0e10cSrcweir ::Outliner* pOutl = pOLV->GetOutliner();
286cdf0e10cSrcweir List* pList = pOLV->CreateSelectionList();
287cdf0e10cSrcweir Paragraph* pPara = (Paragraph*) pList->First();
288cdf0e10cSrcweir
289cdf0e10cSrcweir // #96539# find out if we are a OutlineView
290cdf0e10cSrcweir sal_Bool bIsOutlineView(OUTLINERMODE_OUTLINEVIEW == pOLV->GetOutliner()->GetMode());
291cdf0e10cSrcweir
292cdf0e10cSrcweir // #96539# This is ONLY for OutlineViews
293cdf0e10cSrcweir if(bIsOutlineView)
294cdf0e10cSrcweir {
295cdf0e10cSrcweir // #96250# and #78665#
296cdf0e10cSrcweir // allow move up if position is 2 or greater OR it
297cdf0e10cSrcweir // is a title object (and thus depth==1)
298cdf0e10cSrcweir if(pOutl->GetAbsPos(pPara) > 1 || ( pOutl->HasParaFlag(pPara,PARAFLAG_ISPAGE) && pOutl->GetAbsPos(pPara) > 0 ) )
299cdf0e10cSrcweir {
300cdf0e10cSrcweir // Nicht ganz oben
301cdf0e10cSrcweir bDisableUp = sal_False;
302cdf0e10cSrcweir }
303cdf0e10cSrcweir }
304cdf0e10cSrcweir else
305cdf0e10cSrcweir {
306cdf0e10cSrcweir // #96539# old behaviour for OUTLINERMODE_OUTLINEOBJECT
307cdf0e10cSrcweir if(pOutl->GetAbsPos(pPara) > 0)
308cdf0e10cSrcweir {
309cdf0e10cSrcweir // Nicht ganz oben
310cdf0e10cSrcweir bDisableUp = sal_False;
311cdf0e10cSrcweir }
312cdf0e10cSrcweir }
313cdf0e10cSrcweir
314cdf0e10cSrcweir while (pPara)
315cdf0e10cSrcweir {
316cdf0e10cSrcweir sal_Int16 nDepth = pOutl->GetDepth( (sal_uInt16) pOutl->GetAbsPos( pPara ) );
317cdf0e10cSrcweir
318cdf0e10cSrcweir if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE )) )
319cdf0e10cSrcweir {
320cdf0e10cSrcweir // Nicht minimale Tiefe
321cdf0e10cSrcweir bDisableLeft = sal_False;
322cdf0e10cSrcweir }
323cdf0e10cSrcweir
324cdf0e10cSrcweir if( (nDepth < pOLV->GetOutliner()->GetMaxDepth() && ( !bOutlineViewSh || pOutl->GetAbsPos(pPara) != 0 )) ||
325cdf0e10cSrcweir (bOutlineViewSh && (nDepth <= 0) && pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && pOutl->GetAbsPos(pPara) != 0) )
326cdf0e10cSrcweir {
327cdf0e10cSrcweir // Nicht maximale Tiefe und nicht ganz oben
328cdf0e10cSrcweir bDisableRight = sal_False;
329cdf0e10cSrcweir }
330cdf0e10cSrcweir
331cdf0e10cSrcweir pPara = static_cast<Paragraph*>( pList->Next() );
332cdf0e10cSrcweir }
333cdf0e10cSrcweir
334cdf0e10cSrcweir if ( ( pOutl->GetAbsPos((Paragraph*) pList->Last()) < pOutl->GetParagraphCount() - 1 ) &&
335cdf0e10cSrcweir ( pOutl->GetParagraphCount() > 1 || !bOutlineViewSh) )
336cdf0e10cSrcweir {
337cdf0e10cSrcweir // Nicht letzter Absatz
338cdf0e10cSrcweir bDisableDown = sal_False;
339cdf0e10cSrcweir }
340cdf0e10cSrcweir
341cdf0e10cSrcweir // #96250# and #78665#
342cdf0e10cSrcweir // disable when first para and 2nd is not a title
343cdf0e10cSrcweir pPara = static_cast< Paragraph* >( pList->First() );
344cdf0e10cSrcweir if(!bDisableDown && bIsOutlineView
345cdf0e10cSrcweir && pPara
346cdf0e10cSrcweir && 0 == pOutl->GetAbsPos(pPara)
347cdf0e10cSrcweir && pOutl->GetParagraphCount() > 1
348cdf0e10cSrcweir && !pOutl->HasParaFlag( pOutl->GetParagraph(1), PARAFLAG_ISPAGE ) )
349cdf0e10cSrcweir {
350cdf0e10cSrcweir // Needs to be disabled
351cdf0e10cSrcweir bDisableDown = sal_True;
352cdf0e10cSrcweir }
353cdf0e10cSrcweir
354cdf0e10cSrcweir delete pList;
355cdf0e10cSrcweir }
356cdf0e10cSrcweir
357cdf0e10cSrcweir if (bDisableLeft)
358cdf0e10cSrcweir rSet.DisableItem(SID_OUTLINE_LEFT);
359cdf0e10cSrcweir if (bDisableRight)
360cdf0e10cSrcweir rSet.DisableItem(SID_OUTLINE_RIGHT);
361cdf0e10cSrcweir if (bDisableUp)
362cdf0e10cSrcweir rSet.DisableItem(SID_OUTLINE_UP);
363cdf0e10cSrcweir if (bDisableDown)
364cdf0e10cSrcweir rSet.DisableItem(SID_OUTLINE_DOWN);
365cdf0e10cSrcweir }
366cdf0e10cSrcweir break;
367cdf0e10cSrcweir
368cdf0e10cSrcweir case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
369cdf0e10cSrcweir case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
370cdf0e10cSrcweir {
371cdf0e10cSrcweir if ( bDisableVerticalText )
372cdf0e10cSrcweir {
373cdf0e10cSrcweir rSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
374cdf0e10cSrcweir rSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
375cdf0e10cSrcweir }
376cdf0e10cSrcweir else
377cdf0e10cSrcweir {
378cdf0e10cSrcweir sal_Bool bLeftToRight = sal_True;
379cdf0e10cSrcweir
380cdf0e10cSrcweir SdrOutliner* pOutl = mpView->GetTextEditOutliner();
381cdf0e10cSrcweir if( pOutl )
382cdf0e10cSrcweir {
383cdf0e10cSrcweir if( pOutl->IsVertical() )
384cdf0e10cSrcweir bLeftToRight = sal_False;
385cdf0e10cSrcweir }
386cdf0e10cSrcweir else
387cdf0e10cSrcweir bLeftToRight = ( (const SvxWritingModeItem&) aAttrSet.Get( SDRATTR_TEXTDIRECTION ) ).GetValue() == com::sun::star::text::WritingMode_LR_TB;
388cdf0e10cSrcweir
389cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT, bLeftToRight ) );
390cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM, !bLeftToRight ) );
391cdf0e10cSrcweir
392cdf0e10cSrcweir if( !bLeftToRight )
393cdf0e10cSrcweir bDisableParagraphTextDirection = sal_True;
394cdf0e10cSrcweir }
395cdf0e10cSrcweir }
396cdf0e10cSrcweir break;
397cdf0e10cSrcweir
398cdf0e10cSrcweir case SID_GROW_FONT_SIZE:
399cdf0e10cSrcweir case SID_SHRINK_FONT_SIZE:
400cdf0e10cSrcweir {
401cdf0e10cSrcweir // todo
402cdf0e10cSrcweir }
403cdf0e10cSrcweir break;
404cdf0e10cSrcweir
405cdf0e10cSrcweir case SID_THES:
406cdf0e10cSrcweir {
407cdf0e10cSrcweir if( mpView && mpView->GetTextEditOutlinerView() )
408cdf0e10cSrcweir {
409cdf0e10cSrcweir EditView & rEditView = mpView->GetTextEditOutlinerView()->GetEditView();;
410cdf0e10cSrcweir String aStatusVal;
411cdf0e10cSrcweir LanguageType nLang = LANGUAGE_NONE;
412cdf0e10cSrcweir bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, rEditView );
413cdf0e10cSrcweir rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
414cdf0e10cSrcweir
415cdf0e10cSrcweir // disable "Thesaurus" context menu entry if there is nothing to look up
416cdf0e10cSrcweir lang::Locale aLocale( SvxCreateLocale( nLang ) );
417cdf0e10cSrcweir uno::Reference< linguistic2::XThesaurus > xThes( LinguMgr::GetThesaurus() );
418cdf0e10cSrcweir if (!bIsLookUpWord ||
419cdf0e10cSrcweir !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
420cdf0e10cSrcweir rSet.DisableItem( SID_THES );
421cdf0e10cSrcweir }
422cdf0e10cSrcweir else
423cdf0e10cSrcweir {
424cdf0e10cSrcweir rSet.DisableItem( SID_THES );
425cdf0e10cSrcweir }
426cdf0e10cSrcweir //! avoid puting the same item as SfxBoolItem at the end of this function
427cdf0e10cSrcweir nSlotId = 0;
428cdf0e10cSrcweir }
429cdf0e10cSrcweir break;
430cdf0e10cSrcweir
431cdf0e10cSrcweir default:
432cdf0e10cSrcweir break;
433cdf0e10cSrcweir }
434cdf0e10cSrcweir
435cdf0e10cSrcweir nWhich = aIter.NextWhich();
436cdf0e10cSrcweir }
437cdf0e10cSrcweir
438cdf0e10cSrcweir rSet.Put( aAttrSet, sal_False ); // <- sal_False, damit DontCare-Status uebernommen wird
439cdf0e10cSrcweir
440cdf0e10cSrcweir
441cdf0e10cSrcweir // die sind im Gliederungsmodus disabled
442cdf0e10cSrcweir if (!mpViewShell->ISA(DrawViewShell))
443cdf0e10cSrcweir {
444cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_ADJUST_LEFT );
445cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_ADJUST_RIGHT );
446cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_ADJUST_CENTER );
447cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_ADJUST_BLOCK );
448cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LINESPACE_10 );
449cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LINESPACE_15 );
450cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LINESPACE_20 );
451cdf0e10cSrcweir rSet.DisableItem( SID_PARASPACE_INCREASE );
452cdf0e10cSrcweir rSet.DisableItem( SID_PARASPACE_DECREASE );
453cdf0e10cSrcweir rSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
454cdf0e10cSrcweir rSet.DisableItem( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
455cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
456cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
457cdf0e10cSrcweir }
458cdf0e10cSrcweir else
459cdf0e10cSrcweir {
460cdf0e10cSrcweir // Absatzabstand
461cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
462cdf0e10cSrcweir if( pOLV )
463cdf0e10cSrcweir {
464cdf0e10cSrcweir ESelection aSel = pOLV->GetSelection();
465cdf0e10cSrcweir aSel.Adjust();
466cdf0e10cSrcweir sal_uLong nStartPara = aSel.nStartPara;
467cdf0e10cSrcweir sal_uLong nEndPara = aSel.nEndPara;
468cdf0e10cSrcweir if( !aSel.HasRange() )
469cdf0e10cSrcweir {
470cdf0e10cSrcweir nStartPara = 0;
471cdf0e10cSrcweir nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1;
472cdf0e10cSrcweir }
473cdf0e10cSrcweir long nUpper = 0L;
474cdf0e10cSrcweir for( sal_uLong nPara = nStartPara; nPara <= nEndPara; nPara++ )
475cdf0e10cSrcweir {
476cdf0e10cSrcweir const SfxItemSet& rItems = pOLV->GetOutliner()->GetParaAttribs( (sal_uInt16)nPara );
477cdf0e10cSrcweir const SvxULSpaceItem& rItem = (const SvxULSpaceItem&) rItems.Get( EE_PARA_ULSPACE );
478cdf0e10cSrcweir nUpper = Max( nUpper, (long)rItem.GetUpper() );
479cdf0e10cSrcweir }
480cdf0e10cSrcweir if( nUpper == 0L )
481cdf0e10cSrcweir rSet.DisableItem( SID_PARASPACE_DECREASE );
482cdf0e10cSrcweir }
483cdf0e10cSrcweir else
484cdf0e10cSrcweir {
485cdf0e10cSrcweir // Wird zur Zeit nie disabled !
486cdf0e10cSrcweir //rSet.DisableItem( SID_PARASPACE_INCREASE );
487cdf0e10cSrcweir //rSet.DisableItem( SID_PARASPACE_DECREASE );
488cdf0e10cSrcweir }
489cdf0e10cSrcweir
490cdf0e10cSrcweir // Absatzausrichtung
491*512ec161SZheng Fan SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) );
492*512ec161SZheng Fan rSet.Put(aLR);
493cdf0e10cSrcweir SvxAdjust eAdj = ( (const SvxAdjustItem&) aAttrSet.Get( EE_PARA_JUST ) ).GetAdjust();
494cdf0e10cSrcweir switch( eAdj )
495cdf0e10cSrcweir {
496cdf0e10cSrcweir case SVX_ADJUST_LEFT:
497cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) );
498cdf0e10cSrcweir break;
499cdf0e10cSrcweir case SVX_ADJUST_CENTER:
500cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) );
501cdf0e10cSrcweir break;
502cdf0e10cSrcweir case SVX_ADJUST_RIGHT:
503cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) );
504cdf0e10cSrcweir break;
505cdf0e10cSrcweir case SVX_ADJUST_BLOCK:
506cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) );
507cdf0e10cSrcweir break;
508cdf0e10cSrcweir default:
509cdf0e10cSrcweir break;
510cdf0e10cSrcweir }
511cdf0e10cSrcweir
512766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_ADJUST_LEFT);
513766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_ADJUST_CENTER);
514766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_ADJUST_RIGHT);
515766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_ADJUST_BLOCK);
516766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_LINESPACE);
517766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_ULSPACE);
518766ce4d0SZheng Fan
519cdf0e10cSrcweir // paragraph text direction
520cdf0e10cSrcweir if( bDisableParagraphTextDirection )
521cdf0e10cSrcweir {
522cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
523cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
524cdf0e10cSrcweir }
525cdf0e10cSrcweir else
526cdf0e10cSrcweir {
527cdf0e10cSrcweir switch( ( ( (SvxFrameDirectionItem&) aAttrSet.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() )
528cdf0e10cSrcweir {
529cdf0e10cSrcweir case FRMDIR_VERT_TOP_LEFT:
530cdf0e10cSrcweir case FRMDIR_VERT_TOP_RIGHT:
531cdf0e10cSrcweir {
532cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_LEFT_TO_RIGHT );
533cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_PARA_RIGHT_TO_LEFT );
534cdf0e10cSrcweir }
535cdf0e10cSrcweir break;
536cdf0e10cSrcweir
537cdf0e10cSrcweir case FRMDIR_HORI_LEFT_TOP:
538cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, sal_True ) );
539cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, sal_False ) );
540cdf0e10cSrcweir break;
541cdf0e10cSrcweir
542cdf0e10cSrcweir case FRMDIR_HORI_RIGHT_TOP:
543cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, sal_False ) );
544cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, sal_True ) );
545cdf0e10cSrcweir break;
546cdf0e10cSrcweir
547cdf0e10cSrcweir // #107865#
548cdf0e10cSrcweir // The case for the superordinate object is missing.
549cdf0e10cSrcweir case FRMDIR_ENVIRONMENT:
550cdf0e10cSrcweir {
551cdf0e10cSrcweir SdDrawDocument* pDoc = mpView->GetDoc();
552cdf0e10cSrcweir ::com::sun::star::text::WritingMode eMode = pDoc->GetDefaultWritingMode();
553cdf0e10cSrcweir sal_Bool bIsLeftToRight(sal_False);
554cdf0e10cSrcweir
555cdf0e10cSrcweir if(::com::sun::star::text::WritingMode_LR_TB == eMode
556cdf0e10cSrcweir || ::com::sun::star::text::WritingMode_TB_RL == eMode)
557cdf0e10cSrcweir {
558cdf0e10cSrcweir bIsLeftToRight = sal_True;
559cdf0e10cSrcweir }
560cdf0e10cSrcweir
561cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LEFT_TO_RIGHT, bIsLeftToRight ) );
562cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_RIGHT_TO_LEFT, !bIsLeftToRight ) );
563cdf0e10cSrcweir }
564cdf0e10cSrcweir break;
565cdf0e10cSrcweir }
566cdf0e10cSrcweir }
567cdf0e10cSrcweir
568cdf0e10cSrcweir /* #i35937#
569cdf0e10cSrcweir if (aAttrSet.GetItemState(EE_PARA_BULLETSTATE) == SFX_ITEM_ON)
570cdf0e10cSrcweir {
571cdf0e10cSrcweir SfxUInt16Item aBulletState((const SfxUInt16Item&) aAttrSet.Get(EE_PARA_BULLETSTATE));
572cdf0e10cSrcweir
573cdf0e10cSrcweir if (aBulletState.GetValue() != 0)
574cdf0e10cSrcweir {
575cdf0e10cSrcweir rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_True));
576cdf0e10cSrcweir }
577cdf0e10cSrcweir else
578cdf0e10cSrcweir {
579cdf0e10cSrcweir rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_False));
580cdf0e10cSrcweir }
581cdf0e10cSrcweir }
582cdf0e10cSrcweir */
583766ce4d0SZheng Fan SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) );
584766ce4d0SZheng Fan aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE);
585766ce4d0SZheng Fan rSet.Put(aLRSpace);
586766ce4d0SZheng Fan Invalidate(SID_ATTR_PARA_LRSPACE);
587766ce4d0SZheng Fan //Added by xuxu
588766ce4d0SZheng Fan SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE );
589766ce4d0SZheng Fan if ( eState == SFX_ITEM_DONTCARE )
590766ce4d0SZheng Fan {
591766ce4d0SZheng Fan rSet.InvalidateItem(EE_PARA_LRSPACE);
592766ce4d0SZheng Fan rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
593766ce4d0SZheng Fan }
594cdf0e10cSrcweir sal_uInt16 nLineSpace = (sal_uInt16) ( (const SvxLineSpacingItem&) aAttrSet.
595cdf0e10cSrcweir Get( EE_PARA_SBL ) ).GetPropLineSpace();
596cdf0e10cSrcweir switch( nLineSpace )
597cdf0e10cSrcweir {
598cdf0e10cSrcweir case 100:
599cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_10, sal_True ) );
600cdf0e10cSrcweir break;
601cdf0e10cSrcweir case 150:
602cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_15, sal_True ) );
603cdf0e10cSrcweir break;
604cdf0e10cSrcweir case 200:
605cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ATTR_PARA_LINESPACE_20, sal_True ) );
606cdf0e10cSrcweir break;
607cdf0e10cSrcweir }
608cdf0e10cSrcweir }
609cdf0e10cSrcweir
610cdf0e10cSrcweir // Ausrichtung (hoch/tief) wird auch im Gliederungsmodus gebraucht
611cdf0e10cSrcweir SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
612cdf0e10cSrcweir aAttrSet.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
613cdf0e10cSrcweir
614cdf0e10cSrcweir if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
615cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) );
616cdf0e10cSrcweir else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
617cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) );
618cdf0e10cSrcweir }
619cdf0e10cSrcweir
620cdf0e10cSrcweir /*************************************************************************
621cdf0e10cSrcweir |*
622cdf0e10cSrcweir |* Command event
623cdf0e10cSrcweir |*
624cdf0e10cSrcweir \************************************************************************/
625cdf0e10cSrcweir
Command(const CommandEvent &)626cdf0e10cSrcweir void TextObjectBar::Command( const CommandEvent& )
627cdf0e10cSrcweir {
628cdf0e10cSrcweir }
629cdf0e10cSrcweir
630cdf0e10cSrcweir
631cdf0e10cSrcweir } // end of namespace sd
632