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 <sfx2/viewfrm.hxx>
22 #include <sfx2/sfxdlg.hxx>
24 #include <svx/svxids.hrc>
25 #include <editeng/eeitem.hxx>
26 #include <editeng/colritem.hxx>
27 #include <editeng/brushitem.hxx>
28 #include <sfx2/bindings.hxx>
29 #include <sfx2/request.hxx>
31 #include <drawdoc.hxx>
32 #include <ViewShell.hxx>
33 #include <DrawDocShell.hxx>
34 #include <sdabstdlg.hxx>
45 : FuPoor(pViewSh
, pWin
, pView
, pDoc
, rReq
)
49 rtl::Reference
<FuPoor
> FuChar::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
51 rtl::Reference
<FuPoor
> xFunc( new FuChar( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
52 xFunc
->DoExecute(rReq
);
56 void FuChar::DoExecute( SfxRequest
& rReq
)
58 const SfxItemSet
* pArgs
= rReq
.GetArgs();
62 SfxItemSet
aEditAttr( mpDoc
->GetPool() );
63 mpView
->GetAttributes( aEditAttr
);
65 SfxItemSetFixed
<XATTR_FILLSTYLE
, XATTR_FILLCOLOR
, EE_ITEMS_START
, EE_ITEMS_END
> aNewAttr(mpViewShell
->GetPool());
66 aNewAttr
.Put( aEditAttr
, false );
68 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
69 ScopedVclPtr
<SfxAbstractTabDialog
> pDlg( pFact
->CreateSdTabCharDialog(mpViewShell
->GetFrameWeld(), &aNewAttr
, mpDoc
->GetDocSh() ) );
70 if (rReq
.GetSlot() == SID_CHAR_DLG_EFFECT
)
72 pDlg
->SetCurPageId(u
"RID_SVXPAGE_CHAR_EFFECTS"_ustr
);
75 sal_uInt16 nResult
= pDlg
->Execute();
77 if( nResult
!= RET_OK
)
80 const SfxItemSet
* pOutputSet
= pDlg
->GetOutputItemSet();
81 SfxItemSet
aOtherSet( *pOutputSet
);
83 // and now the reverse process
84 const SvxBrushItem
* pBrushItem
= aOtherSet
.GetItem
<SvxBrushItem
>( SID_ATTR_BRUSH_CHAR
);
88 SvxColorItem
aBackColorItem( pBrushItem
->GetColor(), EE_CHAR_BKGCOLOR
);
89 aOtherSet
.ClearItem( SID_ATTR_BRUSH_CHAR
);
90 aOtherSet
.Put( aBackColorItem
);
93 rReq
.Done( aOtherSet
);
94 pArgs
= rReq
.GetArgs();
96 mpView
->SetAttributes(*pArgs
);
98 // invalidate the Slots which are in DrTxtObjBar
99 static const 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_ATTR_CHAR_CASEMAP
,
110 SID_SET_SUPER_SCRIPT
,
112 SID_ATTR_CHAR_BACK_COLOR
,
115 mpViewShell
->GetViewFrame()->GetBindings().Invalidate( SidArray
);
117 if( mpDoc
->GetOnlineSpell() )
119 if( SfxItemState::SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE
, false ) ||
120 SfxItemState::SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE_CJK
, false ) ||
121 SfxItemState::SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE_CTL
, false ) )
123 mpDoc
->StopOnlineSpelling();
124 mpDoc
->StartOnlineSpelling();
129 void FuChar::Activate()
133 void FuChar::Deactivate()
137 } // end of namespace sd
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */