LibreOffice Module sd (master) 1
fuparagr.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <fuparagr.hxx>
21#include <editeng/eeitem.hxx>
22#include <sfx2/bindings.hxx>
23#include <sfx2/request.hxx>
24#include <sfx2/viewfrm.hxx>
25#include <sfx2/sfxdlg.hxx>
26#include <svx/svxids.hrc>
27#include <editeng/editdata.hxx>
28#include <editeng/lrspitem.hxx>
29#include <svx/svdoutl.hxx>
30#include <svl/intitem.hxx>
31
32#include <View.hxx>
33#include <ViewShell.hxx>
34#include <drawdoc.hxx>
35#include <sdabstdlg.hxx>
36#include <sdattr.hrc>
37
38namespace sd {
39
40
42 ViewShell* pViewSh,
43 ::sd::Window* pWin,
44 ::sd::View* pView,
45 SdDrawDocument* pDoc,
46 SfxRequest& rReq)
47 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
48{
49}
50
52{
53 rtl::Reference<FuPoor> xFunc( new FuParagraph( pViewSh, pWin, pView, pDoc, rReq ) );
54 xFunc->DoExecute(rReq);
55 return xFunc;
56}
57
59{
60 const SfxItemSet* pArgs = rReq.GetArgs();
61
64
65 if( !pArgs )
66 {
67 SfxItemSet aEditAttr( mpDoc->GetPool() );
68 mpView->GetAttributes( aEditAttr );
69 SfxItemPool *pPool = aEditAttr.GetPool();
71 SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
72 ATTR_PARANUMBERING_START, ATTR_PARANUMBERING_END> aNewAttr( *pPool );
73
74 aNewAttr.Put( aEditAttr );
75
76 // left border is offset
77 const ::tools::Long nOff = aNewAttr.Get( EE_PARA_LRSPACE ).GetTextLeft();
78 // conversion since TabulatorTabPage always uses Twips!
79 SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
80 aNewAttr.Put( aOff );
81
82 if( pOutlView && pOutliner )
83 {
84 ESelection eSelection = pOutlView->GetSelection();
85 aNewAttr.Put( SfxInt16Item( ATTR_NUMBER_NEWSTART_AT, pOutliner->GetNumberingStartValue( eSelection.nStartPara ) ) );
86 aNewAttr.Put( SfxBoolItem( ATTR_NUMBER_NEWSTART, pOutliner->IsParaIsNumberingRestart( eSelection.nStartPara ) ) );
87 }
88
91
92 sal_uInt16 nResult = pDlg->Execute();
93
94 switch( nResult )
95 {
96 case RET_OK:
97 {
98 rReq.Done( *( pDlg->GetOutputItemSet() ) );
99
100 pArgs = rReq.GetArgs();
101 }
102 break;
103
104 default:
105 return; // Cancel
106 }
107 }
108 mpView->SetAttributes( *pArgs );
109
110 if( pOutlView && pOutliner )
111 {
112 ESelection eSelection = pOutlView->GetSelection();
113
114 if( const SfxBoolItem* pItem = pArgs->GetItemIfSet( ATTR_NUMBER_NEWSTART, false ) )
115 {
116 const bool bNewStart = pItem->GetValue();
117 pOutliner->SetParaIsNumberingRestart( eSelection.nStartPara, bNewStart );
118 }
119
120 if( const SfxInt16Item* pItem = pArgs->GetItemIfSet( ATTR_NUMBER_NEWSTART_AT, false ) )
121 {
122 const sal_Int16 nStartAt = pItem->GetValue();
123 pOutliner->SetNumberingStartValue( eSelection.nStartPara, nStartAt );
124 }
125 }
126
127 // invalidate slots
128 static const sal_uInt16 SidArray[] = {
129 SID_ATTR_TABSTOP,
130 SID_ATTR_PARA_ADJUST_LEFT,
131 SID_ATTR_PARA_ADJUST_RIGHT,
132 SID_ATTR_PARA_ADJUST_CENTER,
133 SID_ATTR_PARA_ADJUST_BLOCK,
134 SID_ATTR_PARA_LINESPACE,
135 SID_ATTR_PARA_LINESPACE_10,
136 SID_ATTR_PARA_LINESPACE_15,
137 SID_ATTR_PARA_LINESPACE_20,
138 SID_ATTR_PARA_ULSPACE,
139 SID_ATTR_PARA_LRSPACE,
140 SID_DEC_INDENT,
141 SID_INC_INDENT,
142 SID_ATTR_PARA_LEFT_TO_RIGHT,
143 SID_ATTR_PARA_RIGHT_TO_LEFT,
144 SID_RULER_TEXT_RIGHT_TO_LEFT,
145 SID_PARASPACE_INCREASE,
146 SID_PARASPACE_DECREASE,
147 0 };
148
150}
151
153{
154}
155
157{
158}
159
160} // end of namespace sd
161
162/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ESelection GetSelection() const
bool IsParaIsNumberingRestart(sal_Int32 nPara) const
sal_Int16 GetNumberingStartValue(sal_Int32 nPara) const
void SetNumberingStartValue(sal_Int32 nPara, sal_Int16 nNumberingStartValue)
void SetParaIsNumberingRestart(sal_Int32 nPara, bool bParaIsNumberingRestart)
virtual VclPtr< SfxAbstractTabDialog > CreateSdParagraphTabDlg(weld::Window *pWindow, const SfxItemSet *pAttr)=0
static SD_DLLPUBLIC SdAbstractDialogFactory * Create()
Definition: sdabstdlg.cxx:38
SAL_DLLPRIVATE SfxItemPool & GetPool()
Definition: drawdoc.hxx:237
const OutlinerView * GetTextEditOutlinerView() const
const SdrOutliner * GetTextEditOutliner() const
void Invalidate(sal_uInt16 nId)
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxItemSet * GetArgs() const
void Done(bool bRemove=false)
SfxBindings & GetBindings()
virtual void Activate() override
activates the function
Definition: fuparagr.cxx:152
virtual void DoExecute(SfxRequest &rReq) override
Definition: fuparagr.cxx:58
virtual void Deactivate() override
deactivates the function
Definition: fuparagr.cxx:156
static rtl::Reference< FuPoor > Create(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: fuparagr.cxx:51
FuParagraph(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: fuparagr.cxx:41
Base class for all functions.
Definition: fupoor.hxx:48
SdDrawDocument * mpDoc
Definition: fupoor.hxx:148
ViewShell * mpViewShell
Definition: fupoor.hxx:145
::sd::View * mpView
Definition: fupoor.hxx:144
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
SD_DLLPUBLIC weld::Window * GetFrameWeld() const
Definition: viewshel.cxx:1582
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
Definition: viewshel.cxx:118
virtual bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false, bool bSlide=false, bool bMaster=false)
Definition: sdview.cxx:509
virtual void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr=false) const
Definition: sdview.cxx:515
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
constexpr TypedWhichId< SvxLRSpaceItem > EE_PARA_LRSPACE(EE_PARA_START+13)
constexpr sal_uInt16 EE_ITEMS_END(EE_FEATURE_END)
constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END+1)
const sal_uInt16 SidArray[]
Definition: fuoltext.cxx:43
sal_Int32 nStartPara
RET_OK