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 != mpTextObj.get() )
43  {
44  SetUpdateMode(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 );
60  ClearPolygon();
61  }
62 
63  mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
64 }
65 
67 {
68  mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
69 }
70 
71 OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
72  std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor)
73 {
74  bool bOk = false;
75  OUString aRet;
76 
77  if(mpTextObj.is())
78  bOk = mpTextObj->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, aRet);
79 
80  if (!bOk)
81  aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
82 
83  return aRet;
84 }
85 
87 {
88  return mpTextObj.get();
89 }
90 
92 {
93  for (size_t a(0); a < GetViewCount(); a++)
94  {
95  OutlinerView* pOutlinerView = GetView(a);
96 
97  if (pOutlinerView && pOutlinerView->GetEditView().getEditViewCallbacks())
98  {
99  return true;
100  }
101  }
102 
103  return false;
104 }
105 
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetTextObjNoInit(const SdrTextObj *pObj)
Definition: svdoutl.cxx:66
OutlinerMode
void SetPaperSize(const Size &rSize)
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:91
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:71
const EditViewCallbacks * getEditViewCallbacks() const
uno_Any a
void SetGlobalCharStretching(sal_uInt16 nX=100, sal_uInt16 nY=100)
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)
void Init(OutlinerMode nOutlinerMode)
void SetUpdateMode(bool bUpdate)
bool IsOutlText() const
Definition: svdotext.hxx:344
void SetTextObj(const SdrTextObj *pObj)
Definition: svdoutl.cxx:40
const SdrTextObj * GetTextObj() const
Definition: svdoutl.cxx:86
tools::WeakReference< SdrTextObj > mpTextObj
Definition: svdoutl.hxx:32
void ClearPolygon()