xref: /trunk/main/sd/source/ui/view/drviewsf.cxx (revision d5370dc8b91641fa460c79c207c7018af41d7460)
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 
76cdf0e10cSrcweir using ::rtl::OUString;
77cdf0e10cSrcweir using namespace ::com::sun::star;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir namespace sd {
80cdf0e10cSrcweir 
81cdf0e10cSrcweir /*************************************************************************
82cdf0e10cSrcweir |*
83cdf0e10cSrcweir |* Status von Controller-SfxSlots setzen
84cdf0e10cSrcweir |*
85cdf0e10cSrcweir \************************************************************************/
86cdf0e10cSrcweir 
87cdf0e10cSrcweir void DrawViewShell::GetCtrlState(SfxItemSet &rSet)
88cdf0e10cSrcweir {
89cdf0e10cSrcweir     if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN)
90cdf0e10cSrcweir     {
91cdf0e10cSrcweir         // "Letzte Version" vom SFx en/disablen lassen
92cdf0e10cSrcweir         GetViewFrame()->GetSlotState (SID_RELOAD, NULL, &rSet);
93cdf0e10cSrcweir     }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK))
96cdf0e10cSrcweir     {
97cdf0e10cSrcweir         SvxHyperlinkItem aHLinkItem;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir         OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
100cdf0e10cSrcweir 
101cdf0e10cSrcweir         if (pOLV)
102cdf0e10cSrcweir         {
103cdf0e10cSrcweir             bool bField = false;
104cdf0e10cSrcweir             const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
105cdf0e10cSrcweir             if (pFieldItem)
106cdf0e10cSrcweir             {
107cdf0e10cSrcweir                 ESelection aSel = pOLV->GetSelection();
108cdf0e10cSrcweir                 if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
109cdf0e10cSrcweir                 {
110cdf0e10cSrcweir                     const SvxFieldData* pField = pFieldItem->GetField();
111cdf0e10cSrcweir                     if (pField->ISA(SvxURLField))
112cdf0e10cSrcweir                     {
113cdf0e10cSrcweir                         aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
114cdf0e10cSrcweir                         aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
115cdf0e10cSrcweir                         aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
116cdf0e10cSrcweir                         bField = true;
117cdf0e10cSrcweir                     }
118cdf0e10cSrcweir                 }
119cdf0e10cSrcweir             }
120cdf0e10cSrcweir             if (!bField)
121cdf0e10cSrcweir             {
122cdf0e10cSrcweir                 // use selected text as name for urls
123cdf0e10cSrcweir                 String sReturn = pOLV->GetSelected();
124cdf0e10cSrcweir                 sReturn.Erase(255);
125cdf0e10cSrcweir                 sReturn.EraseTrailingChars();
126cdf0e10cSrcweir                 aHLinkItem.SetName(sReturn);
127cdf0e10cSrcweir             }
128cdf0e10cSrcweir         }
129cdf0e10cSrcweir         else
130cdf0e10cSrcweir         {
131cdf0e10cSrcweir             if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0)
132cdf0e10cSrcweir             {
133cdf0e10cSrcweir                 bool bFound = false;
134cdf0e10cSrcweir 
135cdf0e10cSrcweir                 SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
136cdf0e10cSrcweir                 if( pMarkedObj && (FmFormInventor == pMarkedObj->GetObjInventor()) )
137cdf0e10cSrcweir                 {
138cdf0e10cSrcweir                     SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( pMarkedObj );
139cdf0e10cSrcweir 
140cdf0e10cSrcweir                     if(pUnoCtrl) try
141cdf0e10cSrcweir                     {
142cdf0e10cSrcweir                         uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
143cdf0e10cSrcweir                         uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
144cdf0e10cSrcweir                         uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
145cdf0e10cSrcweir 
146cdf0e10cSrcweir                         form::FormButtonType eButtonType = form::FormButtonType_URL;
147cdf0e10cSrcweir                         const OUString sButtonType( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) );
148cdf0e10cSrcweir                         if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) )
149cdf0e10cSrcweir                         {
150cdf0e10cSrcweir                             OUString aString;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir                             // Label
153cdf0e10cSrcweir                             const OUString sLabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ) );
154cdf0e10cSrcweir                             if(xPropInfo->hasPropertyByName(sLabel))
155cdf0e10cSrcweir                             {
156cdf0e10cSrcweir                                 if( xPropSet->getPropertyValue(sLabel) >>= aString )
157cdf0e10cSrcweir                                     aHLinkItem.SetName(String( aString ));
158cdf0e10cSrcweir                             }
159cdf0e10cSrcweir 
160cdf0e10cSrcweir                             // URL
161cdf0e10cSrcweir                             const OUString sTargetURL(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ));
162cdf0e10cSrcweir                             if(xPropInfo->hasPropertyByName(sTargetURL))
163cdf0e10cSrcweir                             {
164cdf0e10cSrcweir                                 if( xPropSet->getPropertyValue(sTargetURL) >>= aString )
165cdf0e10cSrcweir                                     aHLinkItem.SetURL(String( aString ));
166cdf0e10cSrcweir                             }
167cdf0e10cSrcweir 
168cdf0e10cSrcweir                             // Target
169cdf0e10cSrcweir                             const OUString sTargetFrame( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" ) );
170cdf0e10cSrcweir                             if(xPropInfo->hasPropertyByName(sTargetFrame) )
171cdf0e10cSrcweir                             {
172cdf0e10cSrcweir                                 if( xPropSet->getPropertyValue(sTargetFrame) >>= aString )
173cdf0e10cSrcweir                                     aHLinkItem.SetTargetFrame(String( aString ));
174cdf0e10cSrcweir                             }
175cdf0e10cSrcweir 
176cdf0e10cSrcweir                             aHLinkItem.SetInsertMode(HLINK_BUTTON);
177cdf0e10cSrcweir                             bFound = true;
178cdf0e10cSrcweir                         }
179cdf0e10cSrcweir                     }
180cdf0e10cSrcweir                     catch( uno::Exception& )
181cdf0e10cSrcweir                     {
182cdf0e10cSrcweir                     }
183cdf0e10cSrcweir                 }
184cdf0e10cSrcweir 
185cdf0e10cSrcweir                 // try interaction link
186cdf0e10cSrcweir                 if( !bFound && pMarkedObj )
187cdf0e10cSrcweir                 {
188cdf0e10cSrcweir                     SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj);
189cdf0e10cSrcweir                     if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) )
190cdf0e10cSrcweir                         aHLinkItem.SetURL( pInfo->GetBookmark());
191cdf0e10cSrcweir                     aHLinkItem.SetInsertMode(HLINK_BUTTON);
192cdf0e10cSrcweir                 }
193cdf0e10cSrcweir             }
194cdf0e10cSrcweir         }
195cdf0e10cSrcweir 
196cdf0e10cSrcweir         rSet.Put(aHLinkItem);
197cdf0e10cSrcweir     }
198cdf0e10cSrcweir     rSet.Put( SfxBoolItem( SID_READONLY_MODE, mbReadOnly ) );
199cdf0e10cSrcweir 
200cdf0e10cSrcweir     // Ausgabequalitaet
201cdf0e10cSrcweir     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_COLOR ) ||
202cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_GRAYSCALE ) ||
203cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_BLACKWHITE ) ||
204cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_CONTRAST ) )
205cdf0e10cSrcweir     {
206cdf0e10cSrcweir         const sal_uLong nMode = (sal_Int32)GetActiveWindow()->GetDrawMode();
207cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_COLOR, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_COLOR == nMode) ) );
208cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_GRAYSCALE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_GRAYSCALE == nMode) ) );
209cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_BLACKWHITE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_BLACKWHITE == nMode) ) );
210cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_CONTRAST, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_CONTRAST == nMode) ) );
211cdf0e10cSrcweir     }
212cdf0e10cSrcweir 
213cdf0e10cSrcweir     if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) )
214cdf0e10cSrcweir     {
215cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) );
216cdf0e10cSrcweir     }
217cdf0e10cSrcweir 
218cdf0e10cSrcweir     if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ATTR_YEAR2000) )
219cdf0e10cSrcweir     {
220cdf0e10cSrcweir         FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
221cdf0e10cSrcweir         if (pFormShell != NULL)
222cdf0e10cSrcweir         {
223cdf0e10cSrcweir             sal_uInt16 nState = 0;
224cdf0e10cSrcweir             if (pFormShell->GetY2KState(nState))
225cdf0e10cSrcweir                 rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nState ) );
226cdf0e10cSrcweir             else
227cdf0e10cSrcweir                 rSet.DisableItem( SID_ATTR_YEAR2000 );
228cdf0e10cSrcweir         }
229cdf0e10cSrcweir     }
230cdf0e10cSrcweir 
231cdf0e10cSrcweir     if ( !GetView()->GetTextEditOutliner() )
232cdf0e10cSrcweir     {
233cdf0e10cSrcweir         SvtCJKOptions aCJKOptions;
234cdf0e10cSrcweir         if( !aCJKOptions.IsChangeCaseMapEnabled() )
235cdf0e10cSrcweir         {
236cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
237cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
238cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
239cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
240cdf0e10cSrcweir         }
241cdf0e10cSrcweir         else
242cdf0e10cSrcweir         {
243cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
244cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
245cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
246cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
247cdf0e10cSrcweir         }
248cdf0e10cSrcweir 
249cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_SENTENCE_CASE );
250cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_TITLE_CASE );
251cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_TOGGLE_CASE );
252cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_UPPER );
253cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_LOWER );
254cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
255cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
256cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
257cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
258cdf0e10cSrcweir     }
259cdf0e10cSrcweir     else
260cdf0e10cSrcweir     {
261cdf0e10cSrcweir         SvtCJKOptions aCJKOptions;
262cdf0e10cSrcweir         if( !aCJKOptions.IsChangeCaseMapEnabled() )
263cdf0e10cSrcweir         {
264cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
265cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
266cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
267cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
268cdf0e10cSrcweir             rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
269cdf0e10cSrcweir             rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
270cdf0e10cSrcweir             rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
271cdf0e10cSrcweir             rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
272cdf0e10cSrcweir         }
273cdf0e10cSrcweir         else
274cdf0e10cSrcweir         {
275cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
276cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
277cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
278cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
279cdf0e10cSrcweir         }
280cdf0e10cSrcweir     }
281cdf0e10cSrcweir }
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 
284cdf0e10cSrcweir /*************************************************************************
285cdf0e10cSrcweir |*
286cdf0e10cSrcweir |* Status der Attribut-Items
287cdf0e10cSrcweir |*
288cdf0e10cSrcweir \************************************************************************/
289cdf0e10cSrcweir 
290cdf0e10cSrcweir void DrawViewShell::GetAttrState( SfxItemSet& rSet )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir     SfxWhichIter    aIter( rSet );
293cdf0e10cSrcweir     sal_uInt16          nWhich = aIter.FirstWhich();
294cdf0e10cSrcweir 
295cdf0e10cSrcweir     sal_Bool    bAttr = sal_False;
296cdf0e10cSrcweir     SfxAllItemSet aAllSet( *rSet.GetPool() );
297cdf0e10cSrcweir 
298cdf0e10cSrcweir     while ( nWhich )
299cdf0e10cSrcweir     {
300cdf0e10cSrcweir         sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
301cdf0e10cSrcweir             ? GetPool().GetSlotId(nWhich)
302cdf0e10cSrcweir             : nWhich;
303cdf0e10cSrcweir         switch ( nSlotId )
304cdf0e10cSrcweir         {
305cdf0e10cSrcweir             case SID_ATTR_FILL_STYLE:
306cdf0e10cSrcweir             case SID_ATTR_FILL_COLOR:
307cdf0e10cSrcweir             case SID_ATTR_FILL_GRADIENT:
308cdf0e10cSrcweir             case SID_ATTR_FILL_HATCH:
309cdf0e10cSrcweir             case SID_ATTR_FILL_BITMAP:
310cdf0e10cSrcweir             case SID_ATTR_FILL_SHADOW:
311*d5370dc8SArmin Le Grand             case SID_ATTR_FILL_TRANSPARENCE:
312*d5370dc8SArmin Le Grand             case SID_ATTR_FILL_FLOATTRANSPARENCE:
313cdf0e10cSrcweir             case SID_ATTR_LINE_STYLE:
314cdf0e10cSrcweir             case SID_ATTR_LINE_DASH:
315cdf0e10cSrcweir             case SID_ATTR_LINE_WIDTH:
316cdf0e10cSrcweir             case SID_ATTR_LINE_COLOR:
317*d5370dc8SArmin Le Grand             case SID_ATTR_LINE_TRANSPARENCE:
318*d5370dc8SArmin Le Grand             case SID_ATTR_LINE_JOINT:
319*d5370dc8SArmin Le Grand             case SID_ATTR_LINE_CAP:
320cdf0e10cSrcweir             case SID_ATTR_TEXT_FITTOSIZE:
321cdf0e10cSrcweir             {
322cdf0e10cSrcweir                 bAttr = sal_True;
323cdf0e10cSrcweir             }
324cdf0e10cSrcweir             break;
325cdf0e10cSrcweir 
326cdf0e10cSrcweir             case SID_HYPHENATION:
327cdf0e10cSrcweir             {
328cdf0e10cSrcweir                 SfxItemSet aAttrs( GetDoc()->GetPool() );
329cdf0e10cSrcweir                 mpDrawView->GetAttributes( aAttrs );
330cdf0e10cSrcweir                 if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE )
331cdf0e10cSrcweir                 {
332cdf0e10cSrcweir                     sal_Bool bValue = ( (const SfxBoolItem&) aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue();
333cdf0e10cSrcweir                     rSet.Put( SfxBoolItem( SID_HYPHENATION, bValue ) );
334cdf0e10cSrcweir                 }
335cdf0e10cSrcweir             }
336cdf0e10cSrcweir             break;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir             case SID_STYLE_FAMILY2:
339cdf0e10cSrcweir             case SID_STYLE_FAMILY3:
340cdf0e10cSrcweir             case SID_STYLE_FAMILY5:
341cdf0e10cSrcweir             case SID_STYLE_APPLY: // StyleControl
342cdf0e10cSrcweir             {
343cdf0e10cSrcweir                 SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet();
344cdf0e10cSrcweir                 if( pStyleSheet )
345cdf0e10cSrcweir                 {
346cdf0e10cSrcweir                     if( nSlotId != SID_STYLE_APPLY && !mpDrawView->AreObjectsMarked() )
347cdf0e10cSrcweir                     {
348cdf0e10cSrcweir                         SfxTemplateItem aTmpItem( nWhich, String() );
349cdf0e10cSrcweir                         aAllSet.Put( aTmpItem, aTmpItem.Which()  );
350cdf0e10cSrcweir                     }
351cdf0e10cSrcweir                     else
352cdf0e10cSrcweir                     {
353cdf0e10cSrcweir                         if (pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
354cdf0e10cSrcweir                             pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
355cdf0e10cSrcweir 
356cdf0e10cSrcweir                         if( pStyleSheet )
357cdf0e10cSrcweir                         {
358cdf0e10cSrcweir                             SfxStyleFamily eFamily = pStyleSheet->GetFamily();
359cdf0e10cSrcweir 
360cdf0e10cSrcweir                             if ((eFamily == SD_STYLE_FAMILY_GRAPHICS &&     nSlotId == SID_STYLE_FAMILY2)       ||
361cdf0e10cSrcweir                                 (eFamily == SD_STYLE_FAMILY_CELL     && nSlotId == SID_STYLE_FAMILY3)       ||
362cdf0e10cSrcweir                                 (eFamily == SD_STYLE_FAMILY_PSEUDO &&   nSlotId == SID_STYLE_FAMILY5))
363cdf0e10cSrcweir                             {
364cdf0e10cSrcweir                                 SfxTemplateItem aTmpItem ( nWhich, pStyleSheet->GetName() );
365cdf0e10cSrcweir                                 aAllSet.Put( aTmpItem, aTmpItem.Which()  );
366cdf0e10cSrcweir                             }
367cdf0e10cSrcweir                             else
368cdf0e10cSrcweir                             {
369cdf0e10cSrcweir                                 SfxTemplateItem aTmpItem(nWhich, String());
370cdf0e10cSrcweir                                 aAllSet.Put(aTmpItem,aTmpItem.Which()  );
371cdf0e10cSrcweir                             }
372cdf0e10cSrcweir                         }
373cdf0e10cSrcweir                     }
374cdf0e10cSrcweir                 }
375cdf0e10cSrcweir                 else
376cdf0e10cSrcweir                 {   SfxTemplateItem aItem( nWhich, String() );
377cdf0e10cSrcweir                     aAllSet.Put( aItem, aItem.Which() );
378cdf0e10cSrcweir                     // rSet.DisableItem( nWhich );
379cdf0e10cSrcweir                 }
380cdf0e10cSrcweir             }
381cdf0e10cSrcweir             break;
382cdf0e10cSrcweir 
383cdf0e10cSrcweir             case SID_SET_DEFAULT:
384cdf0e10cSrcweir             {
385cdf0e10cSrcweir                 if( !mpDrawView->GetMarkedObjectList().GetMarkCount() ||
386cdf0e10cSrcweir                     ( !mpDrawView->IsTextEdit() && !mpDrawView->GetStyleSheet() )
387cdf0e10cSrcweir                   )
388cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
389cdf0e10cSrcweir             }
390cdf0e10cSrcweir             break;
391cdf0e10cSrcweir 
392cdf0e10cSrcweir             case SID_STYLE_WATERCAN:
393cdf0e10cSrcweir             {
394cdf0e10cSrcweir                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
395cdf0e10cSrcweir                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
396cdf0e10cSrcweir                     rSet.Put(SfxBoolItem(nWhich,sal_False));
397cdf0e10cSrcweir                 else
398cdf0e10cSrcweir                 {
399cdf0e10cSrcweir                     SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan());
400cdf0e10cSrcweir                     aAllSet.Put( aItem, aItem.Which());
401cdf0e10cSrcweir                 }
402cdf0e10cSrcweir             }
403cdf0e10cSrcweir             break;
404cdf0e10cSrcweir 
405cdf0e10cSrcweir             case SID_STYLE_NEW:
406cdf0e10cSrcweir             {
407cdf0e10cSrcweir                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
408cdf0e10cSrcweir                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
409cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
410cdf0e10cSrcweir             }
411cdf0e10cSrcweir             break;
412cdf0e10cSrcweir 
413cdf0e10cSrcweir             case SID_STYLE_DRAGHIERARCHIE:
414cdf0e10cSrcweir             {
415cdf0e10cSrcweir                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
416cdf0e10cSrcweir                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
417cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
418cdf0e10cSrcweir             }
419cdf0e10cSrcweir             break;
420cdf0e10cSrcweir 
421cdf0e10cSrcweir             case SID_STYLE_NEW_BY_EXAMPLE:
422cdf0e10cSrcweir             {
423cdf0e10cSrcweir                 // PseudoStyleSheets koennen nicht 'by Example' erzeugt werden;
424cdf0e10cSrcweir                 // normale StyleSheets brauchen dafuer ein selektiertes Objekt
425cdf0e10cSrcweir                 ISfxTemplateCommon* pTemplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
426cdf0e10cSrcweir                 if (pTemplCommon)
427cdf0e10cSrcweir                 {
428cdf0e10cSrcweir                     if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
429cdf0e10cSrcweir                     {
430cdf0e10cSrcweir                         rSet.DisableItem(nWhich);
431cdf0e10cSrcweir                     }
432cdf0e10cSrcweir                     else if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_GRAPHICS)
433cdf0e10cSrcweir                     {
434cdf0e10cSrcweir                         if (!mpDrawView->AreObjectsMarked())
435cdf0e10cSrcweir                         {
436cdf0e10cSrcweir                             rSet.DisableItem(nWhich);
437cdf0e10cSrcweir                         }
438cdf0e10cSrcweir                     }
439cdf0e10cSrcweir                 }
440cdf0e10cSrcweir                 // falls (noch) kein Gestalter da ist, muessen wir uns auf den
441cdf0e10cSrcweir                 // View-Zustand zurueckziehen; eine aktuell eingestellte Familie
442cdf0e10cSrcweir                 // kann nicht beruecksichtigt werden
443cdf0e10cSrcweir                 else
444cdf0e10cSrcweir                 {
445cdf0e10cSrcweir                     if (!mpDrawView->AreObjectsMarked())
446cdf0e10cSrcweir                     {
447cdf0e10cSrcweir                         rSet.DisableItem(nWhich);
448cdf0e10cSrcweir                     }
449cdf0e10cSrcweir                 }
450cdf0e10cSrcweir 
451cdf0e10cSrcweir             }
452cdf0e10cSrcweir             break;
453cdf0e10cSrcweir 
454cdf0e10cSrcweir             case SID_STYLE_UPDATE_BY_EXAMPLE:
455cdf0e10cSrcweir             {
456cdf0e10cSrcweir                 if (!mpDrawView->AreObjectsMarked())
457cdf0e10cSrcweir                 {
458cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
459cdf0e10cSrcweir                 }
460cdf0e10cSrcweir             }
461cdf0e10cSrcweir             break;
462cdf0e10cSrcweir         }
463cdf0e10cSrcweir         nWhich = aIter.NextWhich();
464cdf0e10cSrcweir     }
465cdf0e10cSrcweir 
466cdf0e10cSrcweir     SfxItemSet* pSet = NULL;
467cdf0e10cSrcweir 
468cdf0e10cSrcweir     if( bAttr )
469cdf0e10cSrcweir     {
470cdf0e10cSrcweir         pSet = new SfxItemSet( GetDoc()->GetPool() );
471cdf0e10cSrcweir         mpDrawView->GetAttributes( *pSet );
472cdf0e10cSrcweir         rSet.Put( *pSet, sal_False );
473cdf0e10cSrcweir     }
474cdf0e10cSrcweir 
475cdf0e10cSrcweir     rSet.Put( aAllSet, sal_False );
476cdf0e10cSrcweir 
477cdf0e10cSrcweir     // Flaechen und/oder Linienattribute wurden geaendert
478cdf0e10cSrcweir     if( bAttr && pSet )
479cdf0e10cSrcweir     {
480cdf0e10cSrcweir         // Wenn die View selektierte Objekte besitzt, muessen entspr. Items
481cdf0e10cSrcweir         // von SFX_ITEM_DEFAULT (_ON) auf SFX_ITEM_DISABLED geaendert werden
482cdf0e10cSrcweir         if( mpDrawView->AreObjectsMarked() )
483cdf0e10cSrcweir         {
484cdf0e10cSrcweir             SfxWhichIter aNewIter( *pSet, XATTR_LINE_FIRST, XATTR_FILL_LAST );
485cdf0e10cSrcweir             nWhich = aNewIter.FirstWhich();
486cdf0e10cSrcweir             while( nWhich )
487cdf0e10cSrcweir             {
488cdf0e10cSrcweir                 if( SFX_ITEM_DEFAULT == pSet->GetItemState( nWhich ) )
489cdf0e10cSrcweir                 {
490cdf0e10cSrcweir                     rSet.ClearItem( nWhich );
491cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
492cdf0e10cSrcweir                 }
493cdf0e10cSrcweir                 nWhich = aNewIter.NextWhich();
494cdf0e10cSrcweir             }
495cdf0e10cSrcweir         }
496cdf0e10cSrcweir         delete pSet;
497cdf0e10cSrcweir     }
498cdf0e10cSrcweir 
499cdf0e10cSrcweir //    const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
500cdf0e10cSrcweir //    sal_uLong nMarkCount = rMarkList.GetMarkCount();
501cdf0e10cSrcweir //    sal_Bool bDisabled = sal_False;
502cdf0e10cSrcweir //
503cdf0e10cSrcweir //    for (sal_uLong i = 0;
504cdf0e10cSrcweir //         i < nMarkCount && !bDisabled && i < 50; i++)
505cdf0e10cSrcweir //    {
506cdf0e10cSrcweir //        SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
507cdf0e10cSrcweir //
508cdf0e10cSrcweir //        if (pObj->GetObjInventor() == E3dInventor)
509cdf0e10cSrcweir //        {
510cdf0e10cSrcweir //            bDisabled = sal_True;
511cdf0e10cSrcweir //            rSet.ClearItem(SDRATTR_SHADOW);
512cdf0e10cSrcweir //            rSet.DisableItem(SDRATTR_SHADOW);
513cdf0e10cSrcweir //        }
514cdf0e10cSrcweir //    }
515cdf0e10cSrcweir }
516cdf0e10cSrcweir 
517cdf0e10cSrcweir 
518cdf0e10cSrcweir /*************************************************************************
519cdf0e10cSrcweir |*
520cdf0e10cSrcweir |* Text der Selektion zurueckgeben
521cdf0e10cSrcweir |*
522cdf0e10cSrcweir \************************************************************************/
523cdf0e10cSrcweir 
524cdf0e10cSrcweir String DrawViewShell::GetSelectionText(sal_Bool bCompleteWords)
525cdf0e10cSrcweir {
526cdf0e10cSrcweir     String aStrSelection;
527cdf0e10cSrcweir     ::Outliner* pOl = mpDrawView->GetTextEditOutliner();
528cdf0e10cSrcweir     OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
529cdf0e10cSrcweir 
530cdf0e10cSrcweir     if (pOl && pOlView)
531cdf0e10cSrcweir     {
532cdf0e10cSrcweir         if (bCompleteWords)
533cdf0e10cSrcweir         {
534cdf0e10cSrcweir             ESelection aSel = pOlView->GetSelection();
535cdf0e10cSrcweir             String aStrCurrentDelimiters = pOl->GetWordDelimiters();
536cdf0e10cSrcweir 
537cdf0e10cSrcweir             pOl->SetWordDelimiters( String( RTL_CONSTASCII_USTRINGPARAM( " .,;\"'" )));
538cdf0e10cSrcweir             aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos );
539cdf0e10cSrcweir             pOl->SetWordDelimiters( aStrCurrentDelimiters );
540cdf0e10cSrcweir         }
541cdf0e10cSrcweir         else
542cdf0e10cSrcweir         {
543cdf0e10cSrcweir             aStrSelection = pOlView->GetSelected();
544cdf0e10cSrcweir         }
545cdf0e10cSrcweir     }
546cdf0e10cSrcweir 
547cdf0e10cSrcweir     return (aStrSelection);
548cdf0e10cSrcweir }
549cdf0e10cSrcweir 
550cdf0e10cSrcweir /*************************************************************************
551cdf0e10cSrcweir |*
552cdf0e10cSrcweir |* Ist etwas selektiert?
553cdf0e10cSrcweir |*
554cdf0e10cSrcweir \************************************************************************/
555cdf0e10cSrcweir 
556cdf0e10cSrcweir sal_Bool DrawViewShell::HasSelection(sal_Bool bText) const
557cdf0e10cSrcweir {
558cdf0e10cSrcweir     sal_Bool bReturn = sal_False;
559cdf0e10cSrcweir 
560cdf0e10cSrcweir     if (bText)
561cdf0e10cSrcweir     {
562cdf0e10cSrcweir         OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
563cdf0e10cSrcweir 
564cdf0e10cSrcweir         if (pOlView && pOlView->GetSelected().Len() != 0)
565cdf0e10cSrcweir         {
566cdf0e10cSrcweir             bReturn = sal_True;
567cdf0e10cSrcweir         }
568cdf0e10cSrcweir     }
569cdf0e10cSrcweir     else if (mpDrawView->GetMarkedObjectList().GetMarkCount() != 0)
570cdf0e10cSrcweir     {
571cdf0e10cSrcweir         bReturn = sal_True;
572cdf0e10cSrcweir     }
573cdf0e10cSrcweir 
574cdf0e10cSrcweir     return bReturn;
575cdf0e10cSrcweir }
576cdf0e10cSrcweir 
577cdf0e10cSrcweir } // end of namespace sd
578