1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: CustomAnimationCreateDialog.cxx,v $
10 * $Revision: 1.14.74.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #ifndef _COM_SUN_STAR_UTIL_XCOLLATOR_HPP_
35 #include <com/sun/star/i18n/XCollator.hpp>
38 #ifndef _UNOTOOLS_PROCESSFACTORY_HXX
39 #include <comphelper/processfactory.hxx>
41 #include <vcl/svapp.hxx>
42 #include <vcl/tabctrl.hxx>
43 #include <vcl/tabpage.hxx>
45 #ifndef _SV_BUTTON_HXX
46 #include <vcl/button.hxx>
48 #include <vcl/fixed.hxx>
49 #include <vcl/lstbox.hxx>
50 #include <vcl/combobox.hxx>
51 #include <svtools/valueset.hxx>
53 #include <svx/svdetc.hxx>
54 #include <svx/svdstr.hrc>
55 #include "sdresid.hxx"
56 #include <svtools/viewoptions.hxx>
57 #include <com/sun/star/presentation/EffectNodeType.hpp>
58 #include "CustomAnimationCreateDialog.hxx"
59 #ifndef _SD_CUSTOMANIMATIONCREATEDIALOG_HRC
60 #include "CustomAnimationCreateDialog.hrc"
62 #ifndef _SD_CUSTOMANIMATION_HRC
63 #include "CustomAnimation.hrc"
65 #include "CustomAnimationPane.hxx"
66 #include "optsitem.hxx"
71 using namespace ::com::sun::star
;
73 using ::rtl::OUString
;
74 using ::com::sun::star::uno::UNO_QUERY
;
75 using ::com::sun::star::uno::UNO_QUERY_THROW
;
76 using ::com::sun::star::uno::Any
;
77 using ::com::sun::star::uno::Reference
;
78 using ::com::sun::star::uno::Exception
;
80 using namespace ::com::sun::star::presentation
;
85 const int ENTRANCE
= 0;
86 const int EMPHASIS
= 1;
88 const int MOTIONPATH
= 3;
89 const int MISCEFFECTS
= 4;
91 extern void fillDurationComboBox( ComboBox
* pBox
);
93 // --------------------------------------------------------------------
95 class CategoryListBox
: public ListBox
98 CategoryListBox( Window
* pParent
, WinBits nStyle
= WB_BORDER
);
99 CategoryListBox( Window
* pParent
, const ResId
& rResId
);
102 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
104 USHORT
InsertCategory( const XubString
& rStr
, USHORT nPos
= LISTBOX_APPEND
);
106 void SetDoubleClickLink( const Link
& rDoubleClickHdl
) { maDoubleClickHdl
= rDoubleClickHdl
; }
108 DECL_LINK( implDoubleClickHdl
, Control
* );
111 virtual void UserDraw( const UserDrawEvent
& rUDEvt
);
113 Link maDoubleClickHdl
;
116 CategoryListBox::CategoryListBox( Window
* pParent
, WinBits nStyle
/* = WB_BORDER */ )
117 : ListBox( pParent
, nStyle
)
119 EnableUserDraw( TRUE
);
122 CategoryListBox::CategoryListBox( Window
* pParent
, const ResId
& rResId
)
123 : ListBox( pParent
, rResId
)
125 EnableUserDraw( TRUE
);
126 SetDoubleClickHdl( LINK( this, CategoryListBox
, implDoubleClickHdl
) );
129 CategoryListBox::~CategoryListBox()
133 USHORT
CategoryListBox::InsertCategory( const XubString
& rStr
, USHORT nPos
/* = LISTBOX_APPEND */ )
135 USHORT n
= ListBox::InsertEntry( rStr
, nPos
);
136 if( n
!= LISTBOX_ENTRY_NOTFOUND
)
137 ListBox::SetEntryFlags( n
, ListBox::GetEntryFlags(n
) | LISTBOX_ENTRY_FLAG_DISABLE_SELECTION
);
142 void CategoryListBox::UserDraw( const UserDrawEvent
& rUDEvt
)
144 const USHORT nItem
= rUDEvt
.GetItemId();
146 if( ListBox::GetEntryFlags(nItem
) & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION
)
148 Rectangle
aOutRect( rUDEvt
.GetRect() );
149 OutputDevice
* pDev
= rUDEvt
.GetDevice();
151 // fill the background
152 Color
aColor (GetSettings().GetStyleSettings().GetDialogColor());
154 pDev
->SetFillColor (aColor
);
155 pDev
->SetLineColor ();
156 pDev
->DrawRect(aOutRect
);
158 // Erase the four corner pixels to make the rectangle appear rounded.
159 pDev
->SetLineColor( GetSettings().GetStyleSettings().GetWindowColor());
160 pDev
->DrawPixel( aOutRect
.TopLeft());
161 pDev
->DrawPixel( Point(aOutRect
.Right(), aOutRect
.Top()));
162 pDev
->DrawPixel( Point(aOutRect
.Left(), aOutRect
.Bottom()));
163 pDev
->DrawPixel( Point(aOutRect
.Right(), aOutRect
.Bottom()));
165 // draw the category title
166 pDev
->DrawText (aOutRect
, GetEntry(nItem
), TEXT_DRAW_CENTER
);
170 DrawEntry( rUDEvt
, TRUE
, TRUE
);
174 // --------------------------------------------------------------------
176 IMPL_LINK( CategoryListBox
, implDoubleClickHdl
, Control
*, EMPTYARG
)
182 // --------------------------------------------------------------------
184 void CategoryListBox::MouseButtonUp( const MouseEvent
& rMEvt
)
187 if( rMEvt
.IsLeft() && (rMEvt
.GetClicks() == 2) )
189 if( maDoubleClickHdl
.IsSet() )
190 maDoubleClickHdl
.Call( this );
194 ListBox::MouseButtonUp( rMEvt
);
198 // --------------------------------------------------------------------
200 class CustomAnimationCreateTabPage
: public TabPage
203 CustomAnimationCreateTabPage( Window
* pParent
, CustomAnimationCreateDialog
* pDialogParent
, int nTabId
, const PresetCategoryList
& rCategoryList
, bool bHasText
);
204 ~CustomAnimationCreateTabPage();
206 PathKind
getCreatePathKind() const;
207 CustomAnimationPresetPtr
getSelectedPreset() const;
208 double getDuration() const;
209 void setDuration( double fDuration
);
211 bool getIsPreview() const;
212 void setIsPreview( bool bIsPreview
);
214 bool select( const OUString
& rsPresetId
);
217 DECL_LINK( implSelectHdl
, Control
* );
218 DECL_LINK( implDoubleClickHdl
, Control
* );
220 void onSelectEffect();
225 CategoryListBox
* mpLBEffects
;
226 FixedText
* mpFTSpeed
;
228 CheckBox
* mpCBXPReview
;
230 CustomAnimationCreateDialog
* mpParent
;
232 USHORT mnCurvePathPos
;
233 USHORT mnPolygonPathPos
;
234 USHORT mnFreeformPathPos
;
238 struct ImplStlEffectCategorySortHelper
240 ImplStlEffectCategorySortHelper();
241 bool operator()( const CustomAnimationPresetPtr
& p1
, const CustomAnimationPresetPtr
& p2
);
244 uno::Reference
< i18n::XCollator
> mxCollator
;
247 ImplStlEffectCategorySortHelper::ImplStlEffectCategorySortHelper()
249 uno::Reference
<lang::XMultiServiceFactory
> xFac( ::comphelper::getProcessServiceFactory() );
252 mxCollator
.set( xFac
->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.i18n.Collator" ) ), uno::UNO_QUERY
);
254 if( mxCollator
.is() )
256 const lang::Locale
& rLocale
= Application::GetSettings().GetLocale();
257 mxCollator
->loadDefaultCollator(rLocale
, 0);
262 bool ImplStlEffectCategorySortHelper::operator()( const CustomAnimationPresetPtr
& p1
, const CustomAnimationPresetPtr
& p2
)
264 return mxCollator
.is() ? mxCollator
->compareString(p1
->getLabel(), p2
->getLabel()) == -1 : false;
267 CustomAnimationCreateTabPage::CustomAnimationCreateTabPage( Window
* pParent
, CustomAnimationCreateDialog
* pDialogParent
, int nTabId
, const PresetCategoryList
& rCategoryList
, bool bHasText
)
268 : TabPage( pParent
, SdResId( RID_TP_CUSTOMANIMATION_ENTRANCE
) )
269 , mpParent( pDialogParent
)
270 , mnCurvePathPos( LISTBOX_ENTRY_NOTFOUND
)
271 , mnPolygonPathPos( LISTBOX_ENTRY_NOTFOUND
)
272 , mnFreeformPathPos( LISTBOX_ENTRY_NOTFOUND
)
274 mpLBEffects
= new CategoryListBox( this, SdResId( LB_EFFECTS
) );
275 mpFTSpeed
= new FixedText( this, SdResId( FT_SPEED
) );
276 mpCBSpeed
= new ComboBox( this, SdResId( CB_SPEED
) );
277 mpCBXPReview
= new CheckBox( this, SdResId( CBX_PREVIEW
) );
279 String
sMotionPathLabel( SdResId( STR_USERPATH
) );
283 USHORT nFirstEffect
= LISTBOX_ENTRY_NOTFOUND
;
285 if( nTabId
== MOTIONPATH
)
287 mpLBEffects
->InsertCategory( sMotionPathLabel
);
289 mnCurvePathPos
= nFirstEffect
= mpLBEffects
->InsertEntry( sdr::GetResourceString(STR_ObjNameSingulCOMBLINE
) );
290 mnPolygonPathPos
= mpLBEffects
->InsertEntry( sdr::GetResourceString(STR_ObjNameSingulPOLY
) );
291 mnFreeformPathPos
= mpLBEffects
->InsertEntry( sdr::GetResourceString(STR_ObjNameSingulFREELINE
) );
294 PresetCategoryList::const_iterator
aCategoryIter( rCategoryList
.begin() );
295 const PresetCategoryList::const_iterator
aCategoryEnd( rCategoryList
.end() );
296 while( aCategoryIter
!= aCategoryEnd
)
298 PresetCategoryPtr
pCategory( *aCategoryIter
++ );
299 if( pCategory
.get() )
301 mpLBEffects
->InsertCategory( pCategory
->maLabel
);
303 std::vector
< CustomAnimationPresetPtr
> aSortedVector(pCategory
->maEffects
.size());
304 std::copy( pCategory
->maEffects
.begin(), pCategory
->maEffects
.end(), aSortedVector
.begin() );
305 ImplStlEffectCategorySortHelper aSortHelper
;
306 std::sort( aSortedVector
.begin(), aSortedVector
.end(), aSortHelper
);
308 std::vector
< CustomAnimationPresetPtr
>::const_iterator
aIter( aSortedVector
.begin() );
309 const std::vector
< CustomAnimationPresetPtr
>::const_iterator
aEnd( aSortedVector
.end() );
310 while( aIter
!= aEnd
)
312 CustomAnimationPresetPtr pDescriptor
= (*aIter
++);
313 if( pDescriptor
.get() && (bHasText
|| !pDescriptor
->isTextOnly() ) )
315 USHORT nPos
= mpLBEffects
->InsertEntry( pDescriptor
->getLabel() );
316 mpLBEffects
->SetEntryData( nPos
, static_cast<void*>( new CustomAnimationPresetPtr( pDescriptor
) ) );
318 if( nFirstEffect
== LISTBOX_ENTRY_NOTFOUND
)
325 mpLBEffects
->SelectEntryPos( nFirstEffect
);
327 fillDurationComboBox( mpCBSpeed
);
329 if( nFirstEffect
!= LISTBOX_ENTRY_NOTFOUND
)
332 mpLBEffects
->SetSelectHdl( LINK( this, CustomAnimationCreateTabPage
, implSelectHdl
) );
333 mpLBEffects
->SetDoubleClickLink( LINK( this, CustomAnimationCreateTabPage
, implDoubleClickHdl
) );
336 CustomAnimationCreateTabPage::~CustomAnimationCreateTabPage()
346 IMPL_LINK( CustomAnimationCreateTabPage
, implSelectHdl
, Control
*, pControl
)
348 if( pControl
== mpLBEffects
)
353 IMPL_LINK( CustomAnimationCreateTabPage
, implDoubleClickHdl
, Control
*, pControl
)
355 if( pControl
== mpLBEffects
)
357 if( mpLBEffects
->GetSelectEntryCount() )
358 mpParent
->EndDialog( TRUE
);
363 void CustomAnimationCreateTabPage::onSelectEffect()
365 CustomAnimationPresetPtr
*p
= static_cast< CustomAnimationPresetPtr
* >( mpLBEffects
->GetEntryData( mpLBEffects
->GetSelectEntryPos() ) );
370 CustomAnimationPresetPtr
pPreset( *p
);
372 const double fDuration
= pPreset
->getDuration();
373 USHORT nPos
= 0xffff;
375 if( fDuration
== 5.0 )
377 else if( fDuration
== 3.0 )
379 else if( fDuration
== 2.0 )
381 else if( fDuration
== 1.0 )
383 else if( fDuration
== 0.5 )
386 mpCBSpeed
->SelectEntryPos( nPos
);
388 bool bHasSpeed
= pPreset
->getDuration() > 0.001;
389 mpCBSpeed
->Enable( bHasSpeed
);
390 mpFTSpeed
->Enable( bHasSpeed
);
392 if( mpCBXPReview
->IsChecked() )
394 mpParent
->preview( pPreset
);
398 void CustomAnimationCreateTabPage::clearEffects()
400 USHORT nPos
= mpLBEffects
->GetEntryCount();
402 delete static_cast< CustomAnimationPresetPtr
* >( mpLBEffects
->GetEntryData( nPos
) );
404 mpLBEffects
->Clear();
407 CustomAnimationPresetPtr
CustomAnimationCreateTabPage::getSelectedPreset() const
409 CustomAnimationPresetPtr pPreset
;
411 if( mpLBEffects
->GetSelectEntryCount() == 1 )
413 void* pEntryData
= mpLBEffects
->GetEntryData( mpLBEffects
->GetSelectEntryPos() );
415 pPreset
= *static_cast< CustomAnimationPresetPtr
* >( pEntryData
);
421 PathKind
CustomAnimationCreateTabPage::getCreatePathKind() const
423 PathKind eKind
= NONE
;
425 if( mpLBEffects
->GetSelectEntryCount() == 1 )
427 const USHORT nPos
= mpLBEffects
->GetSelectEntryPos();
428 if( nPos
== mnCurvePathPos
)
432 else if( nPos
== mnPolygonPathPos
)
436 else if( nPos
== mnFreeformPathPos
)
447 double CustomAnimationCreateTabPage::getDuration() const
449 USHORT nPos
= mpCBSpeed
->GetSelectEntryPos();
450 if( (nPos
== 0xffff) || !mpCBSpeed
->IsEnabled() )
452 CustomAnimationPresetPtr pPreset
= getSelectedPreset();
454 return pPreset
->getDuration();
469 void CustomAnimationCreateTabPage::setDuration( double fDuration
)
472 if( fDuration
< 2.0f
)
474 if( fDuration
< 1.0f
)
483 else if( fDuration
< 5.0f
)
485 if( fDuration
< 3.0f
)
495 mpCBSpeed
->SelectEntryPos( nPos
);
498 bool CustomAnimationCreateTabPage::getIsPreview() const
500 return mpCBXPReview
->IsChecked() ? true : false;
503 void CustomAnimationCreateTabPage::setIsPreview( bool bIsPreview
)
505 mpCBXPReview
->Check( bIsPreview
? TRUE
: FALSE
);
508 bool CustomAnimationCreateTabPage::select( const OUString
& rsPresetId
)
510 USHORT nPos
= mpLBEffects
->GetEntryCount();
513 void* pEntryData
= mpLBEffects
->GetEntryData( nPos
);
516 CustomAnimationPresetPtr
& pPtr
= *static_cast< CustomAnimationPresetPtr
* >(pEntryData
);
517 if( pPtr
.get() && pPtr
->getPresetId() == rsPresetId
)
519 mpLBEffects
->SelectEntryPos( nPos
);
528 // --------------------------------------------------------------------
530 CustomAnimationCreateDialog::CustomAnimationCreateDialog( Window
* pParent
, CustomAnimationPane
* pPane
, const std::vector
< ::com::sun::star::uno::Any
>& rTargets
, bool bHasText
, const ::rtl::OUString
& rsPresetId
, double fDuration
)
531 : TabDialog( pParent
, SdResId( DLG_CUSTOMANIMATION_CREATE
) )
533 , mrTargets( rTargets
)
534 , mfDuration( fDuration
)
536 mpTabControl
= new TabControl( this, SdResId( 1 ) );
537 mpOKButton
= new OKButton(this, SdResId( 1 ) ) ;
538 mpOKButton
->SetStyle(WB_DEFBUTTON
);
539 mpCancelButton
= new CancelButton(this, SdResId( 1 ) );
540 mpCancelButton
->SetStyle(WB_DEFBUTTON
);
541 mpHelpButton
= new HelpButton(this, SdResId( 1 ) );
545 SdOptions
* pOptions
= SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS
);
546 mbIsPreview
= pOptions
->IsPreviewNewEffects();
548 const CustomAnimationPresets
& rPresets
= CustomAnimationPresets::getCustomAnimationPresets();
549 mpTabPages
[ENTRANCE
] = new CustomAnimationCreateTabPage( mpTabControl
, this, ENTRANCE
, rPresets
.getEntrancePresets(), bHasText
);
550 mpTabPages
[ENTRANCE
]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_ENTRANCE
);
551 mpTabControl
->SetTabPage( RID_TP_CUSTOMANIMATION_ENTRANCE
, mpTabPages
[ENTRANCE
] );
552 mpTabPages
[EMPHASIS
] = new CustomAnimationCreateTabPage( mpTabControl
, this, EMPHASIS
, rPresets
.getEmphasisPresets(), bHasText
);
553 mpTabPages
[EMPHASIS
]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_EMPHASIS
);
554 mpTabControl
->SetTabPage( RID_TP_CUSTOMANIMATION_EMPHASIS
, mpTabPages
[EMPHASIS
] );
555 mpTabPages
[EXIT
] = new CustomAnimationCreateTabPage( mpTabControl
, this, EXIT
, rPresets
.getExitPresets(), bHasText
);
556 mpTabPages
[EXIT
]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_EXIT
);
557 mpTabControl
->SetTabPage( RID_TP_CUSTOMANIMATION_EXIT
, mpTabPages
[EXIT
] );
558 mpTabPages
[MOTIONPATH
] = new CustomAnimationCreateTabPage( mpTabControl
, this, MOTIONPATH
, rPresets
.getMotionPathsPresets(), bHasText
);
559 mpTabPages
[MOTIONPATH
]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_MOTIONPATH
);
560 mpTabControl
->SetTabPage( RID_TP_CUSTOMANIMATION_MOTIONPATH
, mpTabPages
[MOTIONPATH
] );
561 mpTabPages
[MISCEFFECTS
] = new CustomAnimationCreateTabPage( mpTabControl
, this, MISCEFFECTS
, rPresets
.getMiscPresets(), bHasText
);
562 mpTabPages
[MISCEFFECTS
]->SetHelpId( HID_SD_CUSTOMANIMATIONDIALOG_MISCEFFECTS
);
563 mpTabControl
->SetTabPage( RID_TP_CUSTOMANIMATION_MISCEFFECTS
, mpTabPages
[MISCEFFECTS
] );
565 getCurrentPage()->setDuration( mfDuration
);
566 getCurrentPage()->setIsPreview( mbIsPreview
);
568 mpTabControl
->SetActivatePageHdl( LINK( this, CustomAnimationCreateDialog
, implActivatePagekHdl
) );
569 mpTabControl
->SetDeactivatePageHdl( LINK( this, CustomAnimationCreateDialog
, implDeactivatePagekHdl
) );
573 // select current preset if available
574 if( rsPresetId
.getLength() != 0 )
576 for( sal_uInt16 i
= ENTRANCE
; i
<= MOTIONPATH
; i
++ )
578 if( mpTabPages
[i
]->select( rsPresetId
) )
580 mpTabControl
->SetCurPageId( RID_TP_CUSTOMANIMATION_ENTRANCE
+ i
);
587 CustomAnimationCreateDialog::~CustomAnimationCreateDialog()
591 SdOptions
* pOptions
= SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS
);
592 pOptions
->SetPreviewNewEffects( getCurrentPage()->getIsPreview() );
594 delete mpTabPages
[ENTRANCE
];
595 delete mpTabPages
[EMPHASIS
];
596 delete mpTabPages
[EXIT
];
597 delete mpTabPages
[MOTIONPATH
];
598 delete mpTabPages
[MISCEFFECTS
];
602 delete mpCancelButton
;
606 CustomAnimationCreateTabPage
* CustomAnimationCreateDialog::getCurrentPage() const
608 switch( mpTabControl
->GetCurPageId() )
610 case RID_TP_CUSTOMANIMATION_ENTRANCE
: return mpTabPages
[ENTRANCE
];
611 case RID_TP_CUSTOMANIMATION_EMPHASIS
: return mpTabPages
[EMPHASIS
];
612 case RID_TP_CUSTOMANIMATION_EXIT
: return mpTabPages
[EXIT
];
613 case RID_TP_CUSTOMANIMATION_MISCEFFECTS
:return mpTabPages
[MISCEFFECTS
];
614 //case RID_TP_CUSTOMANIMATION_MOTIONPATH:
616 return mpTabPages
[MOTIONPATH
];
620 PathKind
CustomAnimationCreateDialog::getCreatePathKind() const
622 return getCurrentPage()->getCreatePathKind();
625 CustomAnimationPresetPtr
CustomAnimationCreateDialog::getSelectedPreset() const
627 return getCurrentPage()->getSelectedPreset();
630 double CustomAnimationCreateDialog::getSelectedDuration() const
632 return getCurrentPage()->getDuration();
635 IMPL_LINK( CustomAnimationCreateDialog
, implActivatePagekHdl
, Control
*, EMPTYARG
)
637 getCurrentPage()->setDuration( mfDuration
);
638 getCurrentPage()->setIsPreview( mbIsPreview
);
642 IMPL_LINK( CustomAnimationCreateDialog
, implDeactivatePagekHdl
, Control
*, EMPTYARG
)
644 mfDuration
= getCurrentPage()->getDuration();
645 mbIsPreview
= getCurrentPage()->getIsPreview();
649 void CustomAnimationCreateDialog::preview( const CustomAnimationPresetPtr
& pPreset
) const
651 MainSequencePtr
pSequence( new MainSequence() );
653 std::vector
< Any
>::const_iterator
aIter( mrTargets
.begin() );
654 const std::vector
< Any
>::const_iterator
aEnd( mrTargets
.end() );
656 const double fDuration
= getSelectedDuration();
659 while( aIter
!= aEnd
)
661 CustomAnimationEffectPtr
pNew(
662 pSequence
->append( pPreset
, (*aIter
++), fDuration
) );
667 pNew
->setNodeType( EffectNodeType::WITH_PREVIOUS
);
670 mpPane
->preview( pSequence
->getRootNode() );
675 Window
* lcl_GetTopmostParent( Window
* pWindow
)
677 Window
* pResult
= 0;
678 Window
* pCurrent
= pWindow
? pWindow
->GetParent() : 0;
682 pCurrent
= pCurrent
->GetParent();
688 void CustomAnimationCreateDialog::setPosition()
690 SvtViewOptions
aDlgOpt(
691 E_TABDIALOG
, String::CreateFromInt32( DLG_CUSTOMANIMATION_CREATE
) );
692 if ( aDlgOpt
.Exists() )
694 SetWindowState( ByteString( aDlgOpt
.GetWindowState().getStr(),
695 RTL_TEXTENCODING_ASCII_US
) );
699 // default position: aligned with right edge of parent
700 Window
* pParent
= lcl_GetTopmostParent( this );
703 Point
aPos( GetPosPixel());
704 Size
aSize( GetSizePixel());
705 Point
aParentPos( pParent
->GetPosPixel());
706 Size
aParentSize( pParent
->GetSizePixel());
709 aPos
.setX( aParentSize
.getWidth() - aSize
.getWidth() );
710 aPos
.setY( (aParentSize
.getHeight() - aSize
.getHeight()) / 2 );
716 void CustomAnimationCreateDialog::storePosition()
718 // save settings (screen position and current page)
719 SvtViewOptions
aDlgOpt(
720 E_TABDIALOG
, String::CreateFromInt32( DLG_CUSTOMANIMATION_CREATE
) );
721 aDlgOpt
.SetWindowState(
722 OUString::createFromAscii( GetWindowState( WINDOWSTATE_MASK_POS
).GetBuffer() ) );