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 <svx/svdoutl.hxx>
21 #include <editeng/outliner.hxx>
22 #include <svx/svdotext.hxx>
23 #include <editeng/editstat.hxx>
24 #include <svl/itempool.hxx>
25 #include <editeng/editview.hxx>
26 
27 
29 : Outliner( pItemPool, nMode ),
30  mpVisualizedPage(nullptr)
31 {
32 }
33 
34 
36 {
37 }
38 
39 
41 {
42  if( pObj && pObj != mxWeakTextObj.get() )
43  {
44  SetUpdateLayout(false);
45  OutlinerMode nOutlinerMode2 = OutlinerMode::OutlineObject;
46  if ( !pObj->IsOutlText() )
47  nOutlinerMode2 = OutlinerMode::TextObject;
48  Init( nOutlinerMode2 );
49 
51 
52  EEControlBits nStat = GetControlWord();
53  nStat &= ~EEControlBits( EEControlBits::STRETCHING | EEControlBits::AUTOPAGESIZE );
54  SetControlWord(nStat);
55 
56  Size aMaxSize( 100000,100000 );
58  SetMaxAutoPaperSize( aMaxSize );
59  SetPaperSize( aMaxSize );
61  ClearPolygon();
62  }
63 
64  mxWeakTextObj.reset( const_cast< SdrTextObj* >(pObj) );
65 }
66 
68 {
69  mxWeakTextObj.reset( const_cast< SdrTextObj* >(pObj) );
70 }
71 
72 OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
73  std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor)
74 {
75  bool bOk = false;
76  OUString aRet;
77 
78  if(mxWeakTextObj.is())
79  bOk = mxWeakTextObj->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, aRet);
80 
81  if (!bOk)
82  aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
83 
84  return aRet;
85 }
86 
88 {
89  return mxWeakTextObj.get();
90 }
91 
93 {
94  for (size_t a(0); a < GetViewCount(); a++)
95  {
96  OutlinerView* pOutlinerView = GetView(a);
97 
98  if (pOutlinerView && pOutlinerView->GetEditView().getEditViewCallbacks())
99  {
100  return true;
101  }
102  }
103 
104  return false;
105 }
106 
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetTextObjNoInit(const SdrTextObj *pObj)
Definition: svdoutl.cxx:67
void SetTextColumns(sal_Int16 nColumns, sal_Int32 nSpacing)
OutlinerMode
EditViewCallbacks * getEditViewCallbacks() const
void SetPaperSize(const Size &rSize)
tools::WeakReference< SdrTextObj > mxWeakTextObj
Definition: svdoutl.hxx:31
void Init(OutlinerMode nMode)
EEControlBits
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rTxtColor, std::optional< Color > &rFldColor)
void SetControlWord(EEControlBits nWord)
OutlinerView * GetView(size_t nIndex) const
virtual bool CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_uInt16 nPos, bool bEdit, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor, OUString &rRet) const
Definition: svdotxfl.cxx:22
SdrOutliner(SfxItemPool *pItemPool, OutlinerMode nMode)
Definition: svdoutl.cxx:28
EEControlBits GetControlWord() const
bool hasEditViewCallbacks() const
Definition: svdoutl.cxx:92
EditView & GetEditView() const
virtual OUString CalcFieldValue(const SvxFieldItem &rField, sal_Int32 nPara, sal_Int32 nPos, std::optional< Color > &rpTxtColor, std::optional< Color > &rpFldColor) override
Definition: svdoutl.cxx:72
uno_Any a
void SetGlobalCharStretching(sal_uInt16 nX=100, sal_uInt16 nY=100)
sal_Int16 GetTextColumnsNumber() const
Definition: svdotext.cxx:1762
void reset(reference_type *pReference)
virtual ~SdrOutliner() override
Definition: svdoutl.cxx:35
size_t GetViewCount() const
bool is() const
void SetMaxAutoPaperSize(const Size &rSz)
reference_type * get() const
void SetMinAutoPaperSize(const Size &rSz)
bool SetUpdateLayout(bool bUpdate)
bool IsOutlText() const
Definition: svdotext.hxx:335
void SetTextObj(const SdrTextObj *pObj)
Definition: svdoutl.cxx:40
sal_Int32 GetTextColumnsSpacing() const
Definition: svdotext.cxx:1777
const SdrTextObj * GetTextObj() const
Definition: svdoutl.cxx:87
void ClearPolygon()