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