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 <editeng/colritem.hxx>
28 #include <editeng/brushitem.hxx>
29 #include <sfx2/bindings.hxx>
30 #include <sfx2/request.hxx>
33 #include <drawview.hxx>
34 #include <drawdoc.hxx>
35 #include <DrawViewShell.hxx>
36 #include <ViewShell.hxx>
37 #include <DrawDocShell.hxx>
38 #include <sdabstdlg.hxx>
50 : FuPoor(pViewSh
, pWin
, pView
, pDoc
, rReq
)
54 rtl::Reference
<FuPoor
> FuChar::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
56 rtl::Reference
<FuPoor
> xFunc( new FuChar( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
57 xFunc
->DoExecute(rReq
);
61 void FuChar::DoExecute( SfxRequest
& rReq
)
63 const SfxItemSet
* pArgs
= rReq
.GetArgs();
67 SfxItemSet
aEditAttr( mpDoc
->GetPool() );
68 mpView
->GetAttributes( aEditAttr
);
70 SfxItemSet
aNewAttr(mpViewShell
->GetPool(), svl::Items
<EE_ITEMS_START
, EE_ITEMS_END
>{});
71 aNewAttr
.Put( aEditAttr
, false );
73 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
74 ScopedVclPtr
<SfxAbstractTabDialog
> pDlg(pFact
? pFact
->CreateSdTabCharDialog(mpViewShell
->GetActiveWindow(), &aNewAttr
, mpDoc
->GetDocSh() ) : nullptr);
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 const SfxItemSet
* pOutputSet
= pDlg
->GetOutputItemSet();
88 SfxItemSet
aOtherSet( *pOutputSet
);
90 // and now the reverse process
91 const SvxBrushItem
* pBrushItem
= aOtherSet
.GetItem
<SvxBrushItem
>( SID_ATTR_BRUSH_CHAR
);
95 SvxBackgroundColorItem
aBackColorItem( pBrushItem
->GetColor(), EE_CHAR_BKGCOLOR
);
96 aOtherSet
.ClearItem( SID_ATTR_BRUSH_CHAR
);
97 aOtherSet
.Put( aBackColorItem
);
100 rReq
.Done( aOtherSet
);
101 pArgs
= rReq
.GetArgs();
104 if( nResult
!= RET_OK
)
109 mpView
->SetAttributes(*pArgs
);
111 // invalidate the Slots which are in DrTxtObjBar
112 static const sal_uInt16 SidArray
[] = {
114 SID_ATTR_CHAR_POSTURE
,
115 SID_ATTR_CHAR_WEIGHT
,
116 SID_ATTR_CHAR_SHADOWED
,
117 SID_ATTR_CHAR_STRIKEOUT
,
118 SID_ATTR_CHAR_UNDERLINE
,
119 SID_ATTR_CHAR_FONTHEIGHT
,
121 SID_ATTR_CHAR_KERNING
,
122 SID_ATTR_CHAR_CASEMAP
,
123 SID_SET_SUPER_SCRIPT
,
125 SID_ATTR_CHAR_BACK_COLOR
,
128 mpViewShell
->GetViewFrame()->GetBindings().Invalidate( SidArray
);
130 if( mpDoc
->GetOnlineSpell() )
132 const SfxPoolItem
* pItem
;
133 if( SfxItemState::SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE
, false, &pItem
) ||
134 SfxItemState::SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE_CJK
, false, &pItem
) ||
135 SfxItemState::SET
== pArgs
->GetItemState(EE_CHAR_LANGUAGE_CTL
, false, &pItem
) )
137 mpDoc
->StopOnlineSpelling();
138 mpDoc
->StartOnlineSpelling();
143 void FuChar::Activate()
147 void FuChar::Deactivate()
151 } // end of namespace sd
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */