xref: /trunk/main/sd/source/ui/view/drviewsf.cxx (revision 1ff378ef29d061c5ebed689ca488bcdadd10692f)
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>
80cdf0e10cSrcweir using ::rtl::OUString;
81cdf0e10cSrcweir using namespace ::com::sun::star;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir namespace sd {
84cdf0e10cSrcweir 
85cdf0e10cSrcweir /*************************************************************************
86cdf0e10cSrcweir |*
87cdf0e10cSrcweir |* Status von Controller-SfxSlots setzen
88cdf0e10cSrcweir |*
89cdf0e10cSrcweir \************************************************************************/
90cdf0e10cSrcweir 
91cdf0e10cSrcweir void DrawViewShell::GetCtrlState(SfxItemSet &rSet)
92cdf0e10cSrcweir {
93cdf0e10cSrcweir     if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN)
94cdf0e10cSrcweir     {
95cdf0e10cSrcweir         // "Letzte Version" vom SFx en/disablen lassen
96cdf0e10cSrcweir         GetViewFrame()->GetSlotState (SID_RELOAD, NULL, &rSet);
97cdf0e10cSrcweir     }
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK))
100cdf0e10cSrcweir     {
101cdf0e10cSrcweir         SvxHyperlinkItem aHLinkItem;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir         OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir         if (pOLV)
106cdf0e10cSrcweir         {
107cdf0e10cSrcweir             bool bField = false;
108cdf0e10cSrcweir             const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
109cdf0e10cSrcweir             if (pFieldItem)
110cdf0e10cSrcweir             {
111cdf0e10cSrcweir                 ESelection aSel = pOLV->GetSelection();
112cdf0e10cSrcweir                 if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
113cdf0e10cSrcweir                 {
114cdf0e10cSrcweir                     const SvxFieldData* pField = pFieldItem->GetField();
115cdf0e10cSrcweir                     if (pField->ISA(SvxURLField))
116cdf0e10cSrcweir                     {
117cdf0e10cSrcweir                         aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
118cdf0e10cSrcweir                         aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
119cdf0e10cSrcweir                         aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
120cdf0e10cSrcweir                         bField = true;
121cdf0e10cSrcweir                     }
122cdf0e10cSrcweir                 }
123cdf0e10cSrcweir             }
124cdf0e10cSrcweir             if (!bField)
125cdf0e10cSrcweir             {
126cdf0e10cSrcweir                 // use selected text as name for urls
127cdf0e10cSrcweir                 String sReturn = pOLV->GetSelected();
128cdf0e10cSrcweir                 sReturn.Erase(255);
129cdf0e10cSrcweir                 sReturn.EraseTrailingChars();
130cdf0e10cSrcweir                 aHLinkItem.SetName(sReturn);
131cdf0e10cSrcweir             }
132cdf0e10cSrcweir         }
133cdf0e10cSrcweir         else
134cdf0e10cSrcweir         {
135cdf0e10cSrcweir             if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0)
136cdf0e10cSrcweir             {
137cdf0e10cSrcweir                 bool bFound = false;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir                 SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
140cdf0e10cSrcweir                 if( pMarkedObj && (FmFormInventor == pMarkedObj->GetObjInventor()) )
141cdf0e10cSrcweir                 {
142cdf0e10cSrcweir                     SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( pMarkedObj );
143cdf0e10cSrcweir 
144cdf0e10cSrcweir                     if(pUnoCtrl) try
145cdf0e10cSrcweir                     {
146cdf0e10cSrcweir                         uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
147cdf0e10cSrcweir                         uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
148cdf0e10cSrcweir                         uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
149cdf0e10cSrcweir 
150cdf0e10cSrcweir                         form::FormButtonType eButtonType = form::FormButtonType_URL;
151cdf0e10cSrcweir                         const OUString sButtonType( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) );
152cdf0e10cSrcweir                         if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) )
153cdf0e10cSrcweir                         {
154cdf0e10cSrcweir                             OUString aString;
155cdf0e10cSrcweir 
156cdf0e10cSrcweir                             // Label
157cdf0e10cSrcweir                             const OUString sLabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ) );
158cdf0e10cSrcweir                             if(xPropInfo->hasPropertyByName(sLabel))
159cdf0e10cSrcweir                             {
160cdf0e10cSrcweir                                 if( xPropSet->getPropertyValue(sLabel) >>= aString )
161cdf0e10cSrcweir                                     aHLinkItem.SetName(String( aString ));
162cdf0e10cSrcweir                             }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir                             // URL
165cdf0e10cSrcweir                             const OUString sTargetURL(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ));
166cdf0e10cSrcweir                             if(xPropInfo->hasPropertyByName(sTargetURL))
167cdf0e10cSrcweir                             {
168cdf0e10cSrcweir                                 if( xPropSet->getPropertyValue(sTargetURL) >>= aString )
169cdf0e10cSrcweir                                     aHLinkItem.SetURL(String( aString ));
170cdf0e10cSrcweir                             }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir                             // Target
173cdf0e10cSrcweir                             const OUString sTargetFrame( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" ) );
174cdf0e10cSrcweir                             if(xPropInfo->hasPropertyByName(sTargetFrame) )
175cdf0e10cSrcweir                             {
176cdf0e10cSrcweir                                 if( xPropSet->getPropertyValue(sTargetFrame) >>= aString )
177cdf0e10cSrcweir                                     aHLinkItem.SetTargetFrame(String( aString ));
178cdf0e10cSrcweir                             }
179cdf0e10cSrcweir 
180cdf0e10cSrcweir                             aHLinkItem.SetInsertMode(HLINK_BUTTON);
181cdf0e10cSrcweir                             bFound = true;
182cdf0e10cSrcweir                         }
183cdf0e10cSrcweir                     }
184cdf0e10cSrcweir                     catch( uno::Exception& )
185cdf0e10cSrcweir                     {
186cdf0e10cSrcweir                     }
187cdf0e10cSrcweir                 }
188cdf0e10cSrcweir 
189cdf0e10cSrcweir                 // try interaction link
190cdf0e10cSrcweir                 if( !bFound && pMarkedObj )
191cdf0e10cSrcweir                 {
192cdf0e10cSrcweir                     SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj);
193cdf0e10cSrcweir                     if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) )
194cdf0e10cSrcweir                         aHLinkItem.SetURL( pInfo->GetBookmark());
195cdf0e10cSrcweir                     aHLinkItem.SetInsertMode(HLINK_BUTTON);
196cdf0e10cSrcweir                 }
197cdf0e10cSrcweir             }
198cdf0e10cSrcweir         }
199cdf0e10cSrcweir 
200cdf0e10cSrcweir         rSet.Put(aHLinkItem);
201cdf0e10cSrcweir     }
202cdf0e10cSrcweir     rSet.Put( SfxBoolItem( SID_READONLY_MODE, mbReadOnly ) );
203cdf0e10cSrcweir 
204cdf0e10cSrcweir     // Ausgabequalitaet
205cdf0e10cSrcweir     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_COLOR ) ||
206cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_GRAYSCALE ) ||
207cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_BLACKWHITE ) ||
208cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_CONTRAST ) )
209cdf0e10cSrcweir     {
210cdf0e10cSrcweir         const sal_uLong nMode = (sal_Int32)GetActiveWindow()->GetDrawMode();
211cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_COLOR, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_COLOR == nMode) ) );
212cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_GRAYSCALE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_GRAYSCALE == nMode) ) );
213cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_BLACKWHITE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_BLACKWHITE == nMode) ) );
214cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_CONTRAST, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_CONTRAST == nMode) ) );
215cdf0e10cSrcweir     }
216cdf0e10cSrcweir 
217cdf0e10cSrcweir     if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) )
218cdf0e10cSrcweir     {
219cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) );
220cdf0e10cSrcweir     }
221cdf0e10cSrcweir 
222cdf0e10cSrcweir     if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ATTR_YEAR2000) )
223cdf0e10cSrcweir     {
224cdf0e10cSrcweir         FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
225cdf0e10cSrcweir         if (pFormShell != NULL)
226cdf0e10cSrcweir         {
227cdf0e10cSrcweir             sal_uInt16 nState = 0;
228cdf0e10cSrcweir             if (pFormShell->GetY2KState(nState))
229cdf0e10cSrcweir                 rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nState ) );
230cdf0e10cSrcweir             else
231cdf0e10cSrcweir                 rSet.DisableItem( SID_ATTR_YEAR2000 );
232cdf0e10cSrcweir         }
233cdf0e10cSrcweir     }
234cdf0e10cSrcweir 
235cdf0e10cSrcweir     if ( !GetView()->GetTextEditOutliner() )
236cdf0e10cSrcweir     {
237cdf0e10cSrcweir         SvtCJKOptions aCJKOptions;
238cdf0e10cSrcweir         if( !aCJKOptions.IsChangeCaseMapEnabled() )
239cdf0e10cSrcweir         {
240cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
241cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
242cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
243cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
244cdf0e10cSrcweir         }
245cdf0e10cSrcweir         else
246cdf0e10cSrcweir         {
247cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
248cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
249cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
250cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
251cdf0e10cSrcweir         }
252cdf0e10cSrcweir 
253cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_SENTENCE_CASE );
254cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_TITLE_CASE );
255cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_TOGGLE_CASE );
256cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_UPPER );
257cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_LOWER );
258cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
259cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
260cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
261cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
262cdf0e10cSrcweir     }
263cdf0e10cSrcweir     else
264cdf0e10cSrcweir     {
265cdf0e10cSrcweir         SvtCJKOptions aCJKOptions;
266cdf0e10cSrcweir         if( !aCJKOptions.IsChangeCaseMapEnabled() )
267cdf0e10cSrcweir         {
268cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
269cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
270cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
271cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
272cdf0e10cSrcweir             rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
273cdf0e10cSrcweir             rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
274cdf0e10cSrcweir             rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
275cdf0e10cSrcweir             rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
276cdf0e10cSrcweir         }
277cdf0e10cSrcweir         else
278cdf0e10cSrcweir         {
279cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
280cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
281cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
282cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
283cdf0e10cSrcweir         }
284cdf0e10cSrcweir     }
285cdf0e10cSrcweir }
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 
288cdf0e10cSrcweir /*************************************************************************
289cdf0e10cSrcweir |*
290cdf0e10cSrcweir |* Status der Attribut-Items
291cdf0e10cSrcweir |*
292cdf0e10cSrcweir \************************************************************************/
293cdf0e10cSrcweir 
294cdf0e10cSrcweir void DrawViewShell::GetAttrState( SfxItemSet& rSet )
295cdf0e10cSrcweir {
296cdf0e10cSrcweir     SfxWhichIter    aIter( rSet );
297cdf0e10cSrcweir     sal_uInt16          nWhich = aIter.FirstWhich();
298cdf0e10cSrcweir 
299cdf0e10cSrcweir     sal_Bool    bAttr = sal_False;
300cdf0e10cSrcweir     SfxAllItemSet aAllSet( *rSet.GetPool() );
301cdf0e10cSrcweir 
302cdf0e10cSrcweir     while ( nWhich )
303cdf0e10cSrcweir     {
304cdf0e10cSrcweir         sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
305cdf0e10cSrcweir             ? GetPool().GetSlotId(nWhich)
306cdf0e10cSrcweir             : nWhich;
307cdf0e10cSrcweir         switch ( nSlotId )
308cdf0e10cSrcweir         {
309766ce4d0SZheng Fan             case SID_ATTR_PARA_LRSPACE:
310766ce4d0SZheng Fan             {
311766ce4d0SZheng Fan                 SfxItemSet aAttrs( GetDoc()->GetPool() );
312766ce4d0SZheng Fan                 mpDrawView->GetAttributes( aAttrs );
313766ce4d0SZheng Fan                 SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrs.Get( EE_PARA_LRSPACE ) );
314766ce4d0SZheng Fan                 aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE);
315766ce4d0SZheng Fan                 rSet.Put(aLRSpace);
316766ce4d0SZheng Fan                 bAttr = sal_True;
317766ce4d0SZheng Fan                 Invalidate(SID_ATTR_PARA_LRSPACE);
318766ce4d0SZheng Fan             }
319766ce4d0SZheng Fan             break;
320766ce4d0SZheng Fan             case SID_ATTR_PARA_LINESPACE:
321766ce4d0SZheng Fan             {
322766ce4d0SZheng Fan                 SfxItemSet aAttrs( GetDoc()->GetPool() );
323766ce4d0SZheng Fan                 mpDrawView->GetAttributes( aAttrs );
324766ce4d0SZheng Fan                 SvxLineSpacingItem aLineLR = ( (const SvxLineSpacingItem&) aAttrs.Get( EE_PARA_SBL ) );
325766ce4d0SZheng Fan                 rSet.Put(aLineLR);
326766ce4d0SZheng Fan                 bAttr = sal_True;
327766ce4d0SZheng Fan                 Invalidate(SID_ATTR_PARA_LINESPACE);
328766ce4d0SZheng Fan             }
329766ce4d0SZheng Fan             break;
330766ce4d0SZheng Fan             case SID_ATTR_PARA_ULSPACE:
331766ce4d0SZheng Fan             {
332766ce4d0SZheng Fan                 SfxItemSet aAttrs( GetDoc()->GetPool() );
333766ce4d0SZheng Fan                 mpDrawView->GetAttributes( aAttrs );
334766ce4d0SZheng Fan                 SvxULSpaceItem aULSP = ( (const SvxULSpaceItem&) aAttrs.Get( EE_PARA_ULSPACE ) );
335766ce4d0SZheng Fan                 aULSP.SetWhich(SID_ATTR_PARA_ULSPACE);
336766ce4d0SZheng Fan                 rSet.Put(aULSP);
337766ce4d0SZheng Fan                 bAttr = sal_True;
338766ce4d0SZheng Fan                 Invalidate(SID_ATTR_PARA_ULSPACE);
339766ce4d0SZheng Fan             }
340766ce4d0SZheng Fan             break;
341cdf0e10cSrcweir             case SID_ATTR_FILL_STYLE:
342cdf0e10cSrcweir             case SID_ATTR_FILL_COLOR:
343cdf0e10cSrcweir             case SID_ATTR_FILL_GRADIENT:
344cdf0e10cSrcweir             case SID_ATTR_FILL_HATCH:
345cdf0e10cSrcweir             case SID_ATTR_FILL_BITMAP:
346cdf0e10cSrcweir             case SID_ATTR_FILL_SHADOW:
347d5370dc8SArmin Le Grand             case SID_ATTR_FILL_TRANSPARENCE:
348d5370dc8SArmin Le Grand             case SID_ATTR_FILL_FLOATTRANSPARENCE:
349cdf0e10cSrcweir             case SID_ATTR_LINE_STYLE:
350cdf0e10cSrcweir             case SID_ATTR_LINE_DASH:
351cdf0e10cSrcweir             case SID_ATTR_LINE_WIDTH:
352cdf0e10cSrcweir             case SID_ATTR_LINE_COLOR:
353d5370dc8SArmin Le Grand             case SID_ATTR_LINE_TRANSPARENCE:
354d5370dc8SArmin Le Grand             case SID_ATTR_LINE_JOINT:
355d5370dc8SArmin Le Grand             case SID_ATTR_LINE_CAP:
356cdf0e10cSrcweir             case SID_ATTR_TEXT_FITTOSIZE:
357766ce4d0SZheng Fan             case SID_ATTR_CHAR_FONT:
358766ce4d0SZheng Fan             case SID_ATTR_CHAR_FONTHEIGHT:
359766ce4d0SZheng Fan             case SID_ATTR_CHAR_SHADOWED:
360766ce4d0SZheng Fan             case SID_ATTR_CHAR_POSTURE:
361766ce4d0SZheng Fan             case SID_ATTR_CHAR_UNDERLINE:
362766ce4d0SZheng Fan             case SID_ATTR_CHAR_STRIKEOUT:
363766ce4d0SZheng Fan             case SID_ATTR_CHAR_WEIGHT:
364766ce4d0SZheng Fan             case SID_ATTR_CHAR_COLOR:
365766ce4d0SZheng Fan             case SID_ATTR_CHAR_KERNING:
366766ce4d0SZheng Fan             case SID_SET_SUB_SCRIPT:
367766ce4d0SZheng Fan             case SID_SET_SUPER_SCRIPT:
368cdf0e10cSrcweir             {
369cdf0e10cSrcweir                 bAttr = sal_True;
370cdf0e10cSrcweir             }
371cdf0e10cSrcweir             break;
372cdf0e10cSrcweir 
373cdf0e10cSrcweir             case SID_HYPHENATION:
374cdf0e10cSrcweir             {
375cdf0e10cSrcweir                 SfxItemSet aAttrs( GetDoc()->GetPool() );
376cdf0e10cSrcweir                 mpDrawView->GetAttributes( aAttrs );
377cdf0e10cSrcweir                 if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE )
378cdf0e10cSrcweir                 {
379cdf0e10cSrcweir                     sal_Bool bValue = ( (const SfxBoolItem&) aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue();
380cdf0e10cSrcweir                     rSet.Put( SfxBoolItem( SID_HYPHENATION, bValue ) );
381cdf0e10cSrcweir                 }
382cdf0e10cSrcweir             }
383cdf0e10cSrcweir             break;
384cdf0e10cSrcweir 
385cdf0e10cSrcweir             case SID_STYLE_FAMILY2:
386cdf0e10cSrcweir             case SID_STYLE_FAMILY3:
387cdf0e10cSrcweir             case SID_STYLE_FAMILY5:
388cdf0e10cSrcweir             case SID_STYLE_APPLY: // StyleControl
389cdf0e10cSrcweir             {
390cdf0e10cSrcweir                 SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet();
391cdf0e10cSrcweir                 if( pStyleSheet )
392cdf0e10cSrcweir                 {
393cdf0e10cSrcweir                     if( nSlotId != SID_STYLE_APPLY && !mpDrawView->AreObjectsMarked() )
394cdf0e10cSrcweir                     {
395cdf0e10cSrcweir                         SfxTemplateItem aTmpItem( nWhich, String() );
396cdf0e10cSrcweir                         aAllSet.Put( aTmpItem, aTmpItem.Which()  );
397cdf0e10cSrcweir                     }
398cdf0e10cSrcweir                     else
399cdf0e10cSrcweir                     {
400cdf0e10cSrcweir                         if (pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
401cdf0e10cSrcweir                             pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
402cdf0e10cSrcweir 
403cdf0e10cSrcweir                         if( pStyleSheet )
404cdf0e10cSrcweir                         {
405cdf0e10cSrcweir                             SfxStyleFamily eFamily = pStyleSheet->GetFamily();
406cdf0e10cSrcweir 
407cdf0e10cSrcweir                             if ((eFamily == SD_STYLE_FAMILY_GRAPHICS &&     nSlotId == SID_STYLE_FAMILY2)       ||
408cdf0e10cSrcweir                                 (eFamily == SD_STYLE_FAMILY_CELL     && nSlotId == SID_STYLE_FAMILY3)       ||
409cdf0e10cSrcweir                                 (eFamily == SD_STYLE_FAMILY_PSEUDO &&   nSlotId == SID_STYLE_FAMILY5))
410cdf0e10cSrcweir                             {
411cdf0e10cSrcweir                                 SfxTemplateItem aTmpItem ( nWhich, pStyleSheet->GetName() );
412cdf0e10cSrcweir                                 aAllSet.Put( aTmpItem, aTmpItem.Which()  );
413cdf0e10cSrcweir                             }
414cdf0e10cSrcweir                             else
415cdf0e10cSrcweir                             {
416cdf0e10cSrcweir                                 SfxTemplateItem aTmpItem(nWhich, String());
417cdf0e10cSrcweir                                 aAllSet.Put(aTmpItem,aTmpItem.Which()  );
418cdf0e10cSrcweir                             }
419cdf0e10cSrcweir                         }
420cdf0e10cSrcweir                     }
421cdf0e10cSrcweir                 }
422cdf0e10cSrcweir                 else
423cdf0e10cSrcweir                 {   SfxTemplateItem aItem( nWhich, String() );
424cdf0e10cSrcweir                     aAllSet.Put( aItem, aItem.Which() );
425cdf0e10cSrcweir                     // rSet.DisableItem( nWhich );
426cdf0e10cSrcweir                 }
427cdf0e10cSrcweir             }
428cdf0e10cSrcweir             break;
429cdf0e10cSrcweir 
430cdf0e10cSrcweir             case SID_SET_DEFAULT:
431cdf0e10cSrcweir             {
432cdf0e10cSrcweir                 if( !mpDrawView->GetMarkedObjectList().GetMarkCount() ||
433cdf0e10cSrcweir                     ( !mpDrawView->IsTextEdit() && !mpDrawView->GetStyleSheet() )
434cdf0e10cSrcweir                   )
435cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
436cdf0e10cSrcweir             }
437cdf0e10cSrcweir             break;
438cdf0e10cSrcweir 
439cdf0e10cSrcweir             case SID_STYLE_WATERCAN:
440cdf0e10cSrcweir             {
441cdf0e10cSrcweir                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
442cdf0e10cSrcweir                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
443cdf0e10cSrcweir                     rSet.Put(SfxBoolItem(nWhich,sal_False));
444cdf0e10cSrcweir                 else
445cdf0e10cSrcweir                 {
446cdf0e10cSrcweir                     SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan());
447cdf0e10cSrcweir                     aAllSet.Put( aItem, aItem.Which());
448cdf0e10cSrcweir                 }
449cdf0e10cSrcweir             }
450cdf0e10cSrcweir             break;
451cdf0e10cSrcweir 
452cdf0e10cSrcweir             case SID_STYLE_NEW:
453cdf0e10cSrcweir             {
454cdf0e10cSrcweir                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
455cdf0e10cSrcweir                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
456cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
457cdf0e10cSrcweir             }
458cdf0e10cSrcweir             break;
459cdf0e10cSrcweir 
460cdf0e10cSrcweir             case SID_STYLE_DRAGHIERARCHIE:
461cdf0e10cSrcweir             {
462cdf0e10cSrcweir                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
463cdf0e10cSrcweir                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
464cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
465cdf0e10cSrcweir             }
466cdf0e10cSrcweir             break;
467cdf0e10cSrcweir 
468cdf0e10cSrcweir             case SID_STYLE_NEW_BY_EXAMPLE:
469cdf0e10cSrcweir             {
470cdf0e10cSrcweir                 // PseudoStyleSheets koennen nicht 'by Example' erzeugt werden;
471cdf0e10cSrcweir                 // normale StyleSheets brauchen dafuer ein selektiertes Objekt
472cdf0e10cSrcweir                 ISfxTemplateCommon* pTemplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
473cdf0e10cSrcweir                 if (pTemplCommon)
474cdf0e10cSrcweir                 {
475cdf0e10cSrcweir                     if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
476cdf0e10cSrcweir                     {
477cdf0e10cSrcweir                         rSet.DisableItem(nWhich);
478cdf0e10cSrcweir                     }
479cdf0e10cSrcweir                     else if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_GRAPHICS)
480cdf0e10cSrcweir                     {
481cdf0e10cSrcweir                         if (!mpDrawView->AreObjectsMarked())
482cdf0e10cSrcweir                         {
483cdf0e10cSrcweir                             rSet.DisableItem(nWhich);
484cdf0e10cSrcweir                         }
485cdf0e10cSrcweir                     }
486cdf0e10cSrcweir                 }
487cdf0e10cSrcweir                 // falls (noch) kein Gestalter da ist, muessen wir uns auf den
488cdf0e10cSrcweir                 // View-Zustand zurueckziehen; eine aktuell eingestellte Familie
489cdf0e10cSrcweir                 // kann nicht beruecksichtigt werden
490cdf0e10cSrcweir                 else
491cdf0e10cSrcweir                 {
492cdf0e10cSrcweir                     if (!mpDrawView->AreObjectsMarked())
493cdf0e10cSrcweir                     {
494cdf0e10cSrcweir                         rSet.DisableItem(nWhich);
495cdf0e10cSrcweir                     }
496cdf0e10cSrcweir                 }
497cdf0e10cSrcweir 
498cdf0e10cSrcweir             }
499cdf0e10cSrcweir             break;
500cdf0e10cSrcweir 
501cdf0e10cSrcweir             case SID_STYLE_UPDATE_BY_EXAMPLE:
502cdf0e10cSrcweir             {
503cdf0e10cSrcweir                 if (!mpDrawView->AreObjectsMarked())
504cdf0e10cSrcweir                 {
505cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
506cdf0e10cSrcweir                 }
507cdf0e10cSrcweir             }
508cdf0e10cSrcweir             break;
509*1ff378efSZheng Fan             case FN_BUL_NUM_RULE_INDEX:
510*1ff378efSZheng Fan             case FN_NUM_NUM_RULE_INDEX:
511*1ff378efSZheng Fan             {
512*1ff378efSZheng Fan                 SfxItemSet aEditAttr( GetDoc()->GetPool() );
513*1ff378efSZheng Fan                 mpDrawView->GetAttributes( aEditAttr );
514*1ff378efSZheng Fan 
515*1ff378efSZheng Fan                 SfxItemSet aNewAttr( GetPool(), EE_ITEMS_START, EE_ITEMS_END );
516*1ff378efSZheng Fan                 aNewAttr.Put( aEditAttr, sal_False );
517*1ff378efSZheng Fan 
518*1ff378efSZheng Fan 
519*1ff378efSZheng Fan                 sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
520*1ff378efSZheng Fan                 SvxNumRule* pNumRule = NULL;
521*1ff378efSZheng Fan                 const SfxPoolItem* pTmpItem=NULL;
522*1ff378efSZheng Fan                 sal_uInt16 nNumItemId = SID_ATTR_NUMBERING_RULE;
523*1ff378efSZheng Fan 
524*1ff378efSZheng Fan                 //if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem))
525*1ff378efSZheng Fan                 //  nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue();
526*1ff378efSZheng Fan                 rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
527*1ff378efSZheng Fan                 rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
528*1ff378efSZheng Fan                 nActNumLvl = mpDrawView->GetSelectionLevel();
529*1ff378efSZheng Fan                 pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId);
530*1ff378efSZheng Fan 
531*1ff378efSZheng Fan                 if (pTmpItem)
532*1ff378efSZheng Fan                     pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule());
533*1ff378efSZheng Fan 
534*1ff378efSZheng Fan                 if ( pNumRule )
535*1ff378efSZheng Fan                 {
536*1ff378efSZheng Fan                     sal_uInt16 nMask = 1;
537*1ff378efSZheng Fan                     sal_uInt16 nCount = 0;
538*1ff378efSZheng Fan                     sal_uInt16 nCurLevel = (sal_uInt16)0xFFFF;
539*1ff378efSZheng Fan                     for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
540*1ff378efSZheng Fan                     {
541*1ff378efSZheng Fan                         if(nActNumLvl & nMask)
542*1ff378efSZheng Fan                         {
543*1ff378efSZheng Fan                             nCount++;
544*1ff378efSZheng Fan                             nCurLevel = i;
545*1ff378efSZheng Fan                         }
546*1ff378efSZheng Fan                         nMask <<= 1;
547*1ff378efSZheng Fan                     }
548*1ff378efSZheng Fan                     if ( nCount == 1 )
549*1ff378efSZheng Fan                     {
550*1ff378efSZheng Fan                         sal_Bool bBullets = sal_False;
551*1ff378efSZheng Fan                         const SvxNumberFormat* pNumFmt = pNumRule->Get(nCurLevel);
552*1ff378efSZheng Fan                         if ( pNumFmt )
553*1ff378efSZheng Fan                         {
554*1ff378efSZheng Fan                             switch(pNumFmt->GetNumberingType())
555*1ff378efSZheng Fan                             {
556*1ff378efSZheng Fan                                 case SVX_NUM_CHAR_SPECIAL:
557*1ff378efSZheng Fan                                 case SVX_NUM_BITMAP:
558*1ff378efSZheng Fan                                     bBullets = sal_True;
559*1ff378efSZheng Fan                                     break;
560*1ff378efSZheng Fan 
561*1ff378efSZheng Fan                                 default:
562*1ff378efSZheng Fan                                     bBullets = sal_False;
563*1ff378efSZheng Fan                             }
564*1ff378efSZheng Fan 
565*1ff378efSZheng Fan                             rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
566*1ff378efSZheng Fan                             rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
567*1ff378efSZheng Fan                             if ( bBullets )
568*1ff378efSZheng Fan                             {
569*1ff378efSZheng Fan                                 NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
570*1ff378efSZheng Fan                                 if ( pBullets )
571*1ff378efSZheng Fan                                 {
572*1ff378efSZheng Fan                                     sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(*pNumRule,nActNumLvl);
573*1ff378efSZheng Fan                                      rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex));
574*1ff378efSZheng Fan                                 }
575*1ff378efSZheng Fan                             }else
576*1ff378efSZheng Fan                             {
577*1ff378efSZheng Fan                                 NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
578*1ff378efSZheng Fan                                 if ( pNumbering )
579*1ff378efSZheng Fan                                 {
580*1ff378efSZheng Fan                                     sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(*pNumRule,nActNumLvl);
581*1ff378efSZheng Fan                                      rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex));
582*1ff378efSZheng Fan                                 }
583*1ff378efSZheng Fan                             }
584*1ff378efSZheng Fan                         }
585*1ff378efSZheng Fan                     }
586*1ff378efSZheng Fan                 }
587*1ff378efSZheng Fan             }
588*1ff378efSZheng Fan                     break;
589*1ff378efSZheng Fan             //End
590*1ff378efSZheng Fan             // Added by Li Hui for story 179.
591*1ff378efSZheng Fan             case FN_NUM_BULLET_ON:
592*1ff378efSZheng Fan             case FN_NUM_NUMBERING_ON:
593*1ff378efSZheng Fan             {
594*1ff378efSZheng Fan                 sal_Bool bEnable = sal_False;
595*1ff378efSZheng Fan                 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
596*1ff378efSZheng Fan                 const ULONG nMarkCount = rMarkList.GetMarkCount();
597*1ff378efSZheng Fan                 for (ULONG nIndex = 0; nIndex < nMarkCount; nIndex++)
598*1ff378efSZheng Fan                 {
599*1ff378efSZheng Fan                     SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(rMarkList.GetMark(nIndex)->GetMarkedSdrObj());
600*1ff378efSZheng Fan                     if (pTextObj && pTextObj->GetObjInventor() == SdrInventor)
601*1ff378efSZheng Fan                     {
602*1ff378efSZheng Fan                         if (pTextObj->GetObjIdentifier() != OBJ_OLE2)
603*1ff378efSZheng Fan                         {
604*1ff378efSZheng Fan                             bEnable = sal_True;
605*1ff378efSZheng Fan                             break;
606*1ff378efSZheng Fan                         }
607*1ff378efSZheng Fan                     }
608*1ff378efSZheng Fan                 }
609*1ff378efSZheng Fan                 if (bEnable)
610*1ff378efSZheng Fan                 {
611*1ff378efSZheng Fan                     rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_False));
612*1ff378efSZheng Fan                     rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON, sal_False));
613*1ff378efSZheng Fan                 }
614*1ff378efSZheng Fan                 else
615*1ff378efSZheng Fan                 {
616*1ff378efSZheng Fan                     rSet.DisableItem(FN_NUM_BULLET_ON);
617*1ff378efSZheng Fan                     rSet.DisableItem(FN_NUM_NUMBERING_ON);
618*1ff378efSZheng Fan                 }
619*1ff378efSZheng Fan             }
620*1ff378efSZheng Fan             break;
621cdf0e10cSrcweir         }
622cdf0e10cSrcweir         nWhich = aIter.NextWhich();
623cdf0e10cSrcweir     }
624cdf0e10cSrcweir 
625cdf0e10cSrcweir     SfxItemSet* pSet = NULL;
626cdf0e10cSrcweir 
627cdf0e10cSrcweir     if( bAttr )
628cdf0e10cSrcweir     {
629cdf0e10cSrcweir         pSet = new SfxItemSet( GetDoc()->GetPool() );
630cdf0e10cSrcweir         mpDrawView->GetAttributes( *pSet );
631cdf0e10cSrcweir         rSet.Put( *pSet, sal_False );
632cdf0e10cSrcweir     }
633cdf0e10cSrcweir 
634cdf0e10cSrcweir     rSet.Put( aAllSet, sal_False );
635cdf0e10cSrcweir 
636cdf0e10cSrcweir     // Flaechen und/oder Linienattribute wurden geaendert
637cdf0e10cSrcweir     if( bAttr && pSet )
638cdf0e10cSrcweir     {
639cdf0e10cSrcweir         // Wenn die View selektierte Objekte besitzt, muessen entspr. Items
640cdf0e10cSrcweir         // von SFX_ITEM_DEFAULT (_ON) auf SFX_ITEM_DISABLED geaendert werden
641cdf0e10cSrcweir         if( mpDrawView->AreObjectsMarked() )
642cdf0e10cSrcweir         {
643cdf0e10cSrcweir             SfxWhichIter aNewIter( *pSet, XATTR_LINE_FIRST, XATTR_FILL_LAST );
644cdf0e10cSrcweir             nWhich = aNewIter.FirstWhich();
645cdf0e10cSrcweir             while( nWhich )
646cdf0e10cSrcweir             {
647cdf0e10cSrcweir                 if( SFX_ITEM_DEFAULT == pSet->GetItemState( nWhich ) )
648cdf0e10cSrcweir                 {
649cdf0e10cSrcweir                     rSet.ClearItem( nWhich );
650cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
651cdf0e10cSrcweir                 }
652cdf0e10cSrcweir                 nWhich = aNewIter.NextWhich();
653cdf0e10cSrcweir             }
654cdf0e10cSrcweir         }
655766ce4d0SZheng Fan 
656766ce4d0SZheng Fan         SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE );
657766ce4d0SZheng Fan         if ( eState == SFX_ITEM_DONTCARE )
658766ce4d0SZheng Fan         {
659766ce4d0SZheng Fan             rSet.InvalidateItem(EE_PARA_LRSPACE);
660766ce4d0SZheng Fan             rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
661766ce4d0SZheng Fan         }
662766ce4d0SZheng Fan         eState = pSet->GetItemState( EE_PARA_SBL );
663766ce4d0SZheng Fan         if ( eState == SFX_ITEM_DONTCARE )
664766ce4d0SZheng Fan         {
665766ce4d0SZheng Fan             rSet.InvalidateItem(EE_PARA_SBL);
666766ce4d0SZheng Fan             rSet.InvalidateItem(SID_ATTR_PARA_LINESPACE);
667766ce4d0SZheng Fan         }
668766ce4d0SZheng Fan         eState = pSet->GetItemState( EE_PARA_ULSPACE );
669766ce4d0SZheng Fan         if ( eState == SFX_ITEM_DONTCARE )
670766ce4d0SZheng Fan         {
671766ce4d0SZheng Fan             rSet.InvalidateItem(EE_PARA_ULSPACE);
672766ce4d0SZheng Fan             rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE);
673cdf0e10cSrcweir         }
674cdf0e10cSrcweir 
675766ce4d0SZheng Fan         SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
676766ce4d0SZheng Fan                         pSet->Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
677766ce4d0SZheng Fan         if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
678766ce4d0SZheng Fan         {
679766ce4d0SZheng Fan             rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) );
680766ce4d0SZheng Fan         }
681766ce4d0SZheng Fan         else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
682766ce4d0SZheng Fan         {
683766ce4d0SZheng Fan             rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) );
684766ce4d0SZheng Fan         }
685766ce4d0SZheng Fan 
686766ce4d0SZheng Fan         eState = pSet->GetItemState( EE_CHAR_KERNING, sal_True );
687766ce4d0SZheng Fan         if ( eState == SFX_ITEM_DONTCARE )
688766ce4d0SZheng Fan         {
689766ce4d0SZheng Fan             rSet.InvalidateItem(EE_CHAR_KERNING);
690766ce4d0SZheng Fan             rSet.InvalidateItem(SID_ATTR_CHAR_KERNING);
691766ce4d0SZheng Fan         }
692766ce4d0SZheng Fan         delete pSet;
693766ce4d0SZheng Fan     }
694cdf0e10cSrcweir }
695cdf0e10cSrcweir 
696cdf0e10cSrcweir 
697cdf0e10cSrcweir /*************************************************************************
698cdf0e10cSrcweir |*
699cdf0e10cSrcweir |* Text der Selektion zurueckgeben
700cdf0e10cSrcweir |*
701cdf0e10cSrcweir \************************************************************************/
702cdf0e10cSrcweir 
703cdf0e10cSrcweir String DrawViewShell::GetSelectionText(sal_Bool bCompleteWords)
704cdf0e10cSrcweir {
705cdf0e10cSrcweir     String aStrSelection;
706cdf0e10cSrcweir     ::Outliner* pOl = mpDrawView->GetTextEditOutliner();
707cdf0e10cSrcweir     OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
708cdf0e10cSrcweir 
709cdf0e10cSrcweir     if (pOl && pOlView)
710cdf0e10cSrcweir     {
711cdf0e10cSrcweir         if (bCompleteWords)
712cdf0e10cSrcweir         {
713cdf0e10cSrcweir             ESelection aSel = pOlView->GetSelection();
714cdf0e10cSrcweir             String aStrCurrentDelimiters = pOl->GetWordDelimiters();
715cdf0e10cSrcweir 
716cdf0e10cSrcweir             pOl->SetWordDelimiters( String( RTL_CONSTASCII_USTRINGPARAM( " .,;\"'" )));
717cdf0e10cSrcweir             aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos );
718cdf0e10cSrcweir             pOl->SetWordDelimiters( aStrCurrentDelimiters );
719cdf0e10cSrcweir         }
720cdf0e10cSrcweir         else
721cdf0e10cSrcweir         {
722cdf0e10cSrcweir             aStrSelection = pOlView->GetSelected();
723cdf0e10cSrcweir         }
724cdf0e10cSrcweir     }
725cdf0e10cSrcweir 
726cdf0e10cSrcweir     return (aStrSelection);
727cdf0e10cSrcweir }
728cdf0e10cSrcweir 
729cdf0e10cSrcweir /*************************************************************************
730cdf0e10cSrcweir |*
731cdf0e10cSrcweir |* Ist etwas selektiert?
732cdf0e10cSrcweir |*
733cdf0e10cSrcweir \************************************************************************/
734cdf0e10cSrcweir 
735cdf0e10cSrcweir sal_Bool DrawViewShell::HasSelection(sal_Bool bText) const
736cdf0e10cSrcweir {
737cdf0e10cSrcweir     sal_Bool bReturn = sal_False;
738cdf0e10cSrcweir 
739cdf0e10cSrcweir     if (bText)
740cdf0e10cSrcweir     {
741cdf0e10cSrcweir         OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
742cdf0e10cSrcweir 
743cdf0e10cSrcweir         if (pOlView && pOlView->GetSelected().Len() != 0)
744cdf0e10cSrcweir         {
745cdf0e10cSrcweir             bReturn = sal_True;
746cdf0e10cSrcweir         }
747cdf0e10cSrcweir     }
748cdf0e10cSrcweir     else if (mpDrawView->GetMarkedObjectList().GetMarkCount() != 0)
749cdf0e10cSrcweir     {
750cdf0e10cSrcweir         bReturn = sal_True;
751cdf0e10cSrcweir     }
752cdf0e10cSrcweir 
753cdf0e10cSrcweir     return bReturn;
754cdf0e10cSrcweir }
755cdf0e10cSrcweir 
756cdf0e10cSrcweir } // end of namespace sd
757