xref: /AOO41X/main/sd/source/ui/view/drviewsf.cxx (revision ca62e2c2083b5d0995f1245bad6c2edfb455fbec)
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 "DrawViewShell.hxx"
28cdf0e10cSrcweir #include <com/sun/star/form/FormButtonType.hpp>
29cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #ifndef _SVXIDS_HRC
32cdf0e10cSrcweir #include <svx/svxids.hrc>
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #ifndef _GLOBL3D_HXX
35cdf0e10cSrcweir #include <svx/globl3d.hxx>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir #include <svx/hlnkitem.hxx>
38cdf0e10cSrcweir #include <editeng/eeitem.hxx>
39cdf0e10cSrcweir #ifndef _FLDITEM_HXX
40cdf0e10cSrcweir #include <editeng/flditem.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
43cdf0e10cSrcweir #include <svl/whiter.hxx>
44cdf0e10cSrcweir #include <svl/eitem.hxx>
45cdf0e10cSrcweir #include <svl/itempool.hxx>
46cdf0e10cSrcweir #include <sfx2/tplpitem.hxx>
47cdf0e10cSrcweir #ifndef _BINDING_HXX //autogen
48cdf0e10cSrcweir #include <sfx2/bindings.hxx>
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir #include <sfx2/app.hxx>
51cdf0e10cSrcweir #include <sfx2/templdlg.hxx>
52cdf0e10cSrcweir #include <svx/xdef.hxx>
53cdf0e10cSrcweir #include <svx/svddef.hxx>
54cdf0e10cSrcweir #include <svx/fmglob.hxx>
55cdf0e10cSrcweir #include <svx/svdouno.hxx>
56cdf0e10cSrcweir #include <tools/urlobj.hxx>
57cdf0e10cSrcweir #include <svx/fmshell.hxx>
58cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
59cdf0e10cSrcweir 
60cdf0e10cSrcweir #ifndef SD_FRAME_VIEW
61cdf0e10cSrcweir #include "FrameView.hxx"
62cdf0e10cSrcweir #endif
63cdf0e10cSrcweir #include "Outliner.hxx"
64cdf0e10cSrcweir #include "app.hrc"
65cdf0e10cSrcweir 
66cdf0e10cSrcweir #include "app.hxx"
67cdf0e10cSrcweir #include "stlsheet.hxx"
68cdf0e10cSrcweir #include "drawview.hxx"
69cdf0e10cSrcweir #include "drawdoc.hxx"
70cdf0e10cSrcweir #include "Window.hxx"
71cdf0e10cSrcweir #include "ViewShellBase.hxx"
72cdf0e10cSrcweir #include "FormShellManager.hxx"
73cdf0e10cSrcweir #include "cfgids.hxx"
74cdf0e10cSrcweir #include "anminfo.hxx"
75cdf0e10cSrcweir 
76766ce4d0SZheng Fan #include <editeng/lspcitem.hxx>
77766ce4d0SZheng Fan #include <editeng/ulspitem.hxx>
78766ce4d0SZheng Fan #include <editeng/lrspitem.hxx>
79766ce4d0SZheng Fan #include <editeng/escpitem.hxx>
80cc69f169SZheng Fan #include <editeng/numitem.hxx>
81*512ec161SZheng Fan #include <editeng/adjitem.hxx>
82cc69f169SZheng Fan #include <svx/nbdtmgfact.hxx>
83cc69f169SZheng Fan #include <svx/nbdtmg.hxx>
84cc69f169SZheng Fan 
85cc69f169SZheng Fan using namespace svx::sidebar;
86cdf0e10cSrcweir using ::rtl::OUString;
87cdf0e10cSrcweir using namespace ::com::sun::star;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir namespace sd {
90cdf0e10cSrcweir 
91cdf0e10cSrcweir /*************************************************************************
92cdf0e10cSrcweir |*
93cdf0e10cSrcweir |* Status von Controller-SfxSlots setzen
94cdf0e10cSrcweir |*
95cdf0e10cSrcweir \************************************************************************/
96cdf0e10cSrcweir 
GetCtrlState(SfxItemSet & rSet)97cdf0e10cSrcweir void DrawViewShell::GetCtrlState(SfxItemSet &rSet)
98cdf0e10cSrcweir {
99cdf0e10cSrcweir 	if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN)
100cdf0e10cSrcweir 	{
101cdf0e10cSrcweir 		// "Letzte Version" vom SFx en/disablen lassen
102cdf0e10cSrcweir         GetViewFrame()->GetSlotState (SID_RELOAD, NULL, &rSet);
103cdf0e10cSrcweir 	}
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK))
106cdf0e10cSrcweir 	{
107cdf0e10cSrcweir 		SvxHyperlinkItem aHLinkItem;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 		OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 		if (pOLV)
112cdf0e10cSrcweir 		{
113cdf0e10cSrcweir 			bool bField = false;
114cdf0e10cSrcweir 			const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
115cdf0e10cSrcweir 			if (pFieldItem)
116cdf0e10cSrcweir 			{
117cdf0e10cSrcweir                 ESelection aSel = pOLV->GetSelection();
118cdf0e10cSrcweir                 if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
119cdf0e10cSrcweir                 {
120cdf0e10cSrcweir 				    const SvxFieldData* pField = pFieldItem->GetField();
121cdf0e10cSrcweir 				    if (pField->ISA(SvxURLField))
122cdf0e10cSrcweir 				    {
123cdf0e10cSrcweir 					    aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
124cdf0e10cSrcweir 					    aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
125cdf0e10cSrcweir 					    aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
126cdf0e10cSrcweir 						bField = true;
127cdf0e10cSrcweir 				    }
128cdf0e10cSrcweir                 }
129cdf0e10cSrcweir 			}
130cdf0e10cSrcweir 			if (!bField)
131cdf0e10cSrcweir 			{
132cdf0e10cSrcweir 				// use selected text as name for urls
133cdf0e10cSrcweir 				String sReturn = pOLV->GetSelected();
134cdf0e10cSrcweir 				sReturn.Erase(255);
135cdf0e10cSrcweir 				sReturn.EraseTrailingChars();
136cdf0e10cSrcweir 				aHLinkItem.SetName(sReturn);
137cdf0e10cSrcweir 			}
138cdf0e10cSrcweir 		}
139cdf0e10cSrcweir 		else
140cdf0e10cSrcweir 		{
141cdf0e10cSrcweir 			if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0)
142cdf0e10cSrcweir 			{
143cdf0e10cSrcweir                 bool bFound = false;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir                 SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
146cdf0e10cSrcweir                 if( pMarkedObj && (FmFormInventor == pMarkedObj->GetObjInventor()) )
147cdf0e10cSrcweir                 {
148cdf0e10cSrcweir 				    SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( pMarkedObj );
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 				    if(pUnoCtrl) try
151cdf0e10cSrcweir 				    {
152cdf0e10cSrcweir                         uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
153cdf0e10cSrcweir 					    uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
154cdf0e10cSrcweir 					    uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 					    form::FormButtonType eButtonType = form::FormButtonType_URL;
157cdf0e10cSrcweir                         const OUString sButtonType( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) );
158cdf0e10cSrcweir 					    if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) )
159cdf0e10cSrcweir 				        {
160cdf0e10cSrcweir 					        OUString aString;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 					        // Label
163cdf0e10cSrcweir                             const OUString sLabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ) );
164cdf0e10cSrcweir 					        if(xPropInfo->hasPropertyByName(sLabel))
165cdf0e10cSrcweir                             {
166cdf0e10cSrcweir 						        if( xPropSet->getPropertyValue(sLabel) >>= aString )
167cdf0e10cSrcweir     						        aHLinkItem.SetName(String( aString ));
168cdf0e10cSrcweir                             }
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 					        // URL
171cdf0e10cSrcweir                             const OUString sTargetURL(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ));
172cdf0e10cSrcweir 					        if(xPropInfo->hasPropertyByName(sTargetURL))
173cdf0e10cSrcweir                             {
174cdf0e10cSrcweir 						        if( xPropSet->getPropertyValue(sTargetURL) >>= aString )
175cdf0e10cSrcweir     						        aHLinkItem.SetURL(String( aString ));
176cdf0e10cSrcweir                             }
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 					        // Target
179cdf0e10cSrcweir                             const OUString sTargetFrame( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" ) );
180cdf0e10cSrcweir 					        if(xPropInfo->hasPropertyByName(sTargetFrame) )
181cdf0e10cSrcweir                             {
182cdf0e10cSrcweir 					            if( xPropSet->getPropertyValue(sTargetFrame) >>= aString )
183cdf0e10cSrcweir 						            aHLinkItem.SetTargetFrame(String( aString ));
184cdf0e10cSrcweir                             }
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 					        aHLinkItem.SetInsertMode(HLINK_BUTTON);
187cdf0e10cSrcweir                             bFound = true;
188cdf0e10cSrcweir 				        }
189cdf0e10cSrcweir                     }
190cdf0e10cSrcweir                     catch( uno::Exception& )
191cdf0e10cSrcweir                     {
192cdf0e10cSrcweir                     }
193cdf0e10cSrcweir 				}
194cdf0e10cSrcweir 
195cdf0e10cSrcweir                 // try interaction link
196cdf0e10cSrcweir                 if( !bFound && pMarkedObj )
197cdf0e10cSrcweir                 {
198cdf0e10cSrcweir                     SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj);
199cdf0e10cSrcweir                     if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) )
200cdf0e10cSrcweir                         aHLinkItem.SetURL( pInfo->GetBookmark());
201cdf0e10cSrcweir                     aHLinkItem.SetInsertMode(HLINK_BUTTON);
202cdf0e10cSrcweir                 }
203cdf0e10cSrcweir 			}
204cdf0e10cSrcweir 		}
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 		rSet.Put(aHLinkItem);
207cdf0e10cSrcweir 	}
208cdf0e10cSrcweir 	rSet.Put( SfxBoolItem( SID_READONLY_MODE, mbReadOnly ) );
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	// Ausgabequalitaet
211cdf0e10cSrcweir 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_COLOR ) ||
212cdf0e10cSrcweir 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_GRAYSCALE ) ||
213cdf0e10cSrcweir 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_BLACKWHITE ) ||
214cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_CONTRAST ) )
215cdf0e10cSrcweir 	{
216cdf0e10cSrcweir 		const sal_uLong nMode = (sal_Int32)GetActiveWindow()->GetDrawMode();
217cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_COLOR, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_COLOR == nMode) ) );
218cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_GRAYSCALE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_GRAYSCALE == nMode) ) );
219cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_BLACKWHITE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_BLACKWHITE == nMode) ) );
220cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_CONTRAST, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_CONTRAST == nMode) ) );
221cdf0e10cSrcweir 	}
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 	if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) )
224cdf0e10cSrcweir 	{
225cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) );
226cdf0e10cSrcweir 	}
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ATTR_YEAR2000) )
229cdf0e10cSrcweir 	{
230cdf0e10cSrcweir         FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
231cdf0e10cSrcweir         if (pFormShell != NULL)
232cdf0e10cSrcweir         {
233cdf0e10cSrcweir             sal_uInt16 nState = 0;
234cdf0e10cSrcweir             if (pFormShell->GetY2KState(nState))
235cdf0e10cSrcweir                 rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nState ) );
236cdf0e10cSrcweir             else
237cdf0e10cSrcweir                 rSet.DisableItem( SID_ATTR_YEAR2000 );
238cdf0e10cSrcweir         }
239cdf0e10cSrcweir 	}
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 	if ( !GetView()->GetTextEditOutliner() )
242cdf0e10cSrcweir 	{
243cdf0e10cSrcweir         SvtCJKOptions aCJKOptions;
244cdf0e10cSrcweir 		if( !aCJKOptions.IsChangeCaseMapEnabled() )
245cdf0e10cSrcweir         {
246cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
247cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
248cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
249cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
250cdf0e10cSrcweir         }
251cdf0e10cSrcweir         else
252cdf0e10cSrcweir         {
253cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
254cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
255cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
256cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
257cdf0e10cSrcweir         }
258cdf0e10cSrcweir 
259cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_SENTENCE_CASE );
260cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_TITLE_CASE );
261cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_TOGGLE_CASE );
262cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_UPPER );
263cdf0e10cSrcweir 		rSet.DisableItem( SID_TRANSLITERATE_LOWER );
264cdf0e10cSrcweir 		rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
265cdf0e10cSrcweir 		rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
266cdf0e10cSrcweir 		rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
267cdf0e10cSrcweir 		rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
268cdf0e10cSrcweir 	}
269cdf0e10cSrcweir 	else
270cdf0e10cSrcweir 	{
271cdf0e10cSrcweir         SvtCJKOptions aCJKOptions;
272cdf0e10cSrcweir 		if( !aCJKOptions.IsChangeCaseMapEnabled() )
273cdf0e10cSrcweir 		{
274cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
275cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
276cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
277cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
278cdf0e10cSrcweir             rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
279cdf0e10cSrcweir 			rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
280cdf0e10cSrcweir 			rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
281cdf0e10cSrcweir 			rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
282cdf0e10cSrcweir 		}
283cdf0e10cSrcweir         else
284cdf0e10cSrcweir         {
285cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
286cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
287cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
288cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
289cdf0e10cSrcweir         }
290cdf0e10cSrcweir 	}
291cdf0e10cSrcweir }
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 
294cdf0e10cSrcweir /*************************************************************************
295cdf0e10cSrcweir |*
296cdf0e10cSrcweir |* Status der Attribut-Items
297cdf0e10cSrcweir |*
298cdf0e10cSrcweir \************************************************************************/
299cdf0e10cSrcweir 
GetAttrState(SfxItemSet & rSet)300cdf0e10cSrcweir void DrawViewShell::GetAttrState( SfxItemSet& rSet )
301cdf0e10cSrcweir {
302cdf0e10cSrcweir 	SfxWhichIter	aIter( rSet );
303cdf0e10cSrcweir 	sal_uInt16			nWhich = aIter.FirstWhich();
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 	sal_Bool	bAttr = sal_False;
306cdf0e10cSrcweir 	SfxAllItemSet aAllSet( *rSet.GetPool() );
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 	while ( nWhich )
309cdf0e10cSrcweir 	{
310cdf0e10cSrcweir 		sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
311cdf0e10cSrcweir 			? GetPool().GetSlotId(nWhich)
312cdf0e10cSrcweir 			: nWhich;
313cdf0e10cSrcweir 		switch ( nSlotId )
314cdf0e10cSrcweir 		{
315*512ec161SZheng Fan 			case SID_ATTR_PARA_ADJUST_LEFT:
316*512ec161SZheng Fan 			{
317*512ec161SZheng Fan 				SfxItemSet aAttrs( GetDoc()->GetPool() );
318*512ec161SZheng Fan 				mpDrawView->GetAttributes( aAttrs );
319*512ec161SZheng Fan 
320*512ec161SZheng Fan 				SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
321*512ec161SZheng Fan 				SvxAdjust eAdj = aItem.GetAdjust();
322*512ec161SZheng Fan 				if ( eAdj == SVX_ADJUST_LEFT)
323*512ec161SZheng Fan 				{
324*512ec161SZheng Fan 					rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) );
325*512ec161SZheng Fan 				}
326*512ec161SZheng Fan 
327*512ec161SZheng Fan 				bAttr = sal_True;
328*512ec161SZheng Fan 
329*512ec161SZheng Fan 				Invalidate(nSlotId);
330*512ec161SZheng Fan 			}
331*512ec161SZheng Fan 			break;
332*512ec161SZheng Fan 			case SID_ATTR_PARA_ADJUST_CENTER:
333*512ec161SZheng Fan 			{
334*512ec161SZheng Fan 				SfxItemSet aAttrs( GetDoc()->GetPool() );
335*512ec161SZheng Fan 				mpDrawView->GetAttributes( aAttrs );
336*512ec161SZheng Fan 
337*512ec161SZheng Fan 				SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
338*512ec161SZheng Fan 				SvxAdjust eAdj = aItem.GetAdjust();
339*512ec161SZheng Fan 				if ( eAdj == SVX_ADJUST_CENTER)
340*512ec161SZheng Fan 				{
341*512ec161SZheng Fan 					rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) );
342*512ec161SZheng Fan 				}
343*512ec161SZheng Fan 
344*512ec161SZheng Fan 				bAttr = sal_True;
345*512ec161SZheng Fan 
346*512ec161SZheng Fan 				Invalidate(nSlotId);
347*512ec161SZheng Fan 			}
348*512ec161SZheng Fan 			break;
349*512ec161SZheng Fan 			case SID_ATTR_PARA_ADJUST_RIGHT:
350*512ec161SZheng Fan 			{
351*512ec161SZheng Fan 				SfxItemSet aAttrs( GetDoc()->GetPool() );
352*512ec161SZheng Fan 				mpDrawView->GetAttributes( aAttrs );
353*512ec161SZheng Fan 
354*512ec161SZheng Fan 				SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
355*512ec161SZheng Fan 				SvxAdjust eAdj = aItem.GetAdjust();
356*512ec161SZheng Fan 				if ( eAdj == SVX_ADJUST_RIGHT)
357*512ec161SZheng Fan 				{
358*512ec161SZheng Fan 					rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) );
359*512ec161SZheng Fan 				}
360*512ec161SZheng Fan 
361*512ec161SZheng Fan 				bAttr = sal_True;
362*512ec161SZheng Fan 
363*512ec161SZheng Fan 				Invalidate(nSlotId);
364*512ec161SZheng Fan 			}
365*512ec161SZheng Fan 			break;
366*512ec161SZheng Fan 			case SID_ATTR_PARA_ADJUST_BLOCK:
367*512ec161SZheng Fan 			{
368*512ec161SZheng Fan 				SfxItemSet aAttrs( GetDoc()->GetPool() );
369*512ec161SZheng Fan 				mpDrawView->GetAttributes( aAttrs );
370*512ec161SZheng Fan 
371*512ec161SZheng Fan 				SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
372*512ec161SZheng Fan 				SvxAdjust eAdj = aItem.GetAdjust();
373*512ec161SZheng Fan 				if ( eAdj == SVX_ADJUST_BLOCK)
374*512ec161SZheng Fan 				{
375*512ec161SZheng Fan 					rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) );
376*512ec161SZheng Fan 				}
377*512ec161SZheng Fan 
378*512ec161SZheng Fan 				bAttr = sal_True;
379*512ec161SZheng Fan 
380*512ec161SZheng Fan 				Invalidate(nSlotId);
381*512ec161SZheng Fan 			}
382*512ec161SZheng Fan 			break;
383766ce4d0SZheng Fan 			case SID_ATTR_PARA_LRSPACE:
384766ce4d0SZheng Fan 			{
385766ce4d0SZheng Fan 				SfxItemSet aAttrs( GetDoc()->GetPool() );
386766ce4d0SZheng Fan 				mpDrawView->GetAttributes( aAttrs );
387766ce4d0SZheng Fan 				SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrs.Get( EE_PARA_LRSPACE ) );
388766ce4d0SZheng Fan 				aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE);
389766ce4d0SZheng Fan 				rSet.Put(aLRSpace);
390766ce4d0SZheng Fan 				bAttr = sal_True;
391766ce4d0SZheng Fan 				Invalidate(SID_ATTR_PARA_LRSPACE);
392766ce4d0SZheng Fan 			}
393766ce4d0SZheng Fan 			break;
394766ce4d0SZheng Fan 			case SID_ATTR_PARA_LINESPACE:
395766ce4d0SZheng Fan 			{
396766ce4d0SZheng Fan 				SfxItemSet aAttrs( GetDoc()->GetPool() );
397766ce4d0SZheng Fan 				mpDrawView->GetAttributes( aAttrs );
398766ce4d0SZheng Fan 				SvxLineSpacingItem aLineLR = ( (const SvxLineSpacingItem&) aAttrs.Get( EE_PARA_SBL ) );
399766ce4d0SZheng Fan 				rSet.Put(aLineLR);
400766ce4d0SZheng Fan 				bAttr = sal_True;
401766ce4d0SZheng Fan 				Invalidate(SID_ATTR_PARA_LINESPACE);
402766ce4d0SZheng Fan 			}
403766ce4d0SZheng Fan 			break;
404766ce4d0SZheng Fan 			case SID_ATTR_PARA_ULSPACE:
405766ce4d0SZheng Fan 			{
406766ce4d0SZheng Fan 				SfxItemSet aAttrs( GetDoc()->GetPool() );
407766ce4d0SZheng Fan 				mpDrawView->GetAttributes( aAttrs );
408766ce4d0SZheng Fan 				SvxULSpaceItem aULSP = ( (const SvxULSpaceItem&) aAttrs.Get( EE_PARA_ULSPACE ) );
409766ce4d0SZheng Fan 				aULSP.SetWhich(SID_ATTR_PARA_ULSPACE);
410766ce4d0SZheng Fan 				rSet.Put(aULSP);
411766ce4d0SZheng Fan 				bAttr = sal_True;
412766ce4d0SZheng Fan 				Invalidate(SID_ATTR_PARA_ULSPACE);
413766ce4d0SZheng Fan 			}
414766ce4d0SZheng Fan 			break;
415cdf0e10cSrcweir 			case SID_ATTR_FILL_STYLE:
416cdf0e10cSrcweir 			case SID_ATTR_FILL_COLOR:
417cdf0e10cSrcweir 			case SID_ATTR_FILL_GRADIENT:
418cdf0e10cSrcweir 			case SID_ATTR_FILL_HATCH:
419cdf0e10cSrcweir 			case SID_ATTR_FILL_BITMAP:
420cdf0e10cSrcweir 			case SID_ATTR_FILL_SHADOW:
421d5370dc8SArmin Le Grand             case SID_ATTR_FILL_TRANSPARENCE:
422d5370dc8SArmin Le Grand             case SID_ATTR_FILL_FLOATTRANSPARENCE:
423cdf0e10cSrcweir 			case SID_ATTR_LINE_STYLE:
424cdf0e10cSrcweir 			case SID_ATTR_LINE_DASH:
425cdf0e10cSrcweir 			case SID_ATTR_LINE_WIDTH:
426cdf0e10cSrcweir 			case SID_ATTR_LINE_COLOR:
427d5370dc8SArmin Le Grand             case SID_ATTR_LINE_TRANSPARENCE:
428d5370dc8SArmin Le Grand             case SID_ATTR_LINE_JOINT:
429d5370dc8SArmin Le Grand             case SID_ATTR_LINE_CAP:
430cdf0e10cSrcweir 			case SID_ATTR_TEXT_FITTOSIZE:
431766ce4d0SZheng Fan 			case SID_ATTR_CHAR_FONT:
432766ce4d0SZheng Fan 			case SID_ATTR_CHAR_FONTHEIGHT:
433766ce4d0SZheng Fan 			case SID_ATTR_CHAR_SHADOWED:
434766ce4d0SZheng Fan 			case SID_ATTR_CHAR_POSTURE:
435766ce4d0SZheng Fan 			case SID_ATTR_CHAR_UNDERLINE:
436766ce4d0SZheng Fan 			case SID_ATTR_CHAR_STRIKEOUT:
437766ce4d0SZheng Fan 			case SID_ATTR_CHAR_WEIGHT:
438766ce4d0SZheng Fan 			case SID_ATTR_CHAR_COLOR:
439766ce4d0SZheng Fan 			case SID_ATTR_CHAR_KERNING:
440766ce4d0SZheng Fan 			case SID_SET_SUB_SCRIPT:
441766ce4d0SZheng Fan 			case SID_SET_SUPER_SCRIPT:
442cdf0e10cSrcweir 			{
443cdf0e10cSrcweir 				bAttr = sal_True;
444cdf0e10cSrcweir 			}
445cdf0e10cSrcweir 			break;
446cdf0e10cSrcweir 
447cdf0e10cSrcweir 			case SID_HYPHENATION:
448cdf0e10cSrcweir 			{
449cdf0e10cSrcweir 				SfxItemSet aAttrs( GetDoc()->GetPool() );
450cdf0e10cSrcweir 				mpDrawView->GetAttributes( aAttrs );
451cdf0e10cSrcweir 				if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE )
452cdf0e10cSrcweir 				{
453cdf0e10cSrcweir 					sal_Bool bValue = ( (const SfxBoolItem&) aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue();
454cdf0e10cSrcweir 					rSet.Put( SfxBoolItem( SID_HYPHENATION, bValue ) );
455cdf0e10cSrcweir 				}
456cdf0e10cSrcweir 			}
457cdf0e10cSrcweir 			break;
458cdf0e10cSrcweir 
459cdf0e10cSrcweir 			case SID_STYLE_FAMILY2:
460cdf0e10cSrcweir 			case SID_STYLE_FAMILY3:
461cdf0e10cSrcweir 			case SID_STYLE_FAMILY5:
462cdf0e10cSrcweir 			case SID_STYLE_APPLY: // StyleControl
463cdf0e10cSrcweir 			{
464cdf0e10cSrcweir 				SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet();
465cdf0e10cSrcweir 				if( pStyleSheet )
466cdf0e10cSrcweir 				{
467cdf0e10cSrcweir 					if( nSlotId != SID_STYLE_APPLY && !mpDrawView->AreObjectsMarked() )
468cdf0e10cSrcweir 					{
469cdf0e10cSrcweir 						SfxTemplateItem aTmpItem( nWhich, String() );
470cdf0e10cSrcweir 						aAllSet.Put( aTmpItem, aTmpItem.Which()  );
471cdf0e10cSrcweir 					}
472cdf0e10cSrcweir 					else
473cdf0e10cSrcweir 					{
474cdf0e10cSrcweir 						if (pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
475cdf0e10cSrcweir 							pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
476cdf0e10cSrcweir 
477cdf0e10cSrcweir 						if( pStyleSheet )
478cdf0e10cSrcweir 						{
479cdf0e10cSrcweir 							SfxStyleFamily eFamily = pStyleSheet->GetFamily();
480cdf0e10cSrcweir 
481cdf0e10cSrcweir 							if ((eFamily == SD_STYLE_FAMILY_GRAPHICS &&		nSlotId == SID_STYLE_FAMILY2)       ||
482cdf0e10cSrcweir 								(eFamily == SD_STYLE_FAMILY_CELL	 &&	nSlotId == SID_STYLE_FAMILY3)		||
483cdf0e10cSrcweir 								(eFamily == SD_STYLE_FAMILY_PSEUDO &&	nSlotId == SID_STYLE_FAMILY5))
484cdf0e10cSrcweir 							{
485cdf0e10cSrcweir 								SfxTemplateItem aTmpItem ( nWhich, pStyleSheet->GetName() );
486cdf0e10cSrcweir 								aAllSet.Put( aTmpItem, aTmpItem.Which()  );
487cdf0e10cSrcweir 							}
488cdf0e10cSrcweir 							else
489cdf0e10cSrcweir 							{
490cdf0e10cSrcweir 								SfxTemplateItem aTmpItem(nWhich, String());
491cdf0e10cSrcweir 								aAllSet.Put(aTmpItem,aTmpItem.Which()  );
492cdf0e10cSrcweir 							}
493cdf0e10cSrcweir 						}
494cdf0e10cSrcweir 					}
495cdf0e10cSrcweir 				}
496cdf0e10cSrcweir 				else
497cdf0e10cSrcweir 				{	SfxTemplateItem aItem( nWhich, String() );
498cdf0e10cSrcweir 					aAllSet.Put( aItem, aItem.Which() );
499cdf0e10cSrcweir 					// rSet.DisableItem( nWhich );
500cdf0e10cSrcweir 				}
501cdf0e10cSrcweir 			}
502cdf0e10cSrcweir 			break;
503cdf0e10cSrcweir 
504cdf0e10cSrcweir 			case SID_SET_DEFAULT:
505cdf0e10cSrcweir 			{
506cdf0e10cSrcweir                 if( !mpDrawView->GetMarkedObjectList().GetMarkCount() ||
507cdf0e10cSrcweir                     ( !mpDrawView->IsTextEdit() && !mpDrawView->GetStyleSheet() )
508cdf0e10cSrcweir                   )
509cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
510cdf0e10cSrcweir 			}
511cdf0e10cSrcweir 			break;
512cdf0e10cSrcweir 
513cdf0e10cSrcweir 			case SID_STYLE_WATERCAN:
514cdf0e10cSrcweir 			{
515cdf0e10cSrcweir 				ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
516cdf0e10cSrcweir 				if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
517cdf0e10cSrcweir 					rSet.Put(SfxBoolItem(nWhich,sal_False));
518cdf0e10cSrcweir 				else
519cdf0e10cSrcweir 				{
520cdf0e10cSrcweir 					SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan());
521cdf0e10cSrcweir 					aAllSet.Put( aItem, aItem.Which());
522cdf0e10cSrcweir 				}
523cdf0e10cSrcweir 			}
524cdf0e10cSrcweir 			break;
525cdf0e10cSrcweir 
526cdf0e10cSrcweir 			case SID_STYLE_NEW:
527cdf0e10cSrcweir 			{
528cdf0e10cSrcweir 				ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
529cdf0e10cSrcweir 				if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
530cdf0e10cSrcweir 					rSet.DisableItem(nWhich);
531cdf0e10cSrcweir 			}
532cdf0e10cSrcweir 			break;
533cdf0e10cSrcweir 
534cdf0e10cSrcweir 			case SID_STYLE_DRAGHIERARCHIE:
535cdf0e10cSrcweir 			{
536cdf0e10cSrcweir 				ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
537cdf0e10cSrcweir 				if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
538cdf0e10cSrcweir 					rSet.DisableItem(nWhich);
539cdf0e10cSrcweir 			}
540cdf0e10cSrcweir 			break;
541cdf0e10cSrcweir 
542cdf0e10cSrcweir 			case SID_STYLE_NEW_BY_EXAMPLE:
543cdf0e10cSrcweir 			{
544cdf0e10cSrcweir 				// PseudoStyleSheets koennen nicht 'by Example' erzeugt werden;
545cdf0e10cSrcweir 				// normale StyleSheets brauchen dafuer ein selektiertes Objekt
546cdf0e10cSrcweir 				ISfxTemplateCommon* pTemplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
547cdf0e10cSrcweir 				if (pTemplCommon)
548cdf0e10cSrcweir 				{
549cdf0e10cSrcweir 					if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
550cdf0e10cSrcweir 					{
551cdf0e10cSrcweir 						rSet.DisableItem(nWhich);
552cdf0e10cSrcweir 					}
553cdf0e10cSrcweir 					else if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_GRAPHICS)
554cdf0e10cSrcweir 					{
555cdf0e10cSrcweir 						if (!mpDrawView->AreObjectsMarked())
556cdf0e10cSrcweir 						{
557cdf0e10cSrcweir 							rSet.DisableItem(nWhich);
558cdf0e10cSrcweir 						}
559cdf0e10cSrcweir 					}
560cdf0e10cSrcweir 				}
561cdf0e10cSrcweir 				// falls (noch) kein Gestalter da ist, muessen wir uns auf den
562cdf0e10cSrcweir 				// View-Zustand zurueckziehen; eine aktuell eingestellte Familie
563cdf0e10cSrcweir 				// kann nicht beruecksichtigt werden
564cdf0e10cSrcweir 				else
565cdf0e10cSrcweir 				{
566cdf0e10cSrcweir 					if (!mpDrawView->AreObjectsMarked())
567cdf0e10cSrcweir 					{
568cdf0e10cSrcweir 						rSet.DisableItem(nWhich);
569cdf0e10cSrcweir 					}
570cdf0e10cSrcweir 				}
571cdf0e10cSrcweir 
572cdf0e10cSrcweir 			}
573cdf0e10cSrcweir 			break;
574cdf0e10cSrcweir 
575cdf0e10cSrcweir 			case SID_STYLE_UPDATE_BY_EXAMPLE:
576cdf0e10cSrcweir 			{
577cdf0e10cSrcweir 				if (!mpDrawView->AreObjectsMarked())
578cdf0e10cSrcweir 				{
579cdf0e10cSrcweir 					rSet.DisableItem(nWhich);
580cdf0e10cSrcweir 				}
581cdf0e10cSrcweir 			}
582cdf0e10cSrcweir 			break;
5831ff378efSZheng Fan 			case FN_BUL_NUM_RULE_INDEX:
5841ff378efSZheng Fan 			case FN_NUM_NUM_RULE_INDEX:
5851ff378efSZheng Fan 			{
5861ff378efSZheng Fan 				SfxItemSet aEditAttr( GetDoc()->GetPool() );
5871ff378efSZheng Fan 				mpDrawView->GetAttributes( aEditAttr );
5881ff378efSZheng Fan 
5891ff378efSZheng Fan 				SfxItemSet aNewAttr( GetPool(), EE_ITEMS_START, EE_ITEMS_END );
5901ff378efSZheng Fan 				aNewAttr.Put( aEditAttr, sal_False );
5911ff378efSZheng Fan 
5921ff378efSZheng Fan 
5931ff378efSZheng Fan 				sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
5941ff378efSZheng Fan 				SvxNumRule* pNumRule = NULL;
5951ff378efSZheng Fan 				const SfxPoolItem* pTmpItem=NULL;
5961ff378efSZheng Fan 				sal_uInt16 nNumItemId = SID_ATTR_NUMBERING_RULE;
5971ff378efSZheng Fan 
5981ff378efSZheng Fan 				//if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem))
5991ff378efSZheng Fan 				//	nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue();
6001ff378efSZheng Fan 				rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
6011ff378efSZheng Fan 				rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
6021ff378efSZheng Fan 				nActNumLvl = mpDrawView->GetSelectionLevel();
6031ff378efSZheng Fan 				pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId);
6041ff378efSZheng Fan 
6051ff378efSZheng Fan 				if (pTmpItem)
6061ff378efSZheng Fan 					pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule());
6071ff378efSZheng Fan 
6081ff378efSZheng Fan 				if ( pNumRule )
6091ff378efSZheng Fan 				{
6101ff378efSZheng Fan 					sal_uInt16 nMask = 1;
6111ff378efSZheng Fan 					sal_uInt16 nCount = 0;
6121ff378efSZheng Fan 					sal_uInt16 nCurLevel = (sal_uInt16)0xFFFF;
6131ff378efSZheng Fan 					for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
6141ff378efSZheng Fan 					{
6151ff378efSZheng Fan 						if(nActNumLvl & nMask)
6161ff378efSZheng Fan 						{
6171ff378efSZheng Fan 							nCount++;
6181ff378efSZheng Fan 							nCurLevel = i;
6191ff378efSZheng Fan 						}
6201ff378efSZheng Fan 						nMask <<= 1;
6211ff378efSZheng Fan 					}
6221ff378efSZheng Fan 					if ( nCount == 1 )
6231ff378efSZheng Fan 					{
6241ff378efSZheng Fan 						sal_Bool bBullets = sal_False;
6251ff378efSZheng Fan 						const SvxNumberFormat* pNumFmt = pNumRule->Get(nCurLevel);
6261ff378efSZheng Fan 						if ( pNumFmt )
6271ff378efSZheng Fan 						{
6281ff378efSZheng Fan 							switch(pNumFmt->GetNumberingType())
6291ff378efSZheng Fan 							{
6301ff378efSZheng Fan 								case SVX_NUM_CHAR_SPECIAL:
6311ff378efSZheng Fan 								case SVX_NUM_BITMAP:
6321ff378efSZheng Fan 									bBullets = sal_True;
6331ff378efSZheng Fan 									break;
6341ff378efSZheng Fan 
6351ff378efSZheng Fan 								default:
6361ff378efSZheng Fan 									bBullets = sal_False;
6371ff378efSZheng Fan 							}
6381ff378efSZheng Fan 
6391ff378efSZheng Fan 							rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
6401ff378efSZheng Fan 							rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
6411ff378efSZheng Fan 							if ( bBullets )
6421ff378efSZheng Fan 							{
6431ff378efSZheng Fan 								NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
6441ff378efSZheng Fan 								if ( pBullets )
6451ff378efSZheng Fan 								{
6461ff378efSZheng Fan 									sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(*pNumRule,nActNumLvl);
6471ff378efSZheng Fan 									 rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex));
6481ff378efSZheng Fan 								}
6491ff378efSZheng Fan 							}else
6501ff378efSZheng Fan 							{
6511ff378efSZheng Fan 								NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
6521ff378efSZheng Fan 								if ( pNumbering )
6531ff378efSZheng Fan 								{
6541ff378efSZheng Fan 									sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(*pNumRule,nActNumLvl);
6551ff378efSZheng Fan 									 rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex));
6561ff378efSZheng Fan 								}
6571ff378efSZheng Fan 							}
6581ff378efSZheng Fan 						}
6591ff378efSZheng Fan 					}
6601ff378efSZheng Fan 				}
6611ff378efSZheng Fan 			}
6621ff378efSZheng Fan             		break;
6631ff378efSZheng Fan 			//End
6641ff378efSZheng Fan 			// Added by Li Hui for story 179.
6651ff378efSZheng Fan 			case FN_NUM_BULLET_ON:
6661ff378efSZheng Fan 			case FN_NUM_NUMBERING_ON:
6671ff378efSZheng Fan 			{
6681ff378efSZheng Fan 				sal_Bool bEnable = sal_False;
6691ff378efSZheng Fan 				const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
670cc69f169SZheng Fan 				const sal_uInt32 nMarkCount = rMarkList.GetMarkCount();
671cc69f169SZheng Fan 				for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++)
6721ff378efSZheng Fan 				{
6731ff378efSZheng Fan 					SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(rMarkList.GetMark(nIndex)->GetMarkedSdrObj());
6741ff378efSZheng Fan 					if (pTextObj && pTextObj->GetObjInventor() == SdrInventor)
6751ff378efSZheng Fan 					{
6761ff378efSZheng Fan 						if (pTextObj->GetObjIdentifier() != OBJ_OLE2)
6771ff378efSZheng Fan 						{
6781ff378efSZheng Fan 							bEnable = sal_True;
6791ff378efSZheng Fan 							break;
6801ff378efSZheng Fan 						}
6811ff378efSZheng Fan 					}
6821ff378efSZheng Fan 				}
6831ff378efSZheng Fan 				if (bEnable)
6841ff378efSZheng Fan 				{
6851ff378efSZheng Fan 					rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_False));
6861ff378efSZheng Fan 					rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON, sal_False));
6871ff378efSZheng Fan 				}
6881ff378efSZheng Fan 				else
6891ff378efSZheng Fan 				{
6901ff378efSZheng Fan 					rSet.DisableItem(FN_NUM_BULLET_ON);
6911ff378efSZheng Fan 					rSet.DisableItem(FN_NUM_NUMBERING_ON);
6921ff378efSZheng Fan 				}
6931ff378efSZheng Fan 			}
6941ff378efSZheng Fan 			break;
695cdf0e10cSrcweir 		}
696cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
697cdf0e10cSrcweir 	}
698cdf0e10cSrcweir 
699cdf0e10cSrcweir 	SfxItemSet* pSet = NULL;
700cdf0e10cSrcweir 
701cdf0e10cSrcweir 	if( bAttr )
702cdf0e10cSrcweir 	{
703cdf0e10cSrcweir 		pSet = new SfxItemSet( GetDoc()->GetPool() );
704cdf0e10cSrcweir 		mpDrawView->GetAttributes( *pSet );
705cdf0e10cSrcweir 		rSet.Put( *pSet, sal_False );
706cdf0e10cSrcweir 	}
707cdf0e10cSrcweir 
708cdf0e10cSrcweir 	rSet.Put( aAllSet, sal_False );
709cdf0e10cSrcweir 
710cdf0e10cSrcweir 	// Flaechen und/oder Linienattribute wurden geaendert
711cdf0e10cSrcweir 	if( bAttr && pSet )
712cdf0e10cSrcweir 	{
713cdf0e10cSrcweir 		// Wenn die View selektierte Objekte besitzt, muessen entspr. Items
714cdf0e10cSrcweir 		// von SFX_ITEM_DEFAULT (_ON) auf SFX_ITEM_DISABLED geaendert werden
715cdf0e10cSrcweir 		if( mpDrawView->AreObjectsMarked() )
716cdf0e10cSrcweir 		{
717cdf0e10cSrcweir 			SfxWhichIter aNewIter( *pSet, XATTR_LINE_FIRST, XATTR_FILL_LAST );
718cdf0e10cSrcweir 			nWhich = aNewIter.FirstWhich();
719cdf0e10cSrcweir 			while( nWhich )
720cdf0e10cSrcweir 			{
721cdf0e10cSrcweir 				if( SFX_ITEM_DEFAULT == pSet->GetItemState( nWhich ) )
722cdf0e10cSrcweir 				{
723cdf0e10cSrcweir 					rSet.ClearItem( nWhich );
724cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
725cdf0e10cSrcweir 				}
726cdf0e10cSrcweir 				nWhich = aNewIter.NextWhich();
727cdf0e10cSrcweir 			}
728cdf0e10cSrcweir 		}
729766ce4d0SZheng Fan 
730766ce4d0SZheng Fan 		SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE );
731766ce4d0SZheng Fan 		if ( eState == SFX_ITEM_DONTCARE )
732766ce4d0SZheng Fan 		{
733766ce4d0SZheng Fan 			rSet.InvalidateItem(EE_PARA_LRSPACE);
734766ce4d0SZheng Fan 			rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
735766ce4d0SZheng Fan 		}
736766ce4d0SZheng Fan 		eState = pSet->GetItemState( EE_PARA_SBL );
737766ce4d0SZheng Fan 		if ( eState == SFX_ITEM_DONTCARE )
738766ce4d0SZheng Fan 		{
739766ce4d0SZheng Fan 			rSet.InvalidateItem(EE_PARA_SBL);
740766ce4d0SZheng Fan 			rSet.InvalidateItem(SID_ATTR_PARA_LINESPACE);
741766ce4d0SZheng Fan 		}
742766ce4d0SZheng Fan 		eState = pSet->GetItemState( EE_PARA_ULSPACE );
743766ce4d0SZheng Fan 		if ( eState == SFX_ITEM_DONTCARE )
744766ce4d0SZheng Fan 		{
745766ce4d0SZheng Fan 			rSet.InvalidateItem(EE_PARA_ULSPACE);
746766ce4d0SZheng Fan 			rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE);
747cdf0e10cSrcweir 		}
748cdf0e10cSrcweir 
749766ce4d0SZheng Fan 		SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
750766ce4d0SZheng Fan 						pSet->Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
751766ce4d0SZheng Fan 		if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
752766ce4d0SZheng Fan 		{
753766ce4d0SZheng Fan 			rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) );
754766ce4d0SZheng Fan 		}
755766ce4d0SZheng Fan 		else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
756766ce4d0SZheng Fan 		{
757766ce4d0SZheng Fan 			rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) );
758766ce4d0SZheng Fan 		}
759766ce4d0SZheng Fan 
760766ce4d0SZheng Fan 		eState = pSet->GetItemState( EE_CHAR_KERNING, sal_True );
761766ce4d0SZheng Fan 		if ( eState == SFX_ITEM_DONTCARE )
762766ce4d0SZheng Fan 		{
763766ce4d0SZheng Fan 			rSet.InvalidateItem(EE_CHAR_KERNING);
764766ce4d0SZheng Fan 			rSet.InvalidateItem(SID_ATTR_CHAR_KERNING);
765766ce4d0SZheng Fan 		}
766766ce4d0SZheng Fan 		delete pSet;
767766ce4d0SZheng Fan 	}
768cdf0e10cSrcweir }
769cdf0e10cSrcweir 
770cdf0e10cSrcweir 
771cdf0e10cSrcweir /*************************************************************************
772cdf0e10cSrcweir |*
773cdf0e10cSrcweir |* Text der Selektion zurueckgeben
774cdf0e10cSrcweir |*
775cdf0e10cSrcweir \************************************************************************/
776cdf0e10cSrcweir 
GetSelectionText(sal_Bool bCompleteWords)777cdf0e10cSrcweir String DrawViewShell::GetSelectionText(sal_Bool bCompleteWords)
778cdf0e10cSrcweir {
779cdf0e10cSrcweir 	String aStrSelection;
780cdf0e10cSrcweir 	::Outliner* pOl = mpDrawView->GetTextEditOutliner();
781cdf0e10cSrcweir 	OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
782cdf0e10cSrcweir 
783cdf0e10cSrcweir 	if (pOl && pOlView)
784cdf0e10cSrcweir 	{
785cdf0e10cSrcweir 		if (bCompleteWords)
786cdf0e10cSrcweir 		{
787cdf0e10cSrcweir 			ESelection aSel = pOlView->GetSelection();
788cdf0e10cSrcweir 			String aStrCurrentDelimiters = pOl->GetWordDelimiters();
789cdf0e10cSrcweir 
790cdf0e10cSrcweir 			pOl->SetWordDelimiters( String( RTL_CONSTASCII_USTRINGPARAM( " .,;\"'" )));
791cdf0e10cSrcweir 			aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos );
792cdf0e10cSrcweir 			pOl->SetWordDelimiters( aStrCurrentDelimiters );
793cdf0e10cSrcweir 		}
794cdf0e10cSrcweir 		else
795cdf0e10cSrcweir 		{
796cdf0e10cSrcweir 			aStrSelection = pOlView->GetSelected();
797cdf0e10cSrcweir 		}
798cdf0e10cSrcweir 	}
799cdf0e10cSrcweir 
800cdf0e10cSrcweir 	return (aStrSelection);
801cdf0e10cSrcweir }
802cdf0e10cSrcweir 
803cdf0e10cSrcweir /*************************************************************************
804cdf0e10cSrcweir |*
805cdf0e10cSrcweir |* Ist etwas selektiert?
806cdf0e10cSrcweir |*
807cdf0e10cSrcweir \************************************************************************/
808cdf0e10cSrcweir 
HasSelection(sal_Bool bText) const809cdf0e10cSrcweir sal_Bool DrawViewShell::HasSelection(sal_Bool bText) const
810cdf0e10cSrcweir {
811cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
812cdf0e10cSrcweir 
813cdf0e10cSrcweir 	if (bText)
814cdf0e10cSrcweir 	{
815cdf0e10cSrcweir 		OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
816cdf0e10cSrcweir 
817cdf0e10cSrcweir 		if (pOlView && pOlView->GetSelected().Len() != 0)
818cdf0e10cSrcweir 		{
819cdf0e10cSrcweir 			bReturn = sal_True;
820cdf0e10cSrcweir 		}
821cdf0e10cSrcweir 	}
822cdf0e10cSrcweir 	else if (mpDrawView->GetMarkedObjectList().GetMarkCount() != 0)
823cdf0e10cSrcweir 	{
824cdf0e10cSrcweir 		bReturn = sal_True;
825cdf0e10cSrcweir 	}
826cdf0e10cSrcweir 
827cdf0e10cSrcweir 	return bReturn;
828cdf0e10cSrcweir }
829cdf0e10cSrcweir 
830cdf0e10cSrcweir } // end of namespace sd
831