LibreOffice Module svx (master) 1
svdoutl.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 <optional>
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
30
32: Outliner( pItemPool, nMode ),
33 mpVisualizedPage(nullptr)
34{
35}
36
37
39{
40}
41
42
44{
45 if( pObj && pObj != mxWeakTextObj.get().get() )
46 {
47 SetUpdateLayout(false);
48 OutlinerMode nOutlinerMode2 = OutlinerMode::OutlineObject;
49 if ( !pObj->IsOutlText() )
50 nOutlinerMode2 = OutlinerMode::TextObject;
51 Init( nOutlinerMode2 );
52
53 setGlobalScale(100.0, 100.0, 100.0, 100.0);
54
56 nStat &= ~EEControlBits( EEControlBits::STRETCHING | EEControlBits::AUTOPAGESIZE );
57 SetControlWord(nStat);
58
59 Size aMaxSize( 100000,100000 );
61 SetMaxAutoPaperSize( aMaxSize );
62 SetPaperSize( aMaxSize );
65 }
66
67 mxWeakTextObj = const_cast< SdrTextObj* >(pObj);
68}
69
71{
72 mxWeakTextObj = const_cast< SdrTextObj* >(pObj);
73}
74
75OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
76 std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor,
77 std::optional<FontLineStyle>& rpFldLineStyle)
78{
79 bool bOk = false;
80 OUString aRet;
81
82 if(auto pTextObj = mxWeakTextObj.get())
83 bOk = pTextObj->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, rpFldLineStyle, aRet);
84
85 if (!bOk)
86 aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle);
87
88 return aRet;
89}
90
92{
93 return mxWeakTextObj.get().get();
94}
95
97{
98 for (size_t a(0); a < GetViewCount(); a++)
99 {
100 OutlinerView* pOutlinerView = GetView(a);
101
102 if (pOutlinerView && pOutlinerView->GetEditView().getEditViewCallbacks())
103 {
104 return true;
105 }
106 }
107
108 return false;
109}
110
111std::optional<bool> SdrOutliner::GetCompatFlag(SdrCompatibilityFlag eFlag) const
112{
113 if( mpVisualizedPage )
114 {
116 }
117 return {};
118}
119
120/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
EditViewCallbacks * getEditViewCallbacks() const
EditView & GetEditView() const
void SetMaxAutoPaperSize(const Size &rSz)
void SetTextColumns(sal_Int16 nColumns, sal_Int32 nSpacing)
void SetMinAutoPaperSize(const Size &rSz)
void SetPaperSize(const Size &rSize)
bool SetUpdateLayout(bool bUpdate)
OutlinerView * GetView(size_t nIndex) const
EEControlBits GetControlWord() const
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rTxtColor, std::optional< Color > &rFldColor, std::optional< FontLineStyle > &rFldLineStyle)
void SetControlWord(EEControlBits nWord)
void ClearPolygon()
void setGlobalScale(double rFontX=100.0, double rFontY=100.0, double rSpacingX=100.0, double rSpacingY=100.0)
void Init(OutlinerMode nMode)
size_t GetViewCount() const
bool GetCompatibilityFlag(SdrCompatibilityFlag eFlag) const
Definition: svdmodel.cxx:1733
virtual std::optional< bool > GetCompatFlag(SdrCompatibilityFlag eFlag) const override
Definition: svdoutl.cxx:111
::unotools::WeakReference< SdrTextObj > mxWeakTextObj
Definition: svdoutl.hxx:33
void SetTextObj(const SdrTextObj *pObj)
Definition: svdoutl.cxx:43
bool hasEditViewCallbacks() const
Definition: svdoutl.cxx:96
virtual ~SdrOutliner() override
Definition: svdoutl.cxx:38
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor, std::optional< FontLineStyle > &rpFldLineStyle) override
Definition: svdoutl.cxx:75
const SdrTextObj * GetTextObj() const
Definition: svdoutl.cxx:91
const SdrPage * mpVisualizedPage
Definition: svdoutl.hxx:34
SdrOutliner(SfxItemPool *pItemPool, OutlinerMode nMode)
Definition: svdoutl.cxx:31
void SetTextObjNoInit(const SdrTextObj *pObj)
Definition: svdoutl.cxx:70
SdrModel & getSdrModelFromSdrPage() const
Definition: svdpage.hxx:403
sal_Int32 GetTextColumnsSpacing() const
Definition: svdotext.cxx:1869
bool IsOutlText() const
Definition: svdotext.hxx:360
sal_Int16 GetTextColumnsNumber() const
Definition: svdotext.cxx:1854
rtl::Reference< interface_type > SAL_CALL get() const
SdrCompatibilityFlag
SdrCompatibilityFlags that are implemented in SdrModelImpl.
Definition: compatflags.hxx:12
EEControlBits
uno_Any a
sal_uInt16 nPos
OutlinerMode