1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <svx/dialogs.hrc>
22 #include <sfx2/viewfrm.hxx>
24 #include <editeng/editdata.hxx>
25 #include <svx/svxids.hrc>
26 #include <editeng/eeitem.hxx>
27 #include <vcl/msgbox.hxx>
28 #include <sfx2/bindings.hxx>
29 #include <sfx2/request.hxx>
31 #include "drawview.hxx"
32 #include "drawdoc.hxx"
33 #include "DrawViewShell.hxx"
34 #include "ViewShell.hxx"
35 #include "DrawDocShell.hxx"
36 #include "sdabstdlg.hxx"
37 #include <boost/scoped_ptr.hpp>
41 TYPEINIT1( FuChar
, FuPoor
);
49 : FuPoor(pViewSh
, pWin
, pView
, pDoc
, rReq
)
53 rtl::Reference
<FuPoor
> FuChar::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
55 rtl::Reference
<FuPoor
> xFunc( new FuChar( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
56 xFunc
->DoExecute(rReq
);
60 void FuChar::DoExecute( SfxRequest
& rReq
)
62 const SfxItemSet
* pArgs
= rReq
.GetArgs();
66 SfxItemSet
aEditAttr( mpDoc
->GetPool() );
67 mpView
->GetAttributes( aEditAttr
);
69 SfxItemSet
aNewAttr( mpViewShell
->GetPool(),
70 EE_ITEMS_START
, EE_ITEMS_END
);
71 aNewAttr
.Put( aEditAttr
, false );
73 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
74 boost::scoped_ptr
<SfxAbstractTabDialog
> pDlg(pFact
? pFact
->CreateSdTabCharDialog( NULL
, &aNewAttr
, mpDoc
->GetDocSh() ) : 0);
75 sal_uInt16 nResult
= RET_CANCEL
;
78 if (rReq
.GetSlot() == SID_CHAR_DLG_EFFECT
)
80 pDlg
->SetCurPageId("RID_SVXPAGE_CHAR_EFFECTS");
83 nResult
= pDlg
->Execute();
85 if( nResult
== RET_OK
)
87 rReq
.Done( *( pDlg
->GetOutputItemSet() ) );
88 pArgs
= rReq
.GetArgs();
91 if( nResult
!= RET_OK
)
96 mpView
->SetAttributes(*pArgs
);
98 // invalidate the Slots which are in DrTxtObjBar
99 static sal_uInt16 SidArray
[] = {
101 SID_ATTR_CHAR_POSTURE
,
102 SID_ATTR_CHAR_WEIGHT
,
103 SID_ATTR_CHAR_SHADOWED
,
104 SID_ATTR_CHAR_STRIKEOUT
,
105 SID_ATTR_CHAR_UNDERLINE
,
106 SID_ATTR_CHAR_FONTHEIGHT
,
108 SID_ATTR_CHAR_KERNING
,
109 SID_SET_SUPER_SCRIPT
,
113 mpViewShell
->GetViewFrame()->GetBindings().Invalidate( SidArray
);
115 if( mpDoc
->GetOnlineSpell() )
117 const SfxPoolItem
* pItem
;
118 if( SfxItemState::SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE
, false, &pItem
) ||
119 SfxItemState::SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE_CJK
, false, &pItem
) ||
120 SfxItemState::SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE_CTL
, false, &pItem
) )
122 mpDoc
->StopOnlineSpelling();
123 mpDoc
->StartOnlineSpelling();
128 void FuChar::Activate()
132 void FuChar::Deactivate()
136 } // end of namespace sd
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */