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/svdoutl.hxx>
22 #include <editeng/outliner.hxx>
23 #include <svx/svdmodel.hxx>
24 #include <svx/svdotext.hxx>
25 #include <svx/svdpage.hxx>
26 #include <editeng/editstat.hxx>
27 #include <svl/itempool.hxx>
28 #include <editeng/editview.hxx>
29 #include <editeng/editeng.hxx>
32 SdrOutliner::SdrOutliner( SfxItemPool
* pItemPool
, OutlinerMode nMode
)
33 : Outliner( pItemPool
, nMode
),
34 mpVisualizedPage(nullptr)
39 SdrOutliner::~SdrOutliner()
44 void SdrOutliner::SetTextObj( const SdrTextObj
* pObj
)
46 if( pObj
&& pObj
!= mxWeakTextObj
.get().get() )
48 SetUpdateLayout(false);
49 OutlinerMode nOutlinerMode2
= OutlinerMode::OutlineObject
;
50 if ( !pObj
->IsOutlText() )
51 nOutlinerMode2
= OutlinerMode::TextObject
;
52 Init( nOutlinerMode2
);
54 resetScalingParameters();
56 EEControlBits nStat
= GetControlWord();
57 nStat
&= ~EEControlBits( EEControlBits::STRETCHING
| EEControlBits::AUTOPAGESIZE
);
58 SetControlWord(nStat
);
60 Size
aMaxSize( 100000,100000 );
61 SetMinAutoPaperSize( Size() );
62 SetMaxAutoPaperSize( aMaxSize
);
63 SetPaperSize( aMaxSize
);
64 SetTextColumns(pObj
->GetTextColumnsNumber(), pObj
->GetTextColumnsSpacing());
67 if (pObj
->GetTextEditOutliner())
68 SetBackgroundColor(pObj
->GetTextEditOutliner()->GetEditEngine().GetBackgroundColor());
71 mxWeakTextObj
= const_cast< SdrTextObj
* >(pObj
);
74 void SdrOutliner::SetTextObjNoInit( const SdrTextObj
* pObj
)
76 mxWeakTextObj
= const_cast< SdrTextObj
* >(pObj
);
79 OUString
SdrOutliner::CalcFieldValue(const SvxFieldItem
& rField
, sal_Int32 nPara
, sal_Int32 nPos
,
80 std::optional
<Color
>& rpTxtColor
, std::optional
<Color
>& rpFldColor
,
81 std::optional
<FontLineStyle
>& rpFldLineStyle
)
86 if(auto pTextObj
= mxWeakTextObj
.get())
87 bOk
= pTextObj
->CalcFieldValue(rField
, nPara
, nPos
, false, rpTxtColor
, rpFldColor
, rpFldLineStyle
, aRet
);
90 aRet
= Outliner::CalcFieldValue(rField
, nPara
, nPos
, rpTxtColor
, rpFldColor
, rpFldLineStyle
);
95 const SdrTextObj
* SdrOutliner::GetTextObj() const
97 return mxWeakTextObj
.get().get();
100 bool SdrOutliner::hasEditViewCallbacks() const
102 for (size_t a(0); a
< GetViewCount(); a
++)
104 OutlinerView
* pOutlinerView
= GetView(a
);
106 if (pOutlinerView
&& pOutlinerView
->GetEditView().getEditViewCallbacks())
115 std::optional
<bool> SdrOutliner::GetCompatFlag(SdrCompatibilityFlag eFlag
) const
117 if( mpVisualizedPage
)
119 return {mpVisualizedPage
->getSdrModelFromSdrPage().GetCompatibilityFlag(eFlag
)};
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */